zoukankan      html  css  js  c++  java
  • 破解magento加密的密码算法

    magento遇到丢掉密码的情况,其实很常见……比如我这记性,还好我比较暴力:-P
     
       先看一段代码:
     
       
     
     
    /**
     * Hash a string
     *
     * @param string $data
     * @return string
     */
    public function hash($data)
    {
        return md5($data);
    }
     
    /**
     * Validate hash against hashing method (with or without salt)
     *
     * @param string $password
     * @param string $hash
     * @return bool
     * @throws Exception
     */
    public function validateHash($password, $hash)
    {
        $hashArr = explode(':', $hash);
        switch (count($hashArr)) {
            case 1:
                return $this->hash($password) === $hash;
            case 2:
                return $this->hash($hashArr[1] . $password) === $hashArr[0];
        }
        Mage::throwException('Invalid hash.');
    }
     
     
     
     
    看到这里,我们立马可以知道,原来magento的密码算法其实很简单;
      密码存储格式:  pass:hash  ,magento会拿  
     
      公式: pass= md5( hash + Password )
     
      于是得到最终 数据库字段值:   md5( hash + Password ) :  hash
     
      至此,暴力完成 :-P
  • 相关阅读:
    Neo4j-3.0.3 (Debian 8)
    python学习之argparse模块
    变异系数
    孪生素数
    统计学中的自由度
    兰伯特余弦定理(Lambert)
    椒盐噪声
    沥青路面磨损后泛白的原因
    朗伯体
    绕坐标轴旋转的矩阵
  • 原文地址:https://www.cnblogs.com/waw/p/11139982.html
Copyright © 2011-2022 走看看