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 serialization for different types of scalars and groups. Serialization doesn’t use any allocations and is no_std compliant.
In addition with the alloc
or std
feature, it can
handle serializing Vec as well.
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
- Serialize and deserialize a group element.
- group_
array - Serialize and deserialize a group element array.
- group_
boxed_ slice alloc
orstd
- Serialize and deserialize a group element boxed slice.
- group_
vec alloc
orstd
- Serialize and deserialize a group element vector.
- prime_
field - Serialize and deserialize a prime field element.
- prime_
field_ array - Serialize and deserialize a prime field element array.
- prime_
field_ boxed_ slice alloc
orstd
- Serialize and deserialize a prime field element boxed slice.
- prime_
field_ vec alloc
orstd
- Serialize and deserialize a prime field element vector.
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.