An open API service indexing awesome lists of open source software.

https://github.com/alexmllo/zk-hashes

Rust implementation of some Arithmetization-Oriented cryptographic primitives in the Plonk framework
https://github.com/alexmllo/zk-hashes

anemoi arion arithmetic-circuits arithmetization-oriented griffin hash-functions plonk plonky2 poseidon rescue zero-knowledge

Last synced: 3 months ago
JSON representation

Rust implementation of some Arithmetization-Oriented cryptographic primitives in the Plonk framework

Awesome Lists containing this project

README

        

# 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](https://github.com/alexmllo/zk-hashes/assets/125358906/35f7896a-befb-46f8-b596-04e4d9ebbae1)

### Plonk performance
#### Number of constraints
image

#### Performance
image