How to use magento 1 customer password in magento 2

Published On: 22 August 2018.By .
  • Digital Engineering
  • Ecommerce
  • General

Magento 1 use MD5 hash to encrypt the password and Magento 2 use SHA-256.

In Magento 1, they use Mage_Core_Model_Encryption class with following functions.

Magento 1 generate hash by md5(salt + password) and save in database with 1 colon like $password-hash : $salt.

Magento 2 has changed logic and written in vendor/magento/framework/Encryption/Encryptor.php

Magento 2 generate hash like hash(‘sha256’, $salt . $password); and save with 2 colons in database like

$password-hash : $salt: $version

You have to override Encryptor class via di.xml with some private functions in your module.

 

Now Magento 1 user will able to login their old password. New customers password logic will remain same.

 

Related content

That’s all for this blog

Go to Top