package bls12-381
Library
Module
Module type
Parameter
Class
Class type
Implementation of an instantiation of Poseidon over the scalar field of BLS12-381 for a security of 128 bits and with the permutation x^5
. The parameters of the instantiation are:
- state size = 3
- number of full rounds = 8
- number partial rounds = 56
- the partial rounds run the sbox on the last element of the state
These parameters have been generated using security_parameters.ml from Mec.
The linear layer constants and the round keys can be generated using generate_ark.ml and generate_mds.sage from Mec. The constants must be loaded at the top level using Poseidon128.constants_init
.
The current implementation only provides the functions to run a permutation. The user is responsible to build a hash function on top of it.
constants_init ark mds
initializes the constants for Poseidon.
Warnings:
- The function does not verify the parameters are secured
- This function must be called before calling
init
,apply_permutation
andget
init a b c
returns a new context with an initialised state with the value [a, b, c]
.
val apply_permutation : ctxt -> unit
apply_permutation ctxt
applies a permutation on the state. The context is modified.