Commit 92799a62 authored by Roman Walch's avatar Roman Walch
Browse files

adapt names and Readmes

parent 3845e3ac
# Plain Performance Comparison of different Hash Functions for ZKP
# Hash Functions for Zero-Knowledge Applications Zoo
This repository contains Rust implementations of different hash functions for Zero-Knowledge applications.
This repository contains several Rust implementations of different hash functions for zero-knowledge applications and will be extended frequently.
## Hash Functions
The repository already contains the following implementations:
The following hash functions are already implemented:
- `plain_impls` contains a comparison of the plain performance of various hash functions.
- [ReinforcedConcrete](https://todo)
- [Poseidon](https://eprint.iacr.org/2019/458.pdf)
- [Rescue](https://eprint.iacr.org/2019/426.pdf)
- [Rescue-Prime](https://www.esat.kuleuven.be/cosic/publications/article-3259.pdf)
- [Feistel-MiMC](https://eprint.iacr.org/2016/492.pdf)
- [Pedersen-Hash](https://zips.z.cash/protocol/protocol.pdf#concretepedersenhash), code extracted from [Zcash](https://github.com/zcash/librustzcash)
- [Sinsemilla](https://zips.z.cash/protocol/protocol.pdf#concretesinsemillahash), code extracted from [Orchard](https://github.com/zcash/orchard)
## Citing our work
We also benchmark against various classical hash algorithms implemented in [RustCrypto](https://github.com/RustCrypto/hashes).
Please use the following BibTeX entry to cite our work in academic papers.
We instantiate the finite-field permutations (ReinforcedConcrete, Poseidon, Rescue, Rescue-Prime) with a statesize of three field elements in a sponge with one field element reserved as the capacity. Feistel-MiMC always has a statesize of two, which is why one can only absorb one field element per permutation call when instantiated in a sponge.
## Benchmarks
Here we give benchmarks for hashing input sizes of 512-bit (i.e., two field elements for the used prime fields). We, thus, benchmark one permutation call for all symmetric hash functions, except for Feistel-MiMC for which we require two. All benchmarks where obtained on a Linux Desktop PC with an Intel i7-4790 CPU (3.9 GHz) and 16 GB RAM using stable Rust version 1.53 and the `target-cpu=native` flag. Time in ns.
| Hash | | BN | BLS | ST |
|--------------------|--------:|--------:|--------:|--------:|
| ReinforcedConcrete | - | 3 284 | 3 265 | 1 032 |
| Poseidon | - | 17 598 | 18 174 | 17 320 |
| Rescue | - | 415 230 | 446 980 | 359 510 |
| Rescue-Prime | - | 362 870 | 391 560 | 294 660 |
| Feistel-MiMC | - | 33 800 | 35 847 | 28 594 |
| Sinsemilla | 131 460 | - | - | - |
| Pedersen-Hash | 39 807 | - | - | - |
| SHA-256 | 366.5 | - | - | - |
| Blake2b | 245.1 | - | - | - |
| Blake2s | 219.5 | - | - | - |
| SHA3-256 | 392.3 | - | - | - |
```tex
@misc{HashZKP,
title = {Hash functions for Zero-Knowledge applications Zoo},
howpublished = {\url{https://extgit.iaik.tugraz.at/krypto/zkfriendlyhashzoo}},
month = aug,
year = 2021,
note = {{IAIK}, Graz University of Technology},
}
[package]
name = "tplonk"
name = "ZKHash"
version = "0.1.0"
authors = ["Roman Walch <roman.walch@iaik.tugraz.at>"]
description = "Rust implementaiton of the ReinforcedConcrete permutation"
......
......@@ -35,17 +35,3 @@ Here we give benchmarks for hashing input sizes of 512-bit (i.e., two field elem
| Blake2b | 245.1 | - | - | - |
| Blake2s | 219.5 | - | - | - |
| SHA3-256 | 392.3 | - | - | - |
## Citing our work
Please use the following BibTeX entry to cite our work in academic papers.
```tex
@misc{HashZKP,
author = {Roman Walch},
title = {Hash functions for Zero-Knowledge applications},
howpublished = {\url{http://todo.org}},
month = jul,
year = 2021,
note = {IAIK, Graz University of Technology},
}
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use rand::{thread_rng, Rng};
use tplonk::fields::{bls12::FpBLS12, utils4};
use ZKHash::fields::{bls12::FpBLS12, utils4};
type Scalar = FpBLS12;
......
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use rand::{thread_rng, Rng};
use tplonk::fields::{bn256::FpBN256, utils4};
use ZKHash::fields::{bn256::FpBN256, utils4};
type Scalar = FpBN256;
......
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use rand::{thread_rng, Rng};
use tplonk::fields::{st::FpST, utils4};
use ZKHash::fields::{st::FpST, utils4};
type Scalar = FpST;
......
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use ff::PrimeField;
use rand::{thread_rng, Rng};
use tplonk::fields::{bls12::FpBLS12, utils};
use ZKHash::fields::{bls12::FpBLS12, utils};
type Scalar = FpBLS12;
......
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use ff::PrimeField;
use rand::{thread_rng, Rng};
use tplonk::fields::{bn256::FpBN256, utils};
use ZKHash::fields::{bn256::FpBN256, utils};
type Scalar = FpBN256;
......
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use ff::PrimeField;
use rand::{thread_rng, Rng};
use tplonk::fields::{st::FpST, utils};
use ZKHash::fields::{st::FpST, utils};
type Scalar = FpST;
......
......@@ -9,9 +9,9 @@ use random::thread_rng;
use random::Rng;
use sha2::{Digest, Sha256};
use sha3::Sha3_256;
use tplonk::pedersen_hash::pedersen_hash::pedersen_hash;
use tplonk::pedersen_hash::pedersen_hash::Personalization;
use tplonk::sinsemilla::sinsemilla::{
use ZKHash::pedersen_hash::pedersen_hash::pedersen_hash;
use ZKHash::pedersen_hash::pedersen_hash::Personalization;
use ZKHash::sinsemilla::sinsemilla::{
i2lebsp_k, HashDomain, L_ORCHARD_MERKLE, MERKLE_CRH_PERSONALIZATION,
};
......
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use tplonk::{
use ZKHash::{
feistel_mimc::{feistel_mimc::FeistelMimc, feistel_mimc_instances::FM_BLS_PARAMS},
fields::{bls12::FpBLS12, utils},
poseidon::{poseidon::Poseidon, poseidon_instance_bls12::POSEIDON_BLS_PARAMS},
......
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use tplonk::{
use ZKHash::{
feistel_mimc::{feistel_mimc::FeistelMimc, feistel_mimc_instances::FM_BN_PARAMS},
fields::{bn256::FpBN256, utils},
poseidon::{poseidon::Poseidon, poseidon_instance_bn256::POSEIDON_BN_PARAMS},
......
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use tplonk::{
use ZKHash::{
feistel_mimc::{feistel_mimc::FeistelMimc, feistel_mimc_instances::FM_ST_PARAMS},
fields::{st::FpST, utils},
poseidon::{poseidon::Poseidon, poseidon_instance_st::POSEIDON_ST_PARAMS},
......
use tplonk::{
use ZKHash::{
fields::{bls12::FpBLS12, utils},
reinforced_concrete::{
reinforced_concrete::ReinforcedConcrete, reinforced_concrete_instances::RC_BLS_PARAMS,
......
use tplonk::{
use ZKHash::{
fields::{bn256::FpBN256, utils},
reinforced_concrete::{
reinforced_concrete::ReinforcedConcrete, reinforced_concrete_instances::RC_BN_PARAMS,
......
use tplonk::{
use ZKHash::{
fields::{st::FpST, utils},
reinforced_concrete_st::{
reinforced_concrete_st::ReinforcedConcreteSt,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment