Answer the question
In order to leave comments, you need to log in
How to transfer users from Magento CMS with their passwords?
It is necessary to transfer the list of users from Magento to Bitrix. There is a CSV file with a list of users downloaded from the database. I would like to transfer users with old passwords. To do this, you need to get its hash from the string with the encrypted password and then save it in Bitrix.
The catch is that I don’t know by what principle Magento encodes passwords, where is the password hash itself in the string, and where are the additional characters (“salt”) that can be trimmed?
Bitrix encodes the password in md5 and then adds “salt” to the received string, maybe Magento has the same principle. Tell me by what principle in Magento the hash of passwords is formed for users.
Answer the question
In order to leave comments, you need to log in
If we are talking about Magento1, then the validation function is in Mage_Core_Model_Encryption:
/**
* 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 hash_equals($this->hash($password), $hash);
case 2:
return hash_equals($this->hash($hashArr[1] . $password), $hashArr[0]);
}
Mage::throwException('Invalid hash.');
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question