Understanding UNIX Password Hash in /etc/shadow file | Linux
The password hashes in the /etc/shadow
file is usually divided into 3 groups seperated by the symbol $
.
The first section, i.e. after the first $
symbol represents the hashing algorithm used.
The meanings of the different values in this field are:
$1 = MD5
$2 = Blowfish
$2a= eksblowfish
$5 = SHA-256
$6 = SHA-512
The next field, that contains a randomly generated or user defined string that works as the SALT to improve the password security.
For example, $thisisthesalt1234$
could be the SALT as well.
Now, the final section after the last $
sign is the encrypted password.
Example Password Hash:
$1$SFsdflQD$179ad45c6ce2cb97cf1029e212046e81
The given password hash is encrypted with MD5 and the SALT that was randomly generated was: SFsdflQD
And, 179ad45c6ce2cb97cf1029e212046e81
is the actual encrypted password.