I had gone through with this link.

Suppose my current-encr is SHA-512, SHA-256, or another, the password hash would be stored (in /etc/shadow) of the user based on the current encr and would use below:

Available algorithms:

  • $1$: MD5
  • $2a$: Blowfish
  • $2y$: Blowfish, with correct handling of 8 bit characters
  • $5$: SHA-256
  • $6$: SHA-512

What will happen if user changes the current-encr? Will user be able to login using the old password created when older encr was getting used ? If no , how should I sync it up i.e. the same password hash gets updated with the password hash of the changed encryption ?


The new hashing algorithm will be used only when creating new hashes. The old hashes in /etc/shadow will be still supported. All users would have to change the password to apply the new algorithm to their hashed password.

Being able to rehash existing passwords would really beat the purpose.

  • The passwords shouldn't be stored at all, just the hashes, so making new hashes should be impossible. ps. Are there any "(semi) official" docs on passwords & hashes? – Xen2050 May 24 '16 at 14:56
  • There is a small sol. that I shud update the password hash's last-change date as 0 in /etc/shadow. This will force user to reset password on next login , this will generate the new password hash based on the changed encr. But the issue here is , If I do it , and force user to change the password at next login then User won't be able to put new password same as his old one. user has to choose password different from the old one. Is it possible somehow to allow user to have changed password same as the old one ? – Yash Khare May 25 '16 at 5:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.