28

As far as I know, when passwords from a website leak, they leak in an encrypted form. Are all those passwords equally easy to decrypt? My hunch is that a 10-character-long password maybe gets decrypted in a few minutes, but if a password is 100-characters-long, it takes days or years to decrypt. Does it make sense?

Is setting a very long or difficult password a real protection from leaks? I'm asking even about passwords like passpasspasspass11111passpasspasspasspass compared to pass11111.

11
  • 13
    If the passwords are encrypted then you only need to brute-force the encryption key and then every password will be revealed. If they are hashed then you can build a rainbow table of known hash-to-password translations and just have to match the hashes to know the password. If your rainbow table does not contain a specific hash then you have to wait until your rainbow table grows. If the passwords are hashed and salted then the attacker probably won't waste their time. If it's plaintext then no obstacles should be encountered.
    – MonkeyZeus
    Dec 14 '20 at 14:11
  • 5
    Not really an answer but since I don't see anyone addressing it: "passpasspasspass11111passpasspasspasspass" may be long but it's still a pretty bad password because of the repetition. A password half as long but actually random would be much safer. Dec 14 '20 at 15:14
  • 12
    @MichaelBorgwardt passpasspass...'s weakness depends on the bruteforcing algorithm ... Unless the hacker has a reason to limit themselves to just a character set of "aps1" it's reasonable to assume they'd be searching a-zA-Z0-9 in which case the extra length IS helpful.
    – aslum
    Dec 14 '20 at 15:37
  • 2
    @wizzwizz4 For sure. If they're bruteforcing though, length is king. The real issue is if one of your other passwords is leaked in plaintext and you use a similar scheme. If they know you always use some quantity of "pass" plus some numbers it becomes trivial to bruteforce.
    – aslum
    Dec 14 '20 at 16:15
  • 6
    To Aslum and WizzWizz, in a way you're both right. Length does add significantly to the security of a password, even bad ones like that one with all the "pass." However, it's common for brute force algorithms to start with known patterns, such as "try all password combinations that are made up of letters from the set [pasword] and numbers" because that will crack a ton of lazy passwords, then they go on to more complicated ones. Still though, it should buy you some time to hear about the breach and change yours if yours is 41 characters because the hacker may likely go after short ones first.
    – Davy M
    Dec 14 '20 at 17:24
52

As others have mentioned, "most sites" hash the passwords, they do not encrypt them. But a site can choose to do whatever they want. Some sites have encrypted passwords and some have stored the password as plaintext. Obviously, if they are stored as plaintext, then there is no difference in how long your password is.

But let's assume that the site did what they are supposed to do and hashed the password with a salt. The length of the password does make a difference to the ability to brute force a guess of what the hash might be, but that assumes that the password is random.

A hash of a 100-characters-long password that is well-known will be cracked very quickly. And that's a factor that a lot of people forget to account for. Length makes it more difficult to guess if you are having to guess each character at a time. But if you are using a dictionary of well-known passwords, then length is no longer a protection if your password is in that dictionary.

So, your question is a good one. Not all passwords can be cracked as easily as others, and length can be a factor in how difficult it is to crack, but the overall factor to consider is how guessable the password is. Length can make it harder to guess, but not by itself.

12
  • 16
    +1. correcthorsebatterystaple & ji32k7au4a83 are good examples of passwords that seem long but aren't strong in practice, because they are commonly known. Dec 13 '20 at 18:28
  • 6
    @Nelson we have several answers here that explain all that.
    – schroeder
    Dec 14 '20 at 9:29
  • 8
    @musialmi They are linked and can be clicked on, and the articles clearly explain that.
    – Nelson
    Dec 14 '20 at 14:41
  • 2
    @musialmi ji32k... should be an excellent password, since going through all letters and numbers - perhaps with increasingly longer password-length - it will take a long time until you reach that password. However since the password at some time has been published, it's likely that it's already been hashed and placed in lists of other pre-hashed passwords (eg. from dictionaries). Since at least some readers are likely to copy and use such a "great password" from a book, it's worth the effort to crack... like any other published example password . Dec 15 '20 at 6:57
  • 4
    @musialmi &tldr; Basically, it translates to "mypassword" in Mandarin. Dec 15 '20 at 21:01
11

As far as I know, when passwords from a website leak, they leak in an encrypted form.

First of all, in general, passwords are not encrypted, they are hashed with good password hashing algorithms (like PBKDF2, SCrypt, Argon2) using a random salt per password. The password hashing algorithms are candidates for one-way functions, so there are no inverses of them as the encryption algorithms in which the decryption is the inverse of the encryption with the help of the key. The usual attack on those password hashing algorithms is searching for some space and testing for a known password set; John the Ripper and Hashcat are some of the tools that one can use.

Some sites like Facebook stored the password in a clean format. When hacked, the hackers get all easily. If the passwords are well protected then the attacker needs to apply the search.

Are all those passwords the same easy to decrypt? My hunch is that a 10-characters-long password maybe gets decrypted in a few minutes, but if a password is 100-characters-long, it takes days or years to decrypt. Does it make sense?

Here, assuming that we are brute-forcing the hash of the password, in that case, the 10 characters ( including the case sensitive and alphanumeric ) have 5.954 entropy per character. This makes 59.54 entropy and this can be achievable with supercomputers or with the collective power of bitcoin miners. Approximately, they can reach

267.9 in a second, 284 in a hour, 284.3, in a day, and 292.8 in a year. This can give us some insight into possible agencies that may have the same or more power.

