Live data from Hacker News

Programming Zero Knowledge Proofs: From Zero to Hero

zkintro.com

151–160 of 170 posts

Re: Programming Zero Knowledge Proofs: From Zero to Hero

#151
post #89

Earlier quoted context omitted.

> I've created a simple demo program to illustrate the concept of a human passport, inspired by World ID. It uses a zero-knowledge virtual machine (zkVM) to verify certain properties of a password without actually seeing the password itself. Why would I need it in practice?

I'm not sure what you're referring to specifically. If you're asking why we need zero-knowledge proofs (ZKP) in a human passport system: Imagine you have 6 billion to give away, and all lives worldwide should get their fair share. How could you do this? Giving money to authorities like governments and trusting them? In the context of 'alllivesmatter.world', I propose the DUKI system. Here's how it works: - Each perso…

> - Each person has a human passport (they should never have more than one)

I have 4 passports, all valid. With slightly different name spellings, from 3 different countries.

That kind of real-world complexity is always hand-waved by cryptopushers in the: "Imagine Goldman Sachs..." pitches.

Re: Programming Zero Knowledge Proofs: From Zero to Hero

#152

Earlier quoted context omitted.

The general takeaway is that you can prove you know something without revealing what it is, or how you know! If you can't think of the possibilities that unlocks beyond the examples others have already discussed(none of which were crypto related), that's a limitation on your end.

> The general takeaway is that you can prove you know something without revealing what it is, or how you know! And? Why is it better than good old PKI?

This is in complement to PKI - you still have to divulge what or how you know something with PKI in the examples given.

Re: Programming Zero Knowledge Proofs: From Zero to Hero

#153

Earlier quoted context omitted.

You think peoples licenses / passports are little computers with API's built into them that return arbitrary information on demand? Over the internet?

> You think peoples licenses / passports are little computers with API's built into them that return arbitrary information on demand? Literally yes, in some places. Passports have a chip in them, and licenses in some countries as well. > Over the internet? Tunneling private information over untrusted networks is literally how you're seeing this message.

Yea the chip gives the information written on the device. It doesn't answer arbitrary questions about the data.

The whole point of ZK proofs is the zero knowledge part. If you don't care about the person being able to see the information of course there's no need for them.

Re: Programming Zero Knowledge Proofs: From Zero to Hero

#154

Earlier quoted context omitted.

> you definitely do not need "ZKPs" to do this trivial task. You haven't provided an alternative way though? If you're looking for more complicated things they can do see: https://news.ycombinator.com/item?id=41430157 > Yeah you can, you log them in then link them to that userData with an identifier - typically an email address or unique user ID. You can easily write the login API to know nothing but hashes, or you c…

> Re: Validating passwords > You haven't provided an alternative way though? Check if it has numbers: \d Check if it has symbols: \W Check if it's 6-64 chars long: {6,64} > This doesn't make sense Promise you it's how it works. > Hashes are binary yes/no checks Nope, just means encrypted text. > every government in the world runs an API Hilarious you think a decentralized approach where every participant has a copy o…

- Do you not understand that client side checks are insecure?

- As you're still not getting it, how about this: This is a sha256 hash of my birthday, write a function that returns if I'm over 21: `1028d7ea22cbbcb17c4926b08b591506227d7b0e32ce6ce76122461e551a5ab2`

- Nothing I've mentioned needs an append only log, where are you even getting that from? A ZK proof is created from only the data stored on the passport chip.

Re: Programming Zero Knowledge Proofs: From Zero to Hero

#155

Earlier quoted context omitted.

> Re: Validating passwords > You haven't provided an alternative way though? Check if it has numbers: \d Check if it has symbols: \W Check if it's 6-64 chars long: {6,64} > This doesn't make sense Promise you it's how it works. > Hashes are binary yes/no checks Nope, just means encrypted text. > every government in the world runs an API Hilarious you think a decentralized approach where every participant has a copy o…

- Do you not understand that client side checks are insecure? - As you're still not getting it, how about this: This is a sha256 hash of my birthday, write a function that returns if I'm over 21: `1028d7ea22cbbcb17c4926b08b591506227d7b0e32ce6ce76122461e551a5ab2` - Nothing I've mentioned needs an append only log, where are you even getting that from? A ZK proof is created from only the data stored on the passport chip…

[flagged]

Re: Programming Zero Knowledge Proofs: From Zero to Hero

#156

Earlier quoted context omitted.

> You think peoples licenses / passports are little computers with API's built into them that return arbitrary information on demand? Literally yes, in some places. Passports have a chip in them, and licenses in some countries as well. > Over the internet? Tunneling private information over untrusted networks is literally how you're seeing this message.

Yea the chip gives the information written on the device. It doesn't answer arbitrary questions about the data. The whole point of ZK proofs is the zero knowledge part. If you don't care about the person being able to see the information of course there's no need for them.

First you described exactly the concept of password hashing, now you're describing something else entirely:

> It doesn't answer arbitrary questions about the data.

Why would you need a "ZKP" to prevent anyone from "asking arbitrary questions" you simply don't build that functionality.

