I have a piece of code below where it echos a salted password:
$pass = rand();
$pass = md5($pass);
$pass = substr($pass, 0, 15);
$pass = md5(md5("g3f".$pass."rt4"));
Now if I echo $pass, then it will output this for example:
8723d9c8a8b2af798be25fd07ab0ff0a
But what I want to do is echo the password itself so that for example instead of displaying the above it will display the string which is “password”.
How can this be achieved?
Thanks
Don’t overwrite the variable
$pass;MD5 hashing especially with a salt is a one way process. You can’t reverse it.
Any good password system does not store the original password but stores the hashed copy, it then verifies the user entered it correctly by hashing their input and comparing the two.