BUG? sha-moduel returns same crc for different files
akuchlin at mems-exchange.org
Fri Sep 15 16:14:12 CEST 2000
"Thomas Weholt" <thomas at cintra.no> writes:
> K:\KimIglinsky-0101-1.jpg 9486845232ae19c8fc1f9dc10d65ae2f4ac4d95e 158275
> K:\ShirleyMallman-1216-1.jpg 9486845232ae19c8fc1f9dc10d65ae2f4ac4d95e 161972
> CRC1 == CRC2 : 1 Size1 == Size2: 0
> The output clearly says the size is different, but the crc the same.
Fascinating. I'll bet that the problem is that you're not opening the
files in binary mode, so the .read() is hitting an EOF (byte 26) early
in both files, and this prefix is the same. You can check this by
doing 'data1=open(filename1).read() ; data2=...' and then comparing
data1 and data2.
In that case, the fix is to use open(filename1, 'rb').
More information about the Python-list