#scalar-field #zero-knowledge #crypto

no-std dusk-hades

Implementation of Hades252 permutation algorithm over the Bls12-381 Scalar field

20 releases (11 breaking)

0.24.1 Jan 24, 2024
0.23.0 Dec 13, 2023
0.22.1 Nov 22, 2023
0.21.0 Jun 28, 2023
0.15.0-pre.0 Mar 22, 2021

#774 in Cryptography

Download history 146/week @ 2024-01-01 46/week @ 2024-01-08 62/week @ 2024-01-15 63/week @ 2024-01-22 141/week @ 2024-01-29 151/week @ 2024-02-05 348/week @ 2024-02-12 454/week @ 2024-02-19 311/week @ 2024-02-26 67/week @ 2024-03-04 64/week @ 2024-03-11 64/week @ 2024-03-18 69/week @ 2024-03-25 124/week @ 2024-04-01 37/week @ 2024-04-08 36/week @ 2024-04-15

268 downloads per month

MPL-2.0 license

61KB
371 lines

Build Status Repository Documentation

Hades252 (deprecated)

❗ This crate is deprecated.
The hades permutation moved into dusk-poseidon.

Implementation of Hades252 permutation algorithm over the Bls12-381 Scalar field.

Documentation

To generate the Hades252 documentation:

make doc
make doc-internal

Use

Run the following to add Hades252 to the dependency section of your project's 'Cargo.toml':

cargo add dusk-hades

Hades252 has a width equals to 5; it's possible to use a different value, see How to generate the assets.

Parameters

  • p = 0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001

  • Security level is 117 -120 bits of security [NCCG] bits.

  • width = 5

  • Number of full rounds = 8 . There are four full rounds at the beginning and four full rounds at the end, where each full round has WIDTH quintic S-Boxes.

  • Number of partial rounds = 59, where each partial round has one quintic S-Box and (width-1) identity functions.

  • Number of round constants = 960

Example for ScalarStrategy

use dusk_bls12_381::BlsScalar;
use dusk_hades::{ScalarStrategy, Strategy, WIDTH};

// Generate the inputs that will permute.
// The number of values we can input is equivalent to `WIDTH`

let input = vec![BlsScalar::from(1u64); dusk_hades::WIDTH];
let mut output = input.clone();

let mut strategy = ScalarStrategy::new();
strategy.perm(output.as_mut_slice());

assert_ne!(&input, &output);
assert_eq!(input.len(), output.len());

Deviations

Reference

https://eprint.iacr.org/2019/458.pdf

Dependencies

~2–2.9MB
~64K SLoC