项目作者: fyxme

项目描述 :
CRC-32 collision finder
高级语言: Go
项目地址: git://github.com/fyxme/crc-32-hash-collider.git
创建时间: 2021-07-08T14:05:50Z
项目社区:https://github.com/fyxme/crc-32-hash-collider

开源协议:

下载


CRC-32 hash collider

CRC-32 collision finder

CRC-32 algorithm outputs a 32-bit unsigned value and therefore can be easily bruteforced to find hash collisions.

This code uses the IEEE polynomial, however can be easily modified to other polynomials.

Written because I was looking for a tool to generate CRC-32 collisions during a CTF but couldn’t find any at the time…

After learning more about CRC-32, I’ve come to realise that there are faster ways to find collisions and reverse the output value. Since CRC-32 is not a cryptographic hash function, there are mathematical ways to reverse the hash value to a valid input. For more information, see the following tool: crc32.

Usage

To use this tool, simply modify the crc-32 target value and run:

  1. go run collide.go

Example

Looking to find a collision for CRC-32 value: -432570933

Note: old python versions generated signed integers and therefore allowed negative CRC-32 values

  1. // target CRC-32
  2. // & 0xffffffff is to convert to uint
  3. // required since old python versions allowed negative values to be produced
  4. // hence its needed if you want to find a collision for a "negative" crc hash value
  5. const target = -432570933 & 0xffffffff
  6. // max string length
  7. maxLen := 5

Running it produces the following output:

  1. $ go run collide.go
  2. Collision found: 4iSg@

Which can be verified using ipython:

  1. In [1]: import binascii
  2. In [2]: print(binascii.crc32("4iSg@"))
  3. -432570933