substr md5 collision

前端 未结 3 1906
迷失自我
迷失自我 2021-01-18 10:40

I need a 4-character hash. At the moment I am taking the first 4 characters of a md5() hash. I am hashing a string which is 80 characters long or less. Will thi

3条回答
  •  后悔当初
    2021-01-18 11:11

    4 first characters contains 4*4 = 16 bits of data, so collision will be definitely at 65536 elements, and, due to birthday attack, it will be found much faster. You should use more bits of hash.

提交回复
热议问题