0

I need to migrate password from magento to opencart 2. I don't know exactly which version magento, I think it's v1.

In opencart, the class responsible for the encryption is: AccountCustomer, and is stored in this file: catalog/model/account/customer.php. The insert method:

class ModelAccountCustomer extends Model {
        public function addCustomer($data) {
 password =   $this->db->escape(sha1($salt . sha1($salt . sha1($data['password']))))

In opencart database the password is stored in this format (sha1 with salt):
password=8f4a5752c2f91635ca8a3d6315cca1118e90f9ec salt=Vln87Qkn3

In magento database the password_hash is stored with this syntax. I think the salt is after : In that case salt is: b0. The encryption algorithm maybe is md5, but I'm not sure.
password_hash = f1be538db8101e05def544c03357d958:b0

Any help is welcome!

Cassio Seffrin
  • 7,293
  • 1
  • 54
  • 54

2 Answers2

1

Here is the logic of Magento password encryption function:

$password = "12345678";
$salt = "at";
$encyPasswod = md5($salt.$pass).":".$salt;

In Magento core function, $salt is randomly generated string of two alphanumeric character.

Yuri Korolov
  • 500
  • 2
  • 6
1

Magento and Opencart both use MD5 + salt key to save passwords.

If Salt key is blank, then it is always an MD5 encrypted password.

You can write some script to do that or you can have a look at this URL.

http://litextension.com/customers-password-migration-plugins.html

Please let me know if you want any help.

Mohit Kumar Arora
  • 2,204
  • 2
  • 21
  • 29