Magento 管理员密码加密机制 09 December 2011 11:34 Friday by 小屋 分享收藏

Magento的管理员密码的加密方式

$password    = 'admin';
echo getHash($password,2);

function getRandomString($len, $chars=null)
{
    if (is_null($chars)) {
        $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    }
    mt_srand(10000000*(double)microtime());
    for ($i = 0, $str = '', $lc = strlen($chars)-1; $i < $len; $i++) {
        $str .= $chars[mt_rand(0, $lc)];
    }
    return $str;
}
function getHash($password, $salt=false)
{
    if (is_integer($salt)) {
        $salt = getRandomString($salt);
    }
    return $salt===false ? md5($password) : md5($salt.$password).':'.$salt;
}


根据代码,magento加密 采用md5或者md5加上额外的定义位数的字符一起加密。

作者: Sjolzy

--EOF--

引用地址:

相关评论:

  1. yeah 2 月 09 日 对 “Magento 管理员密码加密机制” 发表最新评论。
    哈哈,找资料都能搜到你的博客,做的不错啊,早知道你这有加密方式,前几天就不用花时间找加密方式了。。。

    哈哈,找资料都能搜到你的博客,做的不错啊,早知道你这有加密方式,前几天就不用花时间找加密方式了。。。

      评分:5

  2. 2
    yeah :

    哈哈,找资料都能搜到你的博客,做的不错啊,早知道你这有加密方式,前几天就不用花时间找加密方式了。。。

    博主2012-02-11 22:33回复::D
  3. 1
    甲乙丙 :

    路过支持~

发表评论:

  给 “Magento 管理员密码加密机制” 评分

广告、无意义的评论必删!