Skip to main content

Curve

Trait Curve 

Source
pub trait Curve:
    'static
    + Copy
    + Clone
    + Debug
    + Default
    + Eq
    + Ord
    + Send
    + Sync {
    type FieldBytesSize: ArraySize<ArrayType<u8>: Copy> + Add<Output: Add<U1, Output: ArraySize<ArrayType<u8>: Copy>>> + Add<U1, Output: ArraySize<ArrayType<u8>: Copy>> + Eq;
    type Uint: ArrayEncoding + Encoding + FixedInteger + Random + RandomMod + Unsigned + Zeroize + ShrAssign<usize>;

    const ORDER: Odd<Self::Uint>;
    const FIELD_ENDIANNESS: ByteOrder = ByteOrder::BigEndian;
}
Expand description

Elliptic curve.

This trait is intended to be impl’d by a ZST which represents a concrete elliptic curve.

Other traits in this crate which are bounded by Curve are intended to be impl’d by these ZSTs, facilitating types which are generic over elliptic curves (e.g. SecretKey).

Required Associated Constants§

Source

const ORDER: Odd<Self::Uint>

Order of this curve’s prime order subgroup, i.e. number of elements in the scalar field.

Provided Associated Constants§

Source

const FIELD_ENDIANNESS: ByteOrder = ByteOrder::BigEndian

Endianness used for serializing field elements of this curve.

Required Associated Types§

Source

type FieldBytesSize: ArraySize<ArrayType<u8>: Copy> + Add<Output: Add<U1, Output: ArraySize<ArrayType<u8>: Copy>>> + Add<U1, Output: ArraySize<ArrayType<u8>: Copy>> + Eq

Size of a serialized field element in bytes (base field or scalar).

This currently assumes that the base and scalar fields have the same-sized modulus in bytes, though that isn’t strictly true and will eventually need to be fixed.

This is typically the same as Self::Uint::ByteSize but for curves with an unusual field modulus (e.g. P-224, P-521) it may be different.

The bounds cover common sizes for tables based on precomputed scalars, and is also useful for serialized point sizes for e.g. SEC1 where relevant.

Source

type Uint: ArrayEncoding + Encoding + FixedInteger + Random + RandomMod + Unsigned + Zeroize + ShrAssign<usize>

Integer type used to represent field elements of this elliptic curve.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§