How to determine encryption algorithm used to store password

Debian supports DES, MD5, SHA256 and SHA512 algorithms for password encryption. These algorithms can be easily spotted and distinguished by their structure.

DES algorithm. It uses only the first 8 characters of the password.

Entry:
  A3e/KEgDkMLCQ
Salt prefix:
  none
Salt used to encrypt password (2 characters):
  A3
Encrypted password (12 characters):
  3e/KEgDkMLCQ

MD5 algorithm.

Entry:
  $1$Kwr7U3ff$ks/WzM/cddWJO8IJuuSEs0
Salt prefix:
  $1$
Salt used to encrypt password (8 characters):
  Kwr7U3ff
Encrypted password (22 characters):
  ks/WzM/cddWJO8IJuuSEs0

SHA256 algorithm.

Entry:
  $5$oSqc8rH41i$jQwD40uzBYkVuf/NA4jymVtfyfHo0jm1Efk8EGR8dR6
Salt prefix:
  $5$
Salt used to encrypt password (between 8 to 16 characters):
  oSqc8rH41i 
Encrypted password (43 characters):
  jQwD40uzBYkVuf/NA4jymVtfyfHo0jm1Efk8EGR8dR6

SHA512 algorithm.

Entry:
  $6$jNs8hixHeeiW$u7EShHdO0vQtJMESEzMZBh8ICXYufTAU8WRgM8.nWCFKQPj0aCTMA2KkAke1ltwRkjtb8cTTjAlN4RKouQ8xj1
Salt prefix:
  $6$ 
Salt used to encrypt password (between 8 to 16 characters):
  jNs8hixHeeiW
Encrypted password (86 characters):
  u7EShHdO0vQtJMESEzMZBh8ICXYufTAU8WRgM8.nWCFKQPj0aCTMA2KkAke1ltwRkjtb8cTTjAlN4RKouQ8xj1

I have used determine word as the password in the above examples.

Milosz Galazka's Picture

About Milosz Galazka

Milosz is a Linux Foundation Certified Engineer working for a successful Polish company as a system administrator and a long time supporter of Free Software Foundation and Debian operating system. He is also open for new opportunities and challenges.

Gdansk, Poland https://sleeplessbeastie.eu