monkeychump
asked on
Generate Unique serial numbers
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 "123456789ABCDEFGHJKLMNPQR STUWXYZ", 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
any ideas..
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 "123456789ABCDEFGHJKLMNPQR
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
any ideas..
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I have MD5 hashed a uuid which gives a 32 character hex string, which is more "random" in its appearance, but what i was hoping to do was shorten that to 20 characters (with a larger caracter set), but retain its uniqueness..