Giter VIP home page Giter VIP logo

noir-elgamal's Introduction

Homomorphic encryption in Noir

Prove that the ciphertext you're providing is the addition of 2 (or more) plaintexts

ElGamal

The ElGamal system is a public-key cryptosystem. One of its remarkable features is that it allows for either homomorphic addition or multiplication, which means that manipulation on the ciphertext can correspond directly to manipulation on the plaintext.

Example: multiplying ciphertext gives the same result as encrypting the added plaintexts:

Enc(m1,r1) * Enc(m2,r2) EQUALS Enc(m1+m2, r1+r2)

Noir

This implementation is built on Noir 0.10.0.

Find great resources, in addition to the official documentation, here.

Noir has an intrinsic Field element, which is of bn254. This means all field operations are performed mod

Usecases of homomorphic operations in ZKP

This simple example of using homomorphic encryption within ZKP can be used in different scenarios, for example:

  • secure computing outsourcing: the third party can add a proof that data has been added correctly
  • when casting votes, add this as an additional proof that you have casted the correct amount of votes
  • for transactions, prove that you have the funds to make the transaction by adding 2 or more UTXOs without revealing which ones they are and what addresses are involved
  • in gaming: prove posession of certain in-game assets without revealing any further details/history

This repo

Consists of

  • a library with ElGamal (field) functionalities
  • examples of circuits that use the ElGamal functionalities

Most, notably the hom_addition circuit, which generates a proof that a ciphertext is the encryption of 2 messages added together.

Open issues

  • for the homomorphic operation, it fails when m1,m2,r1,r2 combined are too large. Could this be caused by the pow_32 function?
  • testing the hom_addition circuit passes with the in-file test, but using the same values in Prover.toml gives the error Error: could not satisfy all constraints.

noir-elgamal's People

Contributors

ewynx avatar

Stargazers

Suning Yao avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.