Robust and fast checksum algorithm?

前端 未结 10 1624
失恋的感觉
失恋的感觉 2020-12-23 20:30

Which checksum algorithm can you recommend in the following use case?

I want to generate checksums of small JPEG files (~8 kB each) to check if the content changed.

10条回答
  •  -上瘾入骨i
    2020-12-23 20:40

    According to the Wiki page pointed to by Luke, MD5 is actually faster than CRC32!

    I have tried this myself by using Python 2.6 on Windows Vista, and got the same result.

    Here are some results:

    crc32: 162.481544276 MBps md5: 224.489791549 MBps

    crc32: 168.332996575 MBps md5: 226.089336532 MBps

    crc32: 155.851515828 MBps md5: 194.943289532 MBps

    I am thinking about the same question as well, and I'm tempted to use the Rsync's variation of Adler-32 for detecting file differences.

提交回复
热议问题