Search code examples
phpauthenticationmd5bcrypt

Changing salted MD5 passwords so they can be recognised by a Bcrypt


I am getting hashes and salts based on MD5 from a platform where users register.My platform is getting from a CSV file the data of the new users(name,surname,username,password) and i have created a script in PHP that adds them automatically in my database.However i have a problem with the passwords because the platform i am using uses Bcrypt passwords.I have no idea how i can change the salted MD5 hashed passwords to a Bcrypt password so that when the users that have registered to the other platform try to login in mine the authentication succeeds. Any thoughts?

Thank you in advance.


Solution

  • You can't really - unless you successfully "decode" source passwords (with ie rainbow tables) but that is in general naive approach.

    You rather need to add support for md5 paasword hashes to your system and then you can then rehash the password on first successful login to use bcrypt