package bls12-381-hash

  1. Overview
  2. Docs

Implementation of Poseidon over the scalar field of BLS12-381 for a security with the permutation x^5.

The current implementation only provides the functions to run a permutation. The user is responsible to build a hash function on top of it.

type ctxt

Context of the permutation

val allocate_ctxt : int -> int -> int -> int -> Bls12_381.Fr.t array -> Bls12_381.Fr.t array array -> ctxt

allocate_ctxt state_size nb_full_rounds nb_partial_rounds batch_size round_constants mds. Allocate a context for a specific instance of Poseidon

val get_state : ctxt -> Bls12_381.Fr.t array

Return the current state of the context

val get_state_size : ctxt -> int

Return the state size of the context

val set_state : ctxt -> Bls12_381.Fr.t array -> unit

set_state ctxt state. Set the context state to the given value. The value state must be of the same size than the expecting state

val apply_permutation : ctxt -> unit

Apply a permutation on the current state of the context

module Parameters : sig ... end
OCaml

Innovation. Community. Security.