Using the md5 () function in PHP directly gives me a string. Before storing a row in the database, I want to remove the zeros 0 if they are in the byte representation of this hexadecimal element, and this byte representation is <0x10, and then save the row in the database.
How can I do this in PHP?
MD5 - PHP - Raw Value - catch12 - 214423105677f2375487b4c6880c12ae - This is what I get now. Below is the value that I want to save PHP in the database.
MD5 - Original value - catch12 - 214423105677f2375487b4c688c12ae
I wonder why? The MD5 code that I have in the Android application for login and registration. I did not add zeros for the condition if ((b & 0xFF) < 0x10) hex.append("0");. Works great. But the "Forgot Password" function on the site is PHP when a discrepancy occurs if the user resets the password. JAVA below.
byte raw[] = md.digest();
StringBuffer hexString = new StringBuffer();
for (int i=0; i<raw.length; i++)
hexString.append(Integer.toHexString(0xFF & raw[i]));
v_password = hexString.toString();
Any help on the PHP side, so the mismatch does not happen, would be very helpful. I cannot change the application code because this will create problems for existing users.
Thank.
source
share