Righto :-)
Well, it happens that the md5 function does not support salt. However, mhash does.
Why use a salt, well, sorry, my mystake, it is to limit possibilities of bruteforce attack.
Try
<?
$p1="mypasswordstring";
$p2=md5($p1);
if ( md5($p1) == $p2 ) {
echo "p1 is the same as p2<BR><BR>";
} else {
echo "p1 is not the same as p2<BR><BR>";
}
$p3="mypasswordstring";
$p4=md5($p3);
if ( md5($p3) == $p4 ) {
echo "p3 is the same as p4<BR><BR>";
} else {
echo "p3 is not the same as p4<BR><BR>";
}
$p5="mypasswordstring";
$p6=mhash (MHASH_MD5, $p5, "test1");
if ( mhash (MHASH_MD5, $p5, "test1") == $p6 ) {
echo "p5 is the same as p6<BR><BR>";
} else {
echo "p6 is not the same as p6<BR><BR>";
}
$p7=$p5;
$p8= mhash (MHASH_MD5, $p7, "test2");
if ( mhash (MHASH_MD5, $p7, "test2") == $p8 ) {
echo "p7 is the same as p8<BR><BR>";
} else {
echo "p7 is not the same as p8<BR><BR>";
}
if ( p6 == $p8 ) {
echo "p6 is the same as p8<BR><BR>";
} else {
echo "p6 is not the same as p8<BR><BR>";
}
?>