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?

  • 2
    generally you cannot, since that is intentionally hidden – Thomas Dickey Jun 25 '19 at 8:38
  • complexity of password is defined in misceleanous files in /etc/pam.d – Archemar Jun 25 '19 at 8:47
  • Could you say about the specific point of thinking? – takethat Jun 25 '19 at 9:03

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:

  • Is there any other way to solve it? I mean in Other OS mechanisms – takethat Jun 26 '19 at 3:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.