Crate elliptic_curve_tools

Source
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_slicealloc or std
Serialize and deserialize a group element boxed slice.
group_vecalloc or std
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_slicealloc or std
Serialize and deserialize a prime field element boxed slice.
prime_field_vecalloc or std
Serialize and deserialize a prime field element vector.

Traits§

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