在PHPMyAdmin上更改哈希密码

时间:2013-07-24 16:39:12

标签: php hash phpmyadmin salt

我想通过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;
        }

1 个答案:

答案 0 :(得分: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的哈希值。

相关问题