Skip to content

Latest commit

 

History

History
47 lines (34 loc) · 2.86 KB

README.md

File metadata and controls

47 lines (34 loc) · 2.86 KB

Zero-knowledge Library for hash functions

This repository constains the implementation of two Zero-Knowledge Proof (ZK) libraries for ZK-Friendly Hash Functions named zk-lib and zk-dusk, developed as part of the bachelor thesis. The libraries provides plain and zero-knowledge circuit implementation for various hash functions in the Polygon's Plonky2 and Dusk Plonk's Plonk proof systems for generating zero-knowledge proofs, in the Rust programming language.

Hash functions: MiMC, Poseidon, Rescue-prime, Griffin, Anemoi and Arion.

Requirements

To use this library, ensure you satisfy one of the following prerequisites:

  • Rust compiler with recent nightly toolchain. You can set up with the following command:
rustup override set nightly-YYYY-MM-DD

Make sure to replace YYYY-MM-DD with the appropriate date for your setup.

  • Copy the rust-toolchain file in your project directory. It can be changed to a more recent nightly version.

Code Structure

  • mimc-python:
    • Implementation of the MiMC hash function Python, primarily used for testing purposes.
  • zk-lib:
    • Library containing implementation of the MiMC, Poseidon, Rescue-Prime, Griffin, Anemoi and Arion hash functions, as well as the zero-knowledge circuit for each one using Plonky2 as the proof system.
    • Benchmarking of the hashes and the zero-knowledge circuit for each hash function.
  • zk-dusk
    • Library containing implementation of the MiMC, Poseidon, Rescue-Prime, Griffin, Anemoi and Arion hash functions, as well as the zero-knowledge circuit for each one using PLONK as the proof system.
    • Benchmarking of the hashes and the zero-knowledge circuit for each hash function.

Benchmarks

Measurements were conducted on a system configured with a 1.4 GHz Quad-Core Intel Core i5 processor, 8 GB LPDDR3 RAM with a transfer rate of 2133 MHz, and running macOS 14.5. The system was clocked at 1.4 GHz and utilized Rust’s Nightly build dated 2024-02-01. Benchmarking was performed using Criterion 0.5, with Plonky2 version 0.1.4 and dusk-plonk version 0.19.

Plain performance

image image

Plonky2 performance

image

Plonk performance

Number of constraints

image

Performance

image