简体   繁体   中英

Change a hashed password on PHPMyAdmin

I want to change the password of an account through PHPMyAdmin, but the passwords are all encrypted. I get an error when trying to change the password of the account through the applicaiton so I will do it here instead if possible.

Here is the code for the password:

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

And:

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

I am trying to use sha1-online.com to first of all re-create the hash which is stored on the database at the moment.

The password is stored as:

6b68f3c4d174fa0a8163db9fc9abdd81a75f9186a95c686039acaa4ac1d99f75dd0f838e6eb30412121e228bc4008d446d4ad24b3748beed7a28de3d78999122

and as a string is just password123

salt method:

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;
        }

The following will probably (if we're not missing any code) help you recreate a working pass:

$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 ;

Try storing the hash from http://codepad.org/rBfS6wEJ .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM