How can I decrypt passwords that are encrypted as follows:
function PwdHash($pwd, $salt = null)
{
if ($salt === null) {
$salt = substr(md5(uniqid(rand(), true)), 0, SALT_LENGTH);
}
else {
$salt = substr($salt, 0, SALT_LENGTH);
}
return $salt . sha1($pwd . $salt);
}
Given that SALT_LENGTH is 9?
This is not an encrypting function, this is hash, so it’s not supposed to be decrypted at all. The only way one can is bruteforce using this algorithm and hoping that you finally get a collision, but this may take very long time.