Crate dock_crypto_utils

Source
Expand description

A collection of utilities used by our other libraries in this workspace.

  • Pedersen commitment
  • Elgamal encryption, including Hashed Elgamal
  • finite field utilities like inner product, weighted inner product, hadamard product, etc.
  • multiscalar multiplication (MSM) like Fixed Base MSM
  • polynomial utilities like multiplying polynomials, creating polynomial from roots, etc.
  • An efficient way to check several equality relations involving pairings by combining the relations in a random linear combination and doing a multi-pairing check. Relies on Schwartz–Zippel lemma.
  • An efficient way to check several equality relations involving scalar multiplications by combining the relations in a random linear combination and doing a single multi-scalar multiplication check. Relies on Schwartz–Zippel lemma.
  • hashing utilities like hashing arbitrary bytes to field element or group element.
  • solving discrete log using Baby Step Giant Step algorithm

Modules§

aliases
commitment
Pedersen commitment
ecies
Elliptic Curve Integrated Encryption Scheme (ECIES)
elgamal
Elgamal encryption and variations - plain Elgamal, hashed-Elgamal and batched hashed-Elgamal Elgamal encryption and some variations Implements:
extend_some
ff
Finite field utilities like inner product, weighted inner product, hadamard product, etc
hashing_utils
Hashing utilities like hashing arbitrary bytes to field element or group element
iter
macros
misc
msm
Multiscalar multiplication (MSM) like Fixed Base MSM
owned_pairs
pairs
poly
Polynomial utilities like multiplying polynomials, creating polynomial from roots, etc
randomized_mult_checker
An efficient way to check several equality relations involving scalar multiplications by combining the relations in a random linear combination and doing a single multi-scalar multiplication. Relies on Schwartz–Zippel lemma.
randomized_pairing_check
An efficient way to check several equality relations involving pairings by combining the relations in a random linear combination and doing a multi-pairing check. Relies on Schwartz–Zippel lemma.
schnorr_signature
serde_utils
Serde serialization for arkworks-rs objects they themselves don’t implement serde
signature
solve_discrete_log
Solving discrete log using Baby Step Giant Step
transcript
Merlin transcripts
try_iter

Macros§

affine_group_element_from_byte_slices
Concatenates provided byte slices and hashes result to a point on the curve. Returns as Affine coordinates.
cfg_iter_sum
concat_slices
Concatenates supplied slices into one continuous vector.
expect_equality
Return $error if $left not equals $right
impl_deref
Implements Deref/DeferMut traits for the supplied wrapper and type.
impl_indexed_iter
impl DoubleEndedIterator + ExactSizeIterator or impl IndexedParallelIterator depending on the parallel feature.
impl_into_indexed_iter
impl IntoIterator where IntoIter: DoubleEndedIterator + ExactSizeIterator or impl IntoParallelIterator where Iter: IndexedParallelIterator depending on the parallel feature.
impl_into_iter
impl IntoIterator or impl IntoParallelIterator depending on the parallel feature.
impl_iter
impl Iterator or impl ParallelIterator depending on the parallel feature.
join
Flattened rayon::join(|| expr1, || rayon::join(|| expr2, || ...))
multi_pairing
Calculates the product of pairing for supplied pairs.
owned_pairs
Converts given vectors to OwnedPairs, panics in case of error.
pair_g1_g2
Return pairing where $pairing_func is the pairing function, $g1 is/are group G1 elements and $g2 is/are group G2 elements
pair_g2_g1
Return pairing where $pairing_func is the pairing function, $g1 is/are group G1 elements and $g2 is/are group G2 elements
pairs
Builds Pairs from the given slices, panics in case of error.
randomized_pairing_checker_g1_g2
randomized_pairing_checker_g2_g1
try_owned_pairs
Attempts to build OwnedPairs from the given vectors, returning (left length, right length) in case of error.
try_pairs
Attempts to convert given slices to Pairs, returning (left length, right length) in case of error.
unnest_tuple
(a, (b, c)) => (a, b, c)