I’m looking to add basic licensing to my application. I want to take in the user’s name as a parameter and return a unique, fixed length code (sort of like MD5)
What are some algorithms that can do this?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The SHA algorithms should be decent for this (SHA-1, SHA-512, etc…). They are used in a lot of places where an MD5 could also be used but seem to be more well respected. I use them for password hashing, but sounds like their functionality as a 1-way hash would be good for this as well.
If you want fixed sized, you might then Base64 encode the resulting bytes and take the first N digits that you want. Even though you are losing some of the original hash, that should give you a large enough set of distinct possible keys that you are virtually impossible to get a repeat. As a frame of reference, this is a an example of a Base64 encoded UUID: “iFHqaiNjhTDpxp7ahBPX0A “
The possible result set of a UUID is so large that it is accepted practice to randomly generate them with the expectation that they are unique (I know this is surprising, but do a search).