0

我想通过PHPMyAdmin更改一个帐户的密码,但密码都是加密的。尝试通过应用程序更改帐户密码时出现错误,因此如果可能,我将在此处进行。

这是密码的代码:

$salt = $this->create_salt_password($username);
                $hash = $salt . $password;
                for ( $i = 0; $i < 100000; $i ++ ) 
                {
                    $hash = hash('sha256', $hash);
                }
                $hash = $salt . $hash;

和:

define('AUTH_SALT','wcRwGxDzULe?s3J%R^W@9)r}xfXpESul5hC,z^ze.oz*1E|ys,Bk,:Q/z_I&M9..');

我正在尝试使用 sha1-online.com 首先重新创建存储在数据库中的哈希。

密码存储为:

6b68f3c4d174fa0a8163db9fc9abdd81a75f9186a95c686039acaa4ac1d99f75dd0f838e6eb30412121e228bc4008d446d4ad24b3748beed7a28de3d78999122

而作为一个字符串只是password123

盐法:

public function create_salt_password($username)
        {
        /** Creates a hash value for the password using 
            a prefixed random unique identifier value with a static characters and the username
        */
            $salt = hash('sha256', uniqid(mt_rand(), true) .AUTH_SALT .strtolower($username));
            return $salt;
        }
4

1 回答 1

0

以下内容可能会(如果我们没有遗漏任何代码)帮助您重新创建工作通行证:

$username = 'sweetest_viv';
$password = 'password123';
$staticsalt = 'wcRwGxDzULe?s3J%R^W@9)r}xfXpESul5hC,z^ze.oz*1E|ys,Bk,:Q/z_I&M9..';

$salt = hash('sha256', uniqid(mt_rand(), true) .$staticsalt.strtolower($username));

$hash = $salt . $password;
for ( $i = 0; $i < 100000; $i ++ ) 
{
$hash = hash('sha256', $hash);
}
$hash = $salt . $hash;

echo 'Salt: ' . PHP_EOL . $salt;
echo PHP_EOL.PHP_EOL;
echo 'Hash: ' . PHP_EOL . $hash ;

尝试存储来自http://codepad.org/rBfS6wEJ的哈希。

于 2013-07-24T16:53:08.410 回答