1

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?

Olli
  • 768
  • 6
  • 16
XXL
  • 125
  • 1
  • 1
  • 8

3 Answers3

5

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.

gm3dmo
  • 9,632
  • 1
  • 40
  • 35
3

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
Cakemox
  • 24,141
  • 6
  • 41
  • 67
1

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

Olli
  • 768
  • 6
  • 16