I have an encryption class to encrypt a user's password, and the end result is a binary string.
I want to save this to MySQL as the user's password, but because MySQL doesn't play very well with binary data, I wanted to convert it to a more database-friendly format.
I seem to be able to encrypt/decrypt just fine saving and pulling values from MySQL as long as I either use bin2hex or base64_encode beforehand and hex2bin or base64_decode afterward.
My question is, should there be any reason why I should choose one over the other? Is any 1 more reliable over another? Is any 1 faster than another?
Thank you.
bin2hexstackoverflow.com/questions/2558453/… .bin2hexmay use more memory than base64 operations, however base64 strings are likely going to be longer due to padding. You should run local research and measure differences in memory usage and execution time.