DEV Community

satyam suman
satyam suman

Posted on

SHA1 MD5 Encoding doesn't return same hash

SHA1 MD5 Encoding doesn't return same hash

-1

we have existing user base on mysql with password encoded using md5 and sha1, with below logic -

// Password and salt generation
define('SALT_LENGTH', 9); // salt for password
function PwdHash($pwd, $salt = null)
{
    if ($salt === null) {
        $salt = substr(md5(uniqid(rand(), true)), 0, SALT_LENGTH)
    } else {
        $salt

Top comments (0)