Crate dock_crypto_utils
source ·Expand description
A collection of utilities used by our other crypto libraries. Some examples are Pedersen commitment, Elgamal encryption, some 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, efficient way of checking several pairing relations in a single multi-pairing.
Modules§
- Pedersen commitment
- Elliptic Curve Integrated Encryption Scheme (ECIES)
- Elgamal encryption Elgamal encryption
- Finite field utilities like inner product, weighted inner product, hadamard product, etc
- Hashing utilities like hashing arbitrary bytes to field element or group element
- 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.
- Serde serialization for
arkworks-rs
objects they themselves don’t implement serde - Solving discrete log using Baby Step Giant Step
- Merlin transcripts
Macros§
- Concatenates provided byte slices and hashes result to a point on the curve. Returns as Affine coordinates.
- Concatenates supplied slices into one continuous vector.
- Return
$error
if$left
not equals$right
- Implements
Deref
/DeferMut
traits for the supplied wrapper and type. impl DoubleEndedIterator + ExactSizeIterator
orimpl IndexedParallelIterator
depending on theparallel
feature.impl IntoIterator
whereIntoIter: DoubleEndedIterator + ExactSizeIterator
orimpl IntoParallelIterator
whereIter: IndexedParallelIterator
depending on theparallel
feature.impl IntoIterator
orimpl IntoParallelIterator
depending on theparallel
feature.impl Iterator
orimpl ParallelIterator
depending on theparallel
feature.- Flattened
rayon::join(|| expr1, || rayon::join(|| expr2, || ...))
- Calculates the product of pairing for supplied pairs.
- Converts given vectors to
OwnedPairs
, panics in case of error. - Return pairing where
$pairing_func
is the pairing function,$g1
is/are group G1 elements and$g2
is/are group G2 elements - Return pairing where
$pairing_func
is the pairing function,$g1
is/are group G1 elements and$g2
is/are group G2 elements - Builds
Pairs
from the given slices, panics in case of error. - Attempts to build
OwnedPairs
from the given vectors, returning(left length, right length)
in case of error. - Attempts to convert given slices to
Pairs
, returning(left length, right length)
in case of error. (a, (b, c)) => (a, b, c)