Generate Unique serial numbers
Posted on 2004-11-08
I'm looking for a way to generate unique serial numbers like you would find on a software product..
eg. ABCD - EFGH - JKLM - NPQR - STWX
i have a few requirements.
1) the number needs to be generated on the fly
2) it must be unique on the host machine, if it can be globally unique even better
3) it should contain only the charachters "123456789ABCDEFGHJKLMNPQRSTUWXYZ", so as to avoid mis-typing them
4) the key should be no more than 20 characters long, and always the same length
5) serial numbers will be validated against the DB, so it does not require a checksum
So far i've experimented with hashing uuid's and trying to convert them to different base systems, but i'm not sure whether the results i'm creating are still unique.
i'm happy to create the keys using cfscript or in a java object that i can instantiate in my CF code