One must keep in mind that, running SHA256d as the miners do is not the same as running for PBKDF2, SCrypt, and Argon2 those are memory-hard password hashing algorithms. The memory-hardness prevents massive parallelization on GPU, ASIC, and FPGAs. Since the nodes of mining are not exact, estimation is not easy, however, if we look at Summit's Titan SUper computer that uses Tesla V100 27,648, and Titan can calculate around 247 PBKDF2-HMAC-SHA256 hashes per year. That is a drop from 274, according to hashcat results.

100 characters make sense and not. Setting it to 100 makes 594.4 entropy that is far from the need. Less than 256 should be enough for all. The problem, however, humans cannot memorize that kind of stuff so researchers developed dicewire and Bip39 kind of password systems so that they can have good entropy and easy to memorize. A must-see is XKCD/936.

Is setting a very long or difficult password real protection from leaks? I'm asking even about passwords like passpasspasspass11111passpasspasspasspass with comparison to pass11111.

Once you have a password that has good entropy and has different for each site/application then you should be safe. The usual way is using a password manager to manage all passwords like the key-pass and use a password with a good entropy to keep the passwords safe.

There is competition on password set that actually search that kind of pattern, too. Forget about them and use dicewire kind of passwords that you can measure the strength of your passwords very easily.

9
  • Could you elaborate on "the collective power of bitcoin miners"? Dec 13 '20 at 18:00
  • @RoyceWilliams Hope, I did as you wanted. Actually, the link contained information about the search space that can reach.
    – kelalaka
    Dec 13 '20 at 18:07
  • I'm familiar with the general specialized/dedicated hashing capability of cryptocurrency platforms. What I'm trying to determine is how that relates to password cracking, given that Bitcoin is almost exclusively mined on ASIC these days, and those ASICs cannot be repurposed for general password cracking. Dec 14 '20 at 0:36
  • @RoyceWilliams Made clarifications and gave estimation for Titan for PBKDF2-HMAC-SHA256 and comparison from SHA2d, thanks.
    – kelalaka
    Dec 14 '20 at 9:33
  • 1
    @kelalaka Thanks. Dec 17 '20 at 10:33
4

“ Is setting a very long or difficult password a real protection from leaks?”

Password complexity (length, character use, lack of pattern) is meant to protect from brute force attacks, not from “leaks.”

If someone were to use a 256 character password hashed with MD5, there is a chance that it would fall to a brute force attack (repeated guessing) because of a collision (two or more values that create the same result). Potentially, your 256 characters would have a match to a guess that is only 8 characters long.

When those 8 characters were used to log in to the account, they would generate the same hash as your password of 256 characters, and so the system would think the login is valid.

If you used your same 256 character password at a website that used SHA1 for hashing, the 8 character password that was brute forced (above) would NOT work, because the 8 characters would NOT generate the same hash using a different algorithm (cause the collision being exploited).

Rainbow tables (lists of hashes with their decrypted hashes) used to be a concern. This is mitigated by systems using a local variable referred to as a salt. This makes it so that you can not use a rainbow table without knowing the additional local variable (salt).

Passwords should be complex (pass phrase). Passwords should be memorable. Passwords should not be reused. You should be able to recover passwords. You should not be able to do it with a five or six character answer to a preselected question. Why? Because it’s easier to guess the answer (brute force) to a question, than a password of proper length/complexity.

Most important though, any system you are using should require multi-factor authentication.

2

Is setting a very long or difficult password a real protection from leaks?

No. If passwords are kept hashed, then for authentication only hash of a provided password is used. Many passwords can produce the same hash. E.g. even 10-12 character password can give the same hash as 100-character password. That's why longer password does not necessary mean that brute-forcing.

To protect passwords from brute-forcing use resource expensive hashing algorithms like Argon2, Lyra2, scrypt and similar. If parameters are properly chosen, each password candidate will require relatively much CPU and RAM. Brute-forcing can be very expensive and can take much time.

Nevertheless, using these algorithms for hashing does not mean it is safe to use any simple passwords.

Example: Suppose you configured parameters so that a single hash takes 1 s and needs 1 GB RAM on an average PC. If you use 3-character password consisting of characters from a let say 64-character set, then the total number of passwords to test is 64^3 = 262144. If an attacker has a 8-core CPU of similar core power, then it will take 262144 / 8 = 32768 seconds = 9 hours. Thus, 3-character password would be easy to break.

What is the reasonable minimal length? To answer this question consider the risks. How much are your secrets worth? How much money needs to be paid to brute-force passwords of particular length with particular CPU and memory parameters? Then you will see that may be for your particular case even 8-character passwords can be sufficient.

18
  • 7
    "Many passwords can produce the same hash. E.g. even 10-12 character password can give the same hash as 100-character password." While such hash collisions are technically possible, the odds are astronomical assuming a decent hash algorithm. Dec 13 '20 at 17:56
  • 2
    I didn't say that. I said hash collisions are astronomically unlikely, contrary to your statement that "Many passwords can produce the same hash" , implying that it's a common event. Dec 14 '20 at 4:42
  • 3
    @user10216038: OK, so I misunderstood your comment. Correct, the probability is low. Despite this, making password longer does not reduce it any more. And this was actually the question in the OP. Then I don't understand why you wrote it here, not as a separate answer, because you are actually answering the OP :)
    – mentallurg
    Dec 14 '20 at 6:12
  • 2
    @Steve: 1) There is no analogy at all. There is no connection between password length I given in the answer and modulo 100 in the comment. The only goal is to show, that increasing the range does not change the probability of collisions. Your 128 bit is not relevant, neither OP nor my answer talk about 128 bit.
    – mentallurg
    Dec 14 '20 at 22:16
  • 2
    2) Finding a 10-12 character password that gives the same hash as a 100-character has exactly the same complexity as "Finding a 10-12 character password that gives the same hash as another 10-12 character password".
    – mentallurg
    Dec 14 '20 at 22:16

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.