Paul C's Blog

To be funny,to grow up!

0%

crc32碰撞

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from zlib import crc32
import random

char='0123456789'

def crc32_f(data):
return hex(crc32(data)&0xffffffff)[2:10]

length=input('length:')
crc32_=raw_input('crc32:').lower()

while True:
text=''
for i in range(length):
text+=char[random.randint(0,len(char)-1)]
if crc32_f(text)==crc32_:
raw_input('find it:'+text)
exit