Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Doesn'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.



> 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.


Analogies are great to memorize the content. They don't explain the content because they're not 1:1 translatable.


Does 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)


It says that it scrambles it "the same way" when it checks it. Isn't that clear enough?

The scrambling is modulated by a random nonce which is stored together with the hash. So you are scrambling the original randomly; you then scramble the password-to-be-checked the same "way" (ie. with the same nonce) to compare hashes.


I can’t believe you think “scrambles the same way” is misleading and “smells right” isn’t.


It’s sort of implied when they explained they do the same hashing and ensure the hashes match though.


I 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.


I don't think explaining determinism is necessary or even helpful here. I showed the post to my girlfriend and it made perfect sense to her. Explaining that sometimes doing the same thing in the same way results on different results unless you're careful only muddies the message.

The explanation is clear that they scramble the password in the same way to get the same result.


The other thing they could address is that more than one password can map to the same hash. But it would not improve the explanation.


There’s no need to confuse things with metaphors as anyone with elementary understanding of maths should be able to understand it:

A cryptographic hash function is an algorithm that:

Given an input, it returns a very large number.

Given a bit-for-bit identical input it returns exactly the same number.

If the input changes by one bit, it _should_ give an extremely different number, so different that it appears to be random.

The probability of two different inputs producing the same output is extremely low, and the better the hash function, the lower this probability is.


Funny thing, human scrambling is not actually random (it's a shuffle not a randomization) and neither is a coin toss. When asked to produce a random password, people gravitate towards nonrepetition and that dependent on medium they use to type the password in. This results in a highly skewed blue noise statistics.

People aren't random even when they try to be.


Wait, a coin toss isn’t random?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: