Skip to main content

Curve

Trait Curve 

pub trait Curve:
    'static
    + Copy
    + Clone
    + Debug
    + Default
    + Eq
    + Ord
    + Send
    + Sync {
    type FieldBytesSize: ArrayLength<u8> + Add + Eq;
    type Uint: ArrayEncoding + AddMod<Output = Self::Uint> + Encoding + Integer + NegMod<Output = Self::Uint> + Random + RandomMod + SubMod<Output = Self::Uint> + Zeroize + FieldBytesEncoding<Self> + ShrAssign<usize>;

    const ORDER: Self::Uint;
}
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§

const ORDER: Self::Uint

Order of this elliptic curve, i.e. number of elements in the scalar field.

Required Associated Types§

type FieldBytesSize: ArrayLength<u8> + Add + Eq

Size of a serialized field element in bytes.

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.

type Uint: ArrayEncoding + AddMod<Output = Self::Uint> + Encoding + Integer + NegMod<Output = Self::Uint> + Random + RandomMod + SubMod<Output = Self::Uint> + Zeroize + FieldBytesEncoding<Self> + 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§

§

impl Curve for NistP256

§

const ORDER: Uint<crypto_bigint::::uint::U256::{constant#0}>

§

type FieldBytesSize = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>

§

type Uint = Uint<crypto_bigint::::uint::U256::{constant#0}>

§

impl Curve for Secp256k1

§

const ORDER: Uint<crypto_bigint::::uint::U256::{constant#0}> = ORDER

§

type FieldBytesSize = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>

§

type Uint = Uint<crypto_bigint::::uint::U256::{constant#0}>