1

When changing the password for a user on my Ubuntu system, I've noticed that no matter the length of the password that I choose the /etc/shadow file will always stay the same size and never increase/decrease.

How is this possible?

elliott94
  • 135

2 Answers2

3

Because it's saved as a hash and hashes of the same algorithm are the same length no matter what.

In Ubuntu I think the default algorithm for user passwords is sha512, which, as the name implies is always 512bit = 86byte long.

See:

pLumo
  • 26,947
2

The password is converted to a hash and that is a one way process.

So when you enter a password it will be converted to a hash and the hash will be compared with the hash in /etc/shadow and if it is a match you have entered the correct password.

Ref.: https://www.aychedee.com/2012/03/14/etc_shadow-password-hash-formats/

MatsK
  • 916