4 ms·
one way to solve the problem of memorizing (long passwords) is to use something like this: to avoid forgetting it use a string of words that make sense to your
by DyslexicAtheist 7y ago
one way to solve the problem of memorizing (long passwords) is to use something like this:
to avoid forgetting it use a string of words that make sense to your brain[1] but are unlikely to be encountered in the wild (in any texts).
Example passphrase: "My hamster kicks soapy homework with smurf locks like a tandem at 45 o clock!"
Then use this to generate a hash which can never be remembered in itself, and is unlikely to be brute-forced:
$ echo -n "My hamster kicks soapy homework with smurf locks like a tandem at 45 o clock!" | sha512sum
7364796a1ad957d7c524165aa2fec2501eaa59e6bd8380bad3252504cdb8592018e30ae2fff1b2c2295e6da7a7f47f52ef1c0e3010c054598d76fe0c6d64bac6 -
this way there is no need to remember the hash itself as long as you know how to recreate the hash (+ have the tooling present like sha512sum).
In case you want to change the hash without having to remember a new passphrase just twiddle with the input string (by changing one character only) to get a totally new hash.
If you're on a multi-tenant machine this is probably dangerous since running `ps` might show other users on the system the input string when you run the command. Not an issue with single user systems. In case you want to avoid the command being recorded in your shell history file you can prefix the whole command with a blank (space).
Benefit of this is you get a pretty long hash that is impossible to brute-force and extremely hard to remember, which makes it really useful as a master-password.
- Thorrez 7y agoOne weakness of this is that sha512sum is a fast hash, ideally it would use a slow and memory hard-hash. Of course if your password is strong enough it doesn't matter. An example attack would be an attacker compromises the password database of a site you use, and that site doesn't hash passwords. Next the attacker cracks that hash, which requires your password to be somewhat weak, but is aided by you not using a slow hash. Next the attacker uses that cracked master password variation to crack your LUKS setup. While LUKS uses a slow memory-hard hash, the attacker doesn't need to do many attempts, because the password is a small variation of the password the attacker already knows.
- zaarn 7y agoThat would matter less if you use the hash as a password as the comment suggests; in that case it matters what the website below in the stack uses.
- Thorrez 7y agoI think you misunderstand. I was talking about the case when you use the hash as the password as the comment suggests. >in that case it matters what the website below in the stack uses. I'm not sure exactly what this means. Are you saying you should put your security in the hands of website operators? I don't think you can rely on them. According to HIBP, I've been compromised by 25 breached sites and 28 pastes. I try to design my password scheme such that no matter how bad a site's security is, it has no impact on the security of anything besides that site. DyslexicAtheist's scheme doesn't have that property.
- monort 7y agoYou are susceptible to a length extension attack if you use sha-512 this way. You should hash twice or use sha-3 https://en.wikipedia.org/wiki/Length_extension_attack https://en.wikipedia.org/wiki/Length_extension_attack
- 4gotunameagain 7y agoI do not see how a length extension attack is relevant here, care to elaborate?
- bscphil 7y agoI think you misunderstood what they are using the hash for - neither the hash nor the plaintext should ever be revealed to a third party anyway. That said, I don't really see the point since it's no more secure than just using the long passphrase directly.
- DyslexicAtheist 7y ago> don't really see the point since it's no more secure than just using the long passphrase directly. a 5 word passphrase isn't automatically more secure than a 5 char password if the words are predictable. interesing paper goes into this[1]. brains are generally bad in coming up with good passphrases (not enough entropy :)). while my example is certainly very hard to predict I want to rule out an attacker predicting what makes the (nonsensical) passphrase. https://eprint.iacr.org/2016/246.pdf https://eprint.iacr.org/2016/246.pdf Edit: there is also a video to the above paper: https://www.youtube.com/watch?v=6-vrumB0UUw https://www.youtube.com/watch?v=6-vrumB0UUw
- bscphil 7y agoRight, but usually designs for password systems assume that the whole system is transparent to the attacker, in which case hashing it before use doesn't buy you anything. If your input phrase is low entropy then a hacker can compute sha512sum(low entropy phrase) just as easily as you can. So to get anything out of doing this is basically just assuming that your attacker won't know (or guess) that you're doing this. Maybe it doesn't hurt, but I wouldn't trust it with a low entropy passphrase. I suppose one use for it would be getting more entropy on sites with low password length requirements, like 10-15 characters max. Another possible problem is if your computer gets stolen and the `echo xxx | sha512sum` command is in your .bash_history file. To me this seems to add a lot of additional risk.
- loeg 7y agoThis is a worse password stretching / sizing function than PBKDF2. Just use that as your password directly rather than whitening it with SHA-2. On the other hand, if you are in a position to be using full-width keys, just use /dev/urandom to generate them instead of a password.