Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

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.

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

 
discard

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.