Hexadecimal Hash, Is there another?
I noticed that all hashing functions in PHP - md5, sha1, etc - just produces hexadecimal values for hashed string.
What could I use, if I want to hash a string to have fully alphanumeric values?, for example:
Part of the answer might be what the underlying functional requirement is. You could base64_encode() the hash, I suppose. But that includes "/" and "+" characters, as well as 0 to 2 "=" padding characters at the end.
Thank you very much. base64_encode() is the function I really need. I will use it to hash passwords. Of course, for security, the $data parameter will be the md5() hash output for the password.
I'd like to know an extra information. Why it was named as base64? What is the number 64 dedicated for? Does every value of its output unique? In other word, what's the probability for two different input strings to give similar output encoding string?
Just as base 16 (hexadecimal) has 16 digits: 0-9A-F, base64 has 64 digits: 0-9a-zA-Z/+. Note however that base64_encode() is NOT a hash, and is easily reversed (see base64_decode()), so it isn't really adding any significant security to your password hashing. The fact that other hashing algorithms output hex strings doesn't make them "weaker" than one that outputs base64 strings. If security is the driving force behind this question, I would recommend looking into using the hash function with the sha256 or sha512 algorithm (if available). And don't forget the salt.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread