Search code examples
phpsecurityhashmd5sha

Can a hashed password by MD5 be replaced by SHA-256 password?


I have to change a project password migration and I'd like to knwo if it's possible to change the hash method to a hashed password.

I'm thinking that is possible, but Idon't if I have to decrypt (which it isn't possible) or I can apply SHA-256 to a MD5 hashed password.

I'll appreciate any advice or help. Thanks!


Solution

  • Like RiggsFolly already mentioned in the comments you should use the password_hash() and the password_verify() function instead of some MD5 or SHA1 Implementations since sha1 and md5 are both no secure hashing functions for passwords, they should only be used for checksums.

    How to use bcrypt for hashing in php

    if the password_hash function is not in your php version or outdated then you can look for a secure implementation for this problem which is not a single man algorithm and exists for longer.