Skip to main content

Curve

Trait Curve 

pub trait Curve:
    Debug
    + Copy
    + Eq
    + Ord
    + Hash
    + Default
    + Sync
    + Send
    + 'static {
    type Point: Additive + From<CurveGenerator> + Zero + Zeroize + OnCurve + SmallFactor + Copy + Eq + ConstantTimeEq + ConditionallySelectable + Default + CompressedEncoding<Bytes = Self::CompressedPointArray> + UncompressedEncoding<Bytes = Self::UncompressedPointArray> + Decode + Unpin + Sync + Send;
    type Scalar: Additive + Multiplicative<Self::Scalar, Output = Self::Scalar, Output = Self::Point, Output = Self::Point> + Multiplicative<CurveGenerator> + Multiplicative<Self::Point> + Invertible + Zero + One + FromUniformBytes + SamplableVartime + Zeroize + Copy + Eq + ConstantTimeEq + ConditionallySelectable + Default + IntegerEncoding<Bytes = Self::ScalarArray> + Unpin + Sync + Send;
    type CompressedPointArray: ByteArray;
    type UncompressedPointArray: ByteArray;
    type ScalarArray: ByteArray;
    type CoordinateArray: ByteArray;

    const CURVE_NAME: &'static str;
}
Expand description

Elliptic curve

This trait contains all the low-level curve implementation logic: scalar, point arithmetics, encoding and etc.

Required Associated Constants§

const CURVE_NAME: &'static str

Curve name

Required Associated Types§

type Point: Additive + From<CurveGenerator> + Zero + Zeroize + OnCurve + SmallFactor + Copy + Eq + ConstantTimeEq + ConditionallySelectable + Default + CompressedEncoding<Bytes = Self::CompressedPointArray> + UncompressedEncoding<Bytes = Self::UncompressedPointArray> + Decode + Unpin + Sync + Send

Type that represents a curve point

type Scalar: Additive + Multiplicative<Self::Scalar, Output = Self::Scalar, Output = Self::Point, Output = Self::Point> + Multiplicative<CurveGenerator> + Multiplicative<Self::Point> + Invertible + Zero + One + FromUniformBytes + SamplableVartime + Zeroize + Copy + Eq + ConstantTimeEq + ConditionallySelectable + Default + IntegerEncoding<Bytes = Self::ScalarArray> + Unpin + Sync + Send

Type that represents a curve scalar

type CompressedPointArray: ByteArray

Byte array that fits the whole bytes representation of compressed point

type UncompressedPointArray: ByteArray

Byte array that fits the whole bytes representation of uncompressed point

type ScalarArray: ByteArray

Byte array that fits the whole bytes representation of a scalar

type CoordinateArray: ByteArray

Byte array that fits the whole bytes representation of a coordinate

If a curve doesn’t expose point coordinates, it may be [u8; 0]

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.

Implementations on Foreign Types§

§

impl Curve for Ed25519

§

const CURVE_NAME: &'static str = "ed25519"

§

type Point = Point

§

type Scalar = Scalar

§

type CompressedPointArray = <Point as CompressedEncoding>::Bytes

§

type UncompressedPointArray = <Point as UncompressedEncoding>::Bytes

§

type ScalarArray = <Scalar as IntegerEncoding>::Bytes

§

type CoordinateArray = [u8; 0]

§

impl<C, X> Curve for RustCryptoCurve<C, X>
where C: CurveName + CurveArithmetic, <C as CurveArithmetic>::ProjectivePoint: From<<C as CurveArithmetic>::AffinePoint> + CofactorGroup + Copy + Eq + Default + ConstantTimeEq + ConditionallySelectable + Zeroize + Unpin, <C as CurveArithmetic>::AffinePoint: From<<C as CurveArithmetic>::ProjectivePoint> + ToEncodedPoint<C> + FromEncodedPoint<C>, &'a <C as CurveArithmetic>::ProjectivePoint: for<'a> Mul<&'a <C as CurveArithmetic>::Scalar, Output = <C as CurveArithmetic>::ProjectivePoint>, <C as CurveArithmetic>::Scalar: Reduce<<C as Curve>::Uint> + Eq + ConstantTimeEq + ConditionallySelectable + DefaultIsZeroes + Unpin, RustCryptoScalar<C>: BytesModOrder + FromUniformBytes, ScalarPrimitive<C>: for<'a> From<&'a <C as CurveArithmetic>::Scalar>, <C as Curve>::FieldBytesSize: ModulusSize, X: 'static,

§

const CURVE_NAME: &'static str = C::CURVE_NAME

§

type Point = RustCryptoPoint<C>

§

type Scalar = RustCryptoScalar<C>

§

type CompressedPointArray = <<RustCryptoCurve<C, X> as Curve>::Point as CompressedEncoding>::Bytes

§

type UncompressedPointArray = <<RustCryptoCurve<C, X> as Curve>::Point as UncompressedEncoding>::Bytes

§

type ScalarArray = <<RustCryptoCurve<C, X> as Curve>::Scalar as IntegerEncoding>::Bytes

§

type CoordinateArray = GenericArray<u8, <C as Curve>::FieldBytesSize>

Implementors§