0

I am generating a transaction ID that users will see on printouts of their transactions. The transaction ID is an md5 hash of the value of the auto increment column 'id' of a mysql database(type int). This limits the size of 'id' column to a maximum of 2^32 - 1 (=4294967295) and a minimum of 1. Is it possible there is a collision in that range?

Mutai Mwiti
  • 487
  • 1
  • 7
  • 20
  • Possible duplicate of [md5 hash collisions.](http://stackoverflow.com/questions/6885667/md5-hash-collisions) – Solarflare Jan 25 '17 at 14:16
  • 1
    Considering how fast MD5 is, you can definitely try this for at least 100 million values. Or, you could use a transaction id based partly on timestamp. e.g. `20170125111234` as in `yyyymmddhhxxxx` where xxxx is your `id` column modulo 10000. Notice that git uses the leading eight or ten digits of an SHA hash to identify commits. – O. Jones Jan 25 '17 at 14:26

0 Answers0