When I create a web server and allow people to login through an endpoint, they can't ask arbitrary questions about user data either - how would that functionality even exist without me writing it? Typically the server doesn't even know passwords. It simply compares a hash - the hash is computed client-side and the server never sees the real password.

Any peripheral user data you want to return is up to you. Identity is not "built in" to conventional programming languages.

Furthermore, none of the ZKP libraries on npm do anything. Most of them are utility libraries with functions like "generateUUID" and "leftPad". The ones from providers like Cloudflare (their least popular stuff) are just private/public key encryption libraries that they call "ZKP".

Re: Programming Zero Knowledge Proofs: From Zero to Hero

#157

Earlier quoted context omitted.

> The general takeaway is that you can prove you know something without revealing what it is, or how you know! And? Why is it better than good old PKI?

This is in complement to PKI - you still have to divulge what or how you know something with PKI in the examples given.

And you still have to do that with ZKPs. Otherwise, I can just "borrow" my buddy's license and get into a pub. Unless the ZKP will interface with a biometric authentication system and do something like facial recognition.

And even then, it hand-waves away the issues with revoked licenses. How do you do license revocation with ZKPs?

Re: Programming Zero Knowledge Proofs: From Zero to Hero

#158

Earlier quoted context omitted.

- Do you not understand that client side checks are insecure? - As you're still not getting it, how about this: This is a sha256 hash of my birthday, write a function that returns if I'm over 21: `1028d7ea22cbbcb17c4926b08b591506227d7b0e32ce6ce76122461e551a5ab2` - Nothing I've mentioned needs an append only log, where are you even getting that from? A ZK proof is created from only the data stored on the passport chip…

[flagged]

To address edits:

> when to encrypt

It depends on what you want to do, if it's user login over HTTPS you can pass a plaintext password to the server and hash/compare on the server only. It would still be secure because the plaintext is never saved in a db (only the hash is), and was TLS encrypted in transport.

-----

> This is a sha256 hash of my birthday, write a function that returns if I'm over 21: `1028d7ea22cbbcb17c4926b08b591506227d7b0e32ce6ce76122461e551a5ab2`

You hash the point of access like a password or key, not the data itself. When the access is granted, you return the data. sha256 is never meant to be decrypted. It would be like this:

    interface User {
      id: sha256;
      name: string;
      age: number;
    }

    const users: User[] = fetchUsers();

    const isOver21 = plaintextId => users[encrypt(plaintextId)]?.age >= 21;
If your requirement is to actually to decrypt the sha256 you misunderstand the purpose of one-way encryption. That said - if you really wanted such a system, for such a finite list of dates (365 x 21 = 7665) you can easily maintain an array of the valid 7,665 sha256's on any given day. If it doesn't match a sha256 on file, that birthdate is not a person over 21.

    const validHashes: BirthdateHashSha256[] = seedHashesForToday();
    
    const isOver21 = hash => validHashes.includes(hash);

Re: Programming Zero Knowledge Proofs: From Zero to Hero

#159

Earlier quoted context omitted.

[flagged]

To address edits: > when to encrypt It depends on what you want to do, if it's user login over HTTPS you can pass a plaintext password to the server and hash/compare on the server only. It would still be secure because the plaintext is never saved in a db (only the hash is), and was TLS encrypted in transport. ----- > This is a sha256 hash of my birthday, write a function that returns if I'm over 21: `1028d7ea22cbbcb…

Lol, well yea if you throw away the zero knowledge part or trust the client to tell the truth of course you don't need zero knowledge proofs. Its not zero knowledge though (you just gave the server the info) and/or isn't proving anything.

This is the situation zero knowledge proofs are used in:

- The client doesn't trust the server and doesn't want to give it any info (that's the zero knowledge part)

- The server doesn't trust the client (that's the proof part)

If you break them of course the problem is much easier to solve.

If the client trusts the server they can give it a scan of their passport.

If the server trusts the client to run that code then you don't need a proof, you may as well just have a popup that says "are you over 21?"

A rainbow table is just breaking the hash and then you may as well not have it, in the real world the client would add a salt so this isn't possible.

Re: Programming Zero Knowledge Proofs: From Zero to Hero

#160

Earlier quoted context omitted.

Yea the chip gives the information written on the device. It doesn't answer arbitrary questions about the data. The whole point of ZK proofs is the zero knowledge part. If you don't care about the person being able to see the information of course there's no need for them.

First you described exactly the concept of password hashing, now you're describing something else entirely: > It doesn't answer arbitrary questions about the data. Why would you need a "ZKP" to prevent anyone from "asking arbitrary questions" you simply don't build that functionality. When I create a web server and allow people to login through an endpoint, they can't ask arbitrary questions about user data either -…

I didn't mention hashes anywhere in this thread, you were the one claiming you can prove someone's age just based on a hash of it (and still haven't shown how other than breaking the hash with a rainbow table).

I posted this earlier (and it's in the article...) but will reiterate again: ZK proofs are used when the prover (server) and verifier (client) don't trust each other and don't want to give each other data on each other. If you trust the server you can just give it a copy of your passport, if the server trusts the client they can just show a checkbox asking if they're old enough.

I linked to a working library earlier, it's here https://github.com/zk-passport/openpassport

Post reply on HN