How to Know if Password in /etc/shadow is Hashed with SHA or MD?

hashsumpasswordshadowUbuntu

I want to know my /etc/shadow password hash if its SHA or MD or something else. From what I read, it is related to the $ sign, but I don't have any dollar signs.

Im using Ubuntu 16

Example:

user:0.7QYSH8yshtus8d:18233:0:99999:7:::

Best Answer

The shadow(5) manual on Ubuntu refers to the crypt(3) manual. The crypt(3) manual says that the default password encryption algorithm is DES.

It goes on to say that the glibc2 library function also supports MD5 and at least SHA-256 and SHA-512, but that an entry in /etc/shadow for a password encrypted by one of these algorithms would look like $1$salt$encrypted (for MD5), $5$salt$encrypted (for SHA-256), or $6$salt$encrypted (for SHA-512), where each $ is a literal $ character, where salt is a salt of up to 16 characters, and where encrypted is the actual hash.

Since your encrypted password does not follow that pattern, I'm assuming that it's encrypted using the default DES algorithm.

Related Question