Last active
July 15, 2017 13:17
-
-
Save rifki/6fca4757c5d62b70e107920cebf99693 to your computer and use it in GitHub Desktop.
magento 1.9.x: create customer password manually
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// salt random string | |
// see formula: app/code/core/Mage/Core/Helper/Data.php method getRandomString | |
function salt($len = 32) { | |
$chars_lowers = 'abcdefghijklmnopqrstuvwxyz'; | |
$chars_uppers = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
$charts_digits = '0123456789'; | |
$chars = $chars_lowers . $chars_uppers . $charts_digits; | |
for ($i = 0, $str = '', $lc = strlen($chars)-1; $i < $len; $i++) { | |
$str .= $chars[mt_rand(0, $lc)]; | |
} | |
return $str; | |
} | |
$password = 'topsecret'; | |
$salt = salt(); | |
$resultPassword = md5($salt . $password) . ':' . $salt; | |
// dump password | |
var_dump($resultPassword); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment