Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Here is the output of /etc/shadow for two different users stored on the system:


Question being, why do these passwd hashes (both working) have different length?

share|improve this question
up vote 4 down vote accepted

usr1 is using a md5 hash indicated by $1 and usr2 using sha512 hash indicated by $6.

Use authconfig --test | grep hashing to see what method is in force now.

The reason why is probably that the usr2 user got added after an OS upgrade where the default algorithm changed from MD5 to SHA512.

See this link for a bit of background:

See cakemox's answer below for all the possible values.

share|improve this answer
If not on a Redhat based distro, how to see the method? – fossilet Mar 30 '11 at 15:34

They are hashes made using a different algorithm for each user. The $1$ and the $6$ prefixes tell you which hash is being used:

  • $1$ - md5
  • $2$ - bcrypt
  • $2a$ - eksblowfish
  • $5$ - sha-256
  • $6$ - sha-512
share|improve this answer

There is magic string in the beginning of hash, defining hash format: $number$.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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