Live data from Hacker News

Confess your love with zero-knowledge

zkcrush.xyz

91–100 of 205 posts

Re: Confess your love with zero-knowledge

#91

https://github.com/amirgamil/zk-crush/blob/main/pages/crush.... const isMatch = React.useMemo(() => hash === crushHash, [crushHash]); Sure is a lot of work to do a string comparison 'efficiently'.

Definitely a waste. `useMemo` has a bunch of performance issues related to it and should only be used when absolutely necessary.

Re: Confess your love with zero-knowledge

#95
post #5

I sent it to my wife but she spelled her own name wrong and now she thinks I have a crush on someone else

OP should probably trim whitespace too. I sent it to my wife and it's not a match either, because there was a trailing space left by her keyboard.

Don't forget normalizing unicode. You don't want to see Jorgé fighting with Jorgé.

Re: Confess your love with zero-knowledge

#96
post #86

Last year my wife and I suspected we might have gotten each other the same Christmas gift, but didn’t want to spoil the surprise in case we didn’t. So we compared SHA256 hashes... and sure enough they both came out cb17007d (theragun)

This explained zero knowledge so much easier than that parable about the caves, thank you.

But it isn't zero-knowledge. If it was zero-knowledge, you would be able to know what you had the same gift/crush, but it would be impossible to prove to someone else.

Mere hashing doesn't do that. For the crush example (This site), your crush could show everyone the link and their name. For that matter, someone could enter the names of everyone you knew in turn, until you were outed.

Re: Confess your love with zero-knowledge

#97
post #86

Last year my wife and I suspected we might have gotten each other the same Christmas gift, but didn’t want to spoil the surprise in case we didn’t. So we compared SHA256 hashes... and sure enough they both came out cb17007d (theragun)

Doesn't work, because you can reasonably brute-force possible gifts.

You could reveal the hash letter-by-letter and stop as soon as a letter differs so there's more possibilities.

Re: Confess your love with zero-knowledge

#99

Earlier quoted context omitted.

SHA256 doesn't work like that. Even single bit differences between inputs should result in very different outputs.

It doesn't. But there are so-called locality sensitive hashes. https://www.pinecone.io/learn/locality-sensitive-hashing/

Sure, such hashes exist. SHA256 is not one of them.

Re: Confess your love with zero-knowledge

#100
Jacques Patarin[1], my cryptography teacher at university introduced us with zero-knowledge proofs with a simple real-life zero knowledge scheme for this exact purpose. All you need is 5 cards, 3 identical red and 2 identical blacks.

You give one black and one red to each person (Alice and Bob), and keep the last red.

The scheme is the following:

Alice will puts her two cards ON TOP of the remaining red card: to say yes, she puts her black card on top of her red card, to say no she does the opposite (red on top of black).

Bob will put his pair of cards BELOW the remaining red card, and to say yes he puts his black card at the bottom, with his red card in between, and to say no he does the opposite.

Then you cut the deck enough times to obfuscate who've done what, and you know that they've both day yes if you have the two blacks cards next to each other (or both at each ends of the deck). If anyone (or both of them) said no, you'd have black cards separated by one red card.

[1] https://fr.wikipedia.org/wiki/Jacques_Patarin

Post reply on HN