简体   繁体   English

盐腌到无盐密码md5 php

[英]salted to unsalted password md5 php

I'm moving to a other shopping cart and want to import the customers. 我要转移到另一个购物车,并希望导入客户。 However the new shopping cart uses a other password system. 但是,新的购物车使用其他密码系统。 I would like to convert the old passwords + salt to a single md5. 我想将旧密码+ salt转换为单个md5。

This is the code for the old shopping cart: 这是旧购物车的代码:

if (md5(md5($password) . md5($salt)) == $hash) {}

This is the code for the new shopping cart: 这是新购物车的代码:

password = SHA1(CONCAT(salt, SHA1(CONCAT(salt, SHA1('" . $this->db->escape($password) . "'

Is it possible to convert it into a single md5 string? 是否可以将其转换为单个md5字符串?

No. You would need the original value (the password) to recreate the hash using a different algorithm. 否。您需要使用原始值(密码)才能使用其他算法重新创建哈希。 Since you don't have the password and a hash is purposefully not reversible, you cannot get the "single MD5" value. 由于您没有密码,并且哈希是有意不可逆的,因此无法获得“单个MD5”值。

You'll have to adapt the code in your new system to work with the old hash values. 您必须调整新系统中的代码以使用旧的哈希值。
And you should use something better than MD5 while you're at it, it's entirely inadequate for secure password hashing. 而且,在使用时,您应该使用比MD5更好的东西,对于安全的密码散列来说,这是完全不够的。 password_hash is the PHP state-of-the-art. password_hash是PHP的最新技术。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM