I need to generate simple, 4 digits confirmation SMS code, which based on given information, e. g. username, or birthdate, whatever. So, for two identical inputs, I need two same output codes.I can't store this code in database.I'm writing in C#, and have been thinking about GetHashCode method, but he is highly not recommended to use anywhere. Maybe some hashing, but they have much more that 4 character string.How can I generate such code?
Generating 4 digits SMS confirmation code
c#;sms
Just take the pieces of info you need, concatenate them together into a string, then hash it with a cryptographic hash function. Take the bottom 4 digits of the hash and call it a day.