digushi
digushi

Reputation: 17

How can I decrypt this script?

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?

Upvotes: 0

Views: 702

Answers (1)

Miroshko
Miroshko

Reputation: 873

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.

Upvotes: 4

Related Questions