aerius-labs / paillier-halo2

Paillier Encryption circuits in Halo2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pallier Encryption Chip for Halo2

This Rust library includes ready-to-use chip for performing Pallier Partial Homomorphic Encryption inside a Halo2 circuit.

Theory

Encryption

The Paillier encryption system encrypts a message m with a public key (n, g) to produce a ciphertext c, using the equation:

c = g^m . r^n mod n^2

where:

  • m is the plaintext message.
  • n is a large prime number, part of the public key, and ( n^2 ) is the ciphertext

space.

  • g is the generator in Z*n^2
  • r is a random number in Z*n

Addition

Given two ciphertexts c_1 and c_2, which are the encryption of plaintexts m_1 and m_2 under the same public key (n, g), the homomorphic addition is performed as follows:

c_sum = c_1 . c_2 mod n^2

Setup & Installation

  1. Clone the repository:
git clone https://github.com/aerius-labs/pallier-encryption-halo2.git
  1. Navigate to the project directory:
cd pallier-encryption-halo2
  1. Building the project:
cargo build --release

Running Tests

cargo run test

Contributing

We welcome contributions from the community!

License

This project is UNLICENSED.

About

Paillier Encryption circuits in Halo2


Languages

Language:Rust 100.0%