Closed Offirmo closed 8 years ago
@Offirmo that makes sense :P I will think about a better way over the weekend. @khalilTN is right, the mac address would be the ultimate solution for making the ID's completely unique, however I also want their length to be as small as possible.
Thanks, Adam
How about hash hostname ? like md5 or something else.
Event we can use full hostname, we should think about that hostname can contain other characters beyond alphanumeric characters.
I thought about md5 too, but md5 generates 32 hexadecimal digits, the uid will be long and that violates @adamhalasz length constraint. In my own, there can be 2 procedures :
What do you think ?
we can still use first 3 letters of md5 result. however, mac address is another option.
and how about hash current time ?
i think using the first 3 letters would rize the collision probability
Hey guys I added MAC Address support to v3. It's a bit longer but still just 18 bytes. There are also 2 new weaker functions with shorter length: uniqid.process()
and uniqid.time()
@Offirmo I believe this solves your issue.
Thanks, Adam
In my company, all machines in Paris office have a name that starts with "PAR". Taking the 3 first letters is not enough ^^