Expand description
Extra Rust Crypto elliptic-curve adaptors, functions, and macros
There are some methods that can be applied to many different elliptic curves fields and groups.
This crate provides multi-exponentiation functions
and serde serialization for different types of scalars and groups,
including fixed-size array, Vec, and Box<[_]> collections.
These require the alloc or std feature.
Curves still on the group/ff 0.13 traits (curve25519-dalek, ed448-goldilocks,
bls12-381 forks, …) can use these functions through the legacy feature and its
legacy module.
To permit serializing a PrimeField
use elliptic_curve_tools::prime_field;
use elliptic_curve::PrimeField;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
pub struct PrimeFieldWrapper<F: PrimeField>( #[serde(with = "prime_field")] F);To permit serializing a Group
use elliptic_curve_tools::group;
use elliptic_curve::{Group, group::GroupEncoding};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
pub struct GroupWrapper<G: Group + GroupEncoding>( #[serde(with = "group")] G);Other collections can also be serialized like
- Fixed sized arrays like
[PrimeField; 32]or[Group + GroupEncoding; 32]
Modules§
- group
allocorstd - Serialize and deserialize a group element.
- group_
array allocorstd - Serialize and deserialize a group element array.
- group_
boxed_ slice allocorstd - Serialize and deserialize a group element boxed slice.
- group_
vec allocorstd - Serialize and deserialize a group element vector.
- legacy
legacy - Bridge for curves still on the
group/ff0.13 traits. - prime_
field allocorstd - Serialize and deserialize a prime field element.
- prime_
field_ array allocorstd - Serialize and deserialize a prime field element array.
- prime_
field_ boxed_ slice allocorstd - Serialize and deserialize a prime field element boxed slice.
- prime_
field_ vec allocorstd - Serialize and deserialize a prime field element vector.
Structs§
- Insufficient
Scratch allocorstd - Error returned by the in-place multiexp methods when a caller-supplied
Scratchis too small for the requested number of pairs. - Length
Mismatch allocorstd - Error returned when a
Precomputedbasis and the supplied scalars differ in length. - Precomputed
allocorstd - A fixed basis of group elements with precomputed Straus tables.
- Scratch
allocorstd - Pre-allocated scratch space for the allocation-free multiexp methods
(
SumOfProducts::sum_of_products_inplaceandSumOfProducts::sum_of_products_vartime_inplace).
Enums§
- Scratch
Buffer allocorstd - Identifies which buffer of a
Scratchwas undersized.
Traits§
- SumOf
Products - A trait for a group that can compute the sum of products of a slice of group elements and a slice of scalars. The length of the slices must be equal.