I’m using the base64_encode function to hash strings. The strings must be a-zA-Z0-9 and sometimes base64_encode outputs the = sign at the end (sometimes twice).
What is the most efficient way to alter the base64_encode function (override?) to omit the = signs?
The possible
=s at the end are required if you want to decode the value later. Also, the character seta-zA-Z0-9has only 62 values and thus a base-64 encoded value can never fit inside it.Update: If you need to hash strings, why not use a hash function?
md5should be a good go-to solution unless the application is security-sensitive, in which case a stronger hash (sha1or better) should be used.