我刚刚注意到magento企业版和社区版均使用不同的算法来存储密码。我知道社区版使用md5。谁能告诉我企业版使用哪种机制?如果要迁移到社区版,我们如何解密企业密码?
最佳答案
我认为它在您的Magento EE的app/etc/local.xml
或app/etc/enterprise.xml
上
Magento企业版上的解密功能
/**
* Decrypt a string
*
* @param string $data
* @return string
*/
public function decrypt($data)
{
return str_replace("\x0", '', trim($this->_getCrypt()->decrypt(base64_decode((string)$data))));
}
和
/**
* Instantiate crypt model
*
* @param string $key
* @return Varien_Crypt_Mcrypt
*/
protected function _getCrypt($key = null)
{
if (!$this->_crypt) {
if (null === $key) {
$key = (string)Mage::getConfig()->getNode('global/crypt/key');
}
$this->_crypt = Varien_Crypt::factory()->init($key);
}
return $this->_crypt;
}
在企业版或社区版上,似乎具有相同的功能。
您应该向gitt_strong询问该加密 key ,并使用CE对其进行解密。很好,因为我要潜入 Magento企业版的代码,并且该代码与社区版相同(用于加密/解密)
在评论1之后添加:
/**
* 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 - 如何解密magento企业版密码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13643618/