0

How to calculate the password length if the user which already exists in Linux? I only know the encrypted password for that user in another file /etc/shadow. Can I calculate the password length from the value in this file?

Are there any other ways to solve this?

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
takethat
  • 1
  • 1

1 Answers1

5

The passwords are stored hashed, i.e. the actual passwords are never stored but a cryptographic checksum is stored in /etc/shadow. You can't compute the length of a string from a cryptographic hash of that string. Doing so would be equivalent of breaking/cracking the cryptographic hashing algorithm.

What you want to do is similar to finding the length of a file from its MD5 checksum. This can not be done.

Tangentially related:

Kusalananda
  • 320,670
  • 36
  • 633
  • 936