package bls12-381-hash

  1. Overview
  2. Docs

Griffin over the scalar field of BLS12-381 for a security of 128 bits and with the permutation x^5.

type ctxt

Context of the instance. It contains the states and the parameters such as the state size, the constants and the alpha/beta's

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

allocate_ctxt nb_rounds state_size round_constants alpha_beta_s allocates a new context for an instance of Griffin with a state of size state_size, with round constants round_constants and alpha/beta values set to alpha_beta_s.

val apply_permutation : ctxt -> unit

apply_permutation ctxt applies a permutation on the state. The context is modified.

val apply_one_round : ctxt -> int -> unit

apply_one_round ctxt i_round_key applies only one round of the permutation on the state. i_round_key is the index of the first round constant to use for the round. The context is modified

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 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

module Parameters : sig ... end
OCaml

Innovation. Community. Security.