Take the 2-minute tour ×

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
add comment

3 Answers

up vote 3 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
add comment

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
add comment

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

share|improve this answer
add comment

Your Answer


