I have a database that contains md5 hashs, i want to convert them to another type of hash so that the users can login to the new website.
I am using the werkzeug.security library to generate the hashs.
I there is any way to do that ??
No. Hashes are not reversible, so you can't do that directly.
The way you solve this is that when an old user log in, you validate their password against the md5 hash, and if it matches, you create the SHA256 hash from the plain text password, sets the new SHA256 hash in the database (either as a separate field or by using a hash type identifier in front of the hash itself) and then remove the MD5 hash value.
After a while (for example a year), you remove all the existing MD5 hashes and make people that attempt to log in without a valid hash reset their password through existing means and then only populate the SHA256 field.
How to convert md5 32 bytes hash to corresponding sha256 in python