You can check the file vendor/magento/framework/Encryption/Encryptor.php:72, which defines the supported password hash version.
private $hashVersionMap = [
self::HASH_VERSION_MD5 => 'md5',
self::HASH_VERSION_SHA256 => 'sha256'
];
You could update that file with a composer patch or git patch. Here is my patch, after applying the patch you could update the customer password (Directly to MySQL) by pattern
hash:salt:version:
Sample: hash = xxxxxxxxxx, salt: 123, version: 2
Result: xxxxxxxxxx:123:2
xxxxxxxxx: this is old hash value from your own ERP.
123: if the ERP has no salt, leave it empty xxxxxxxxxx::2
Now the Magento could validate the customer password using sha1 algorithm
Index: vendor/magento/framework/Encryption/Encryptor.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/vendor/magento/framework/Encryption/Encryptor.php b/vendor/magento/framework/Encryption/Encryptor.php
--- a/vendor/magento/framework/Encryption/Encryptor.php (date 1648559552172)
+++ b/vendor/magento/framework/Encryption/Encryptor.php (date 1648559552172)
@@ -23,7 +23,12 @@
* Key of sha256 algorithm
*/
const HASH_VERSION_SHA256 = 1;
-
+
+ /**
+ * Key of sha-1 algorithm
+ */
+ const HASH_VERSION_SHA1 = 2;
+
/**
* Key of latest used algorithm
*/
@@ -69,7 +74,8 @@
*/
private $hashVersionMap = [
self::HASH_VERSION_MD5 => 'md5',
- self::HASH_VERSION_SHA256 => 'sha256'
+ self::HASH_VERSION_SHA256 => 'sha256',
+ self::HASH_VERSION_SHA1 => 'sha1'
];
/**