Giter Site home page Giter Site logo

dusk-network / hades252 Goto Github PK

View Code? Open in Web Editor NEW
22.0 6.0 15.0 2.25 MB

Implementation of the Hades permutation algorithm used in Poseidon Hashes with ZKProof capabilities.

Home Page: http://dusk.network

License: Mozilla Public License 2.0

Rust 94.26% Makefile 5.74%
hashing permutation-algorithms zero-knowledge

hades252's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.