6 ms·
This happens to include a nice two-paragraph summary of how password hashing works, that I think a non-technical person could easily understand. It's a shame th
by Wowfunhappy 8y ago
This happens to include a nice two-paragraph summary of how password hashing works, that I think a non-technical person could easily understand. It's a shame they used the term "string", but it reads fine in context. I should save for future use...
-----
> If you have a Google account, Google’s core sign-in system is designed not to know your password. How, then, can we verify your password when you sign in to your Google account again? The answer lies in a bit of cryptography: when you set your password, instead of remembering the exact characters of the password, we scramble it with a “hash function”, so it becomes something like “72i32hedgqw23328”, and that’s what we store with your username. Both are then also encrypted before being saved to disk. The next time you try to sign in, we again scramble your password the same way. If it matches the stored string then you must have typed the correct password, so your sign-in can proceed.
> The effectiveness of the hash function lies in its one-way nature: it is simple to scramble your password, but nearly impossible to unscramble it. So, if someone should obtain the scrambled password, they won’t be able to recover your real password. The downside of password hashing is that if you forget your password, we cannot show you what it was; there’s nothing we can do other than reset it to a temporary password (valid one time only) and then require you to pick a new one.
- kbirkeland 8y agoIMO they would have ideally used "key derivation function" instead of "hash function". It could lead those who know enough to be dangerous to think that safely storing passwords is a simple `sha512($password)` away.
- cdmckay 8y agoYou’re kidding, right? It’s supposed to be a simple explanation.
- hammock 8y agoDoesn't really explain that the "scrambling" is deterministic which is an important feature. In colloquial use "scramble" means to randomize, for example "scramble the code to your gym locker." When you scramble your locker combo, is really is random. When you scramble your password with a hash function, it may look random, but it's really not. Also just for fun, here's a creative stab at my own explanation. As every dog knows, each dog has a unique smell. If you have smelled the dog before, then you can use its smell to recognize who it is, but without that past experience, nothing in the smell itself tells you who it might be. The hash function creates the smell from your password, which is the dog. A website does't save a photo of your dog, just the smell. So if a hacker breaks in, they might smell your password but they can't see it. And when you login to the website, it makes sure your password smells right before it lets you in.
- travisjungroth 8y agoI can’t believe you think “scrambles the same way” is misleading and “smells right” isn’t.
- Wowfunhappy 8y ago> Also just for fun, here's a creative stab at my own explanation. I know you said "just for fun", but I really think we need to do better than these types of explanations. I remember many years ago, I was wondering what the heck hyper-threading was, and I came across a video that compared it to a bowl of cereal. Even though you only have one mouth, you'll be able to eat the cereal more quickly if you use both your hands, instead of just one. I watched this video, and felt gratified, and closed the browser window... and then suddenly realized that I still had no idea what hyper-threading was, only that I should use both my hands if I'm ever in a cereal-eating competition. A better explanation would have gone something like, "CPUs solve math problems more quickly than we can give them problems to solve. Hyper-threading queues up additional sets of problems that the CPU can switch to when it would otherwise be doing nothing." Analogies are useful tools, but usually only after we have some understanding of the real version.
- Fnoord 8y agoAnalogies are great to memorize the content. They don't explain the content because they're not 1:1 translatable.
- afiori 8y agoDoes that mean that analogies themselves are an analogy of hash functions? (not serious; hope it is not against the guidelines) More seriously analogies are better for a bigger picture of a complex system, as they effectively describe mode of interactions. The dog/smell analogy was not bad but you have to also add a role for the other actor in the system (here I would say: the third party, and the database)
- nkrisc 8y agoI fully understand password hashing and I still had trouble following your analogy. I think the key is using as little jargon as possible and explaining the actual concepts plainly. >"Hashing" a password is a method of scrambling it that will produce the same scramble every time you do so. However two different passwords will never produce the same scramble. Could be better, but emphasizes the deterministic nature of hashing but also avoids tangential details and gotchas like collisions which aren't relevant here.
- w8rbt 8y agoIt's nearly impossible to unscramble the hash if it is random. It's trivial to unscramble hashed dictionary words with 123! or 2019! appended to the end. Google should somehow note that distinction as it is important.
- Johnny555 8y agoTechnically, you're guessing the password, you're not unscrambling it (which, afaik is not just "nearly impossible", but it is impossible by design for modern hash functions). Being able to make millions (or hundreds of millions or even billions) of guesses each second makes successful guessing more feasible.
- sopooneo 8y agoThere's one thing I've never understood about this "guessing" technique to find the plain text of a known hash value. Wouldn't the sticker also need to know exactly what hashing function had been used as well as how many times applied (i.e. what the "stretching" factor was)? Because without that knowledge what would the attacker run their guesses through? And wouldn't that information be hard to get unless you had the full source code along with all relevant configuration?
- jzoch 8y agoYou can make a few simplifying guesses. 1. Google uses a lot of go so its likely they use bcrypt, so try that first. 2. Most people arent security experts so dont bother w/ stretching, just do one hash. Those 2 assumptions right there get you what you want 90% of the time.
- gatherhunterer 8y agoYou have to test the password against the real login feature, otherwise you wouldn’t know if you guessed it. The hashing function can be widely known and attackers using brute force guesses would still be blocked by a security feature that requires a second factor (e.g. email) after a certain number of failed attempts. As an attacker you're not trying to guess the hashed password and even if you had it you still would not be able to use it to log in. Hashing functions that are fit for real-world use are pure functions and their input cannot be determined by looking at their output, which renders rainbow tables (a list of plain text input and their corresponding hashed output) useless to attackers. So knowing the hash function is useless and even if you also manage to access the database and get the hashed password you still need to run through a brute force technique to find which input gets that output. If the original password is itself a long random set of characters stored with Keychain or Onepass you’re looking at potentially trillions of attempts before you get it right. Hashing functions are written to be slow and computationally expensive so you’re going to incur a lot of energy costs by the time you get it. Also, you’ll be dead by then. When brute force works it’s because the password has no failure restrictions and is something short and simple like a mother’s maiden name with a zip code at the end.