简体   繁体   中英

How can I rehash my stored passwords which is stored in Database using md5?

I have passwords stored in md5 hash. I want to rehash it using another hashing methods. How can I rehash it ?

I have tried to save the new hashed passwords in new field with new hashing methond eg SHA1

The usual approach is to check if user has new hash during the log-in. If she has — use it. If she doesn't — check via old hash and if there is a match then populate new field.

Also, please DO NOT USE md5 or sha1 or even sha256 for hashing passwords . Use password_hash() which is designed specifically for this use-case and provides way better security for your users.

This function is available starting with PHP 5.5, but there is a user-space implementation which works with older PHP versions

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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