+ 4
Unexpected results from MD5 hashing in PHP
I've echo a string and then handed it it returned the results like "abcd3636vxbvf55hvxv" and when I used the POST method by getting the same string submitted by the form and hashed it, it returned some thing else like "hfy5747vgdhbf574gjcv" is there anything wrong? The string is "$Azzazkhan2003" [password]
6 ответов
+ 2
try with single quote hash("md5",'$Azzazkhan2003')
+ 2
Found the error as the PHP supports variables while in a string (i.e $password and "$password"are the same) and the password also contains the dolor sign ($) (i.e "$Azzazkhan2003") so PHP has taken the password as a variable, but the variable was not defined and it assigned to value "undefined" to password instead of the real password entered.
+ 1
Show me your hash coding part.
+ 1
POST: ("password" => "$Azzazkhan2003")
echo "Typed: " . hash("md5", "$Azzazkhan2003") . ", Submitted: " . hash("md5", $_POST['password'];
+ 1
Yes, that's why you must use single quote.
0
check ig you are using encrypte, sholud be multipart