I am reading some data from a user’s badge via a magnetic swipe. It brings back a long unique text string that includes the user’s badge number, their name, and a few other pieces of information. I want to be able to pull up the user’s information through their swipe. I was thinking of making an MD5 hash out of the user’s data, but i’m not sure how unique the MD5 would be from that swipe so I can store that md5 as how I look up the user in my MySQL database?
*** Update: Sorry, I should add that the badge might not necessarily be from us. It might be from another company, so I really just need to take what is on the badge and create a unique ID from that.
MD5 is a 128-bit hash, so it allows 2128 (340.282.366.920.938.463.463.374.607.431.768.211.456) unique identifiers, so if every human beeing on this world (about 6.900.000.000) should get a md5 unique identifier built out of this data, the chances of a collision are smaller than 1:4*1028. So it should be small enough.