破解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
相關文章
相關標籤/搜索