+ 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]

16th Mar 2017, 6:18 AM
Azzaz Khan
Azzaz Khan - avatar
6 Answers
+ 2
try with single quote hash("md5",'$Azzazkhan2003')
24th Apr 2017, 6:06 PM
Yusuf Malikul Mulki
Yusuf Malikul Mulki - avatar
+ 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.
24th May 2017, 2:40 PM
Azzaz Khan
Azzaz Khan - avatar
+ 1
Show me your hash coding part.
24th Apr 2017, 10:01 AM
Yusuf Malikul Mulki
Yusuf Malikul Mulki - avatar
+ 1
POST: ("password" => "$Azzazkhan2003") echo "Typed: " . hash("md5", "$Azzazkhan2003") . ", Submitted: " . hash("md5", $_POST['password'];
24th Apr 2017, 10:40 AM
Azzaz Khan
Azzaz Khan - avatar
+ 1
Yes, that's why you must use single quote.
3rd Jun 2017, 5:09 AM
Yusuf Malikul Mulki
Yusuf Malikul Mulki - avatar
0
check ig you are using encrypte, sholud be multipart
16th Mar 2017, 12:38 PM
Oscar Muñoz
Oscar Muñoz - avatar