1 vote
Loop MD5 hash different values on WP7 and PHP

Description

 
I've been trying to integrate MD5 hashes to my WP7 app but I've noticed that this implementation does not return the same hash if I compare with PHP's MD5 result. If I hash once, the hash values are equal, but if I hash more than once, the final hash result is different. Have you noticed this before or any idea why this might happen, possible fix, etc?

PHP Code
$pwd = "pwd";
for ($i=0; $i < 2 ; $i++)
{
$pwd = md5($pwd);
}
print $pwd;

WP7 Code
String hashpwd = "pwd";
for (int i = 0; i < 2; i++)
{
String hash = hashpwd;
hashpwd = MD5Core.GetHashString(hash);
}
MessageBox.Show(hashpwd);

File Attachments


No files are attached


Comments

most recent at top (show oldest at top)
Itoman wrote Nov 25 2011 at 12:58 AM
Figured out the problem. PHP's md5 function returns hashes with lowercase a-f but this implementation of md5 returns hashes with capital A-F. Set my hashed results to lowercase and that solved the issue! Hope this helps!


Updating...
Page view tracker