Socialist millionaire protocol
en.wikipedia.org
en.wikipedia.org
Say that you and a friend are reading a Where's Waldo book, and you want to prove that you have found Waldo, but you don't want to tell your friend where Waldo is. This seems impossible. However, you could take a large piece of cardboard, cut out a Waldo-shaped hole, and place it over the book. Now you have proven that you can find Waldo.
"But wait!" cries your friend. "How do I know the book is even under there? Let me see." But you can't do that, since he knows roughly the spot Waldo would be if you lifted the cardboard.
So, you get a second piece of cardboard and put it on top of the first. Now, you play a game. You ask your friend whether you should lift one piece of cardboard (to verify the picture of Waldo) or two pieces (to verify that the book is beneath the second piece). You can play this game as many times as required for your partner to gain a reasonable confidence that you're not cheating.
And that's a zero knowledge proof.
This then means the subsequent trials don't reveal any side channels about Waldo's location in the book. (And of course in practice the "pieces of cardboard" are big enough to obscure all book information.)
Since you don't know if it's the book under there or not, you don't know if this example is a "control".
The proportion of times that it is the book has to be the same as the odds that you could randomly guess where Waldo is, I think.
The idea is that your counterparty cannot ever ask for both the book under there and to see Waldo, so they never know where the book is. You can spin the book around under the cardboard to put it in arbitrary locations, therefore just seeing the Waldo doesn't help.
1) It doesn't have to be THAT big. As long as the cardboard has twice the dimensions of the book, having the cutout be in the center ensures that you could reveal a Waldo anywhere on the page without letting the other person see any bit of the book to try to reason which section the book is under.
2) They only get to choose one piece of cardboard to remove per iteration of the game - they don't get to lift one piece and then immediately the other, they only lift one. That means that the person placing the cardboard can't cheat (because they don't know which piece they are going to lift, the one revealing the whole book or the one revealing the waldo), and the other person can't gain any information from the reveal. You can repeat the process many times (moving BOTH pieces of cardboard each time to ensure no gained information), but you can only do one cardboard lift per cycle.
This has always been my favorite "intuitive" explanation of zero-knowledge proofs, but I never even knew the second part about two cardboards, which makes this even better!
I've been reading alot about the cryptography (and alot of bitcoin stuff), there's alot of interesting material out there.
https://en.wikipedia.org/wiki/Probability_theory
https://simple.wikipedia.org/wiki/Probability_theory
https://en.wikipedia.org/wiki/Advanced_Encryption_Standard
https://simple.wikipedia.org/wiki/Advanced_Encryption_Standa...
The edit I made was to explain how Einstein made the leap to E=mc^2 by including the step that showed how E=mv^2 for particles of a given velocity. Of course this is well known to every engineer and physicist, but the article on the proof was so hard to follow without it.
In cryptography there are ways to make such a protocol "fair". Basically both learn "bit by bit" the answer, if Bob stops early, he only gets one bit of information more than Alice and if he can bruteforce the rest, so can Alice (except if Bob is the NSA).
Is it to protect against bruteforcing? What if the hash is made expensive to compute?
If fear of collisions is the reason you don't use a crypto hash function, then you are using a broken hash function.
A hash doesn't satisfy all the requirements of the problem, but it's not because of collisions.
If a hash function is cryptographically secure, it has the property where finding collisions is infeasable, which makes it suitable for evaluating equality.
This is why cryptographic hash functions are used as a proxy for passwords in order to avoid storing the plaintext.
"If a hash function is cryptographically secure, it has the property where finding collisions is infeasable, which makes it suitable for evaluating equality." This is so wrong.
It has a high probability of evaluating equality but in no way is it suitable. The primary benefit that cryptographic hash functions offer is that it is impractical to conduct a chosen plaintext attack.
"This is why cryptographic hash functions are used as a proxy for passwords in order to avoid storing the plaintext."
This is true, and is due to preimage resistance and the infeasibility of a chosen plaintext attack.
As optimiz3 already pointed out, a critical property of crypto hash functions is extreme difficulty in finding collisions, let alone meaningful ones. So if a hash function passes muster cryptographically, then we can use it to practically assert equality of inputs.
In other words, it's so improbable that we treat it as if it's impossible. When that assumption is not safe to make anymore, that's when we upgrade to a new hash function.
> Imagine if your '==' operator only worked 99 times out of a hundred.
Imagine if the probability of your '==' operator failing was 2^(-128). I would be fine with that. And that's the same "gamble" made by any protocol that relies on the collision resistance of SHA-256. You would have to try 1 quadrillion per second for 10 quadrillion years before having a 50% chance of hitting a collision.
Just because the chance of it happening is small, does not mean you will have to try 1 quadrillion per second for 10 quadrillion years before a collision occurs.
Granted collisions may not occur frequently, but a collision could occur at any time.
FYI, procedures like these would not pass the FAA code regulations for airlines.
> "Granted collisions may not occur frequently, but a collision could occur at any time."
Your reasoning sounds something like this: "The risk of a collision is greater than zero, therefore you should worry about collisions."
Which is like saying: "The risk of being hit by a meteorite is greater than zero, therefore you should worry about meteorites."
The problem with such reasoning is that it ignores probability.
> "Just because the chance of it happening is small, does not mean you will have to try 1 quadrillion per second for 10 quadrillion years before a collision occurs."
You're right! It means that you would have to try 1 quadrillion per second for 10 quadrillion years before having a 50% chance of hitting a collision.
If you don't like that 50% number, then let's use 10^(-15); a probability of 1 in 1 quadrillion. According to the birthday problem [0], and using the same collision resistance (2^128) and hash rate (1 quadrillion per second) from my previous example, you would have to work for 475 million years before having a 10^(-15) probability of hitting a collision.
Accidental collisions simply are not a realistic problem to worry about. I don't believe that any such collisions are known to have ever occurred in the wild with modern crypto hash functions.
Denying collision resistance renders hash functions almost useless, even for protocols where pre-image resistance is the key property. Think about that. Even if you were confident that a hash input wasn't crafted to conduct a pre-image attack, but you were concerned about collisions, then you should mistrust the hash result simply because it may have been an accidental collision.
I'm sorry you disagree with my reason for downvoting your initial comment. But I did so (or tried to) because (1) I feel it was not a correct answer to the question, and (2) it contained misinformation by implying that the likelihood of collisions is much greater than it actually is.
[0] https://en.wikipedia.org/wiki/Birthday_attack#Mathematics - Look at the table. My numbers were taken directly from the 256-bit row.
This fact applies to any hash function even those you don't consider broken.
The key new utility Enigma brings to the table is the ability to run computations on data, without having access to the raw data itself. For example, a group of people can provide access to their salary, and together compute the average wage of the group. Each participant learns their relative position in the group, but learns nothing about other members’ salaries. It should be made clear that this is only a motivating example. In practice, any program can be securely evaluated while maintaining the inputs a secret.
In cryptography there are ways to make such a protocol "fair". Basically both learn "bit by bit" the answer, if Bob stops early, he only gets one bit of information more than Alice and if he can bruteforce the rest, so can Alice (except if Bob is the NSA).
In the Millionaire problem both learn the result of the comparison
This sounds a bit like mental poker.
"Even if one of the parties is dishonest and deviates from the protocol, that person cannot learn anything more than if x = y."
For example you can use fully homomorphic encryption to trivially solve this problem.
It's much more significant that Logjam changes the field to something weak, than all of the servers use the same prime field.
Prove you have a working zero day, for example.
This is better put as: without allowing either party, in the event that the equality is false, to learn even so much as whether x < y or x > y.
Of course if the equality is true, each party knows everything about the other's value.