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

usr1:$1$zgKwt6aQ$gXxsMLgcxa/u6rmq5QseP.:14307:0:99999:7:::
usr2:$6$9Bh5mQ5t$VY64eVcILqgXIC1EFPJ.f3tDVrsSf4y1Th6dleFN2FcuUJQUGevVXILySNfQlDNVWBQXCHaja1hyms.mVeDOY/:14839:0:99999:7:::

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

link|improve this question

50% accept rate
feedback

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:

http://www.akkadia.org/drepper/SHA-crypt.txt

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

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

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
link|improve this answer
feedback

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

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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