solana_curve25519::curve_syscall_traits

Trait GroupOperations

Source
pub trait GroupOperations {
    type Point;
    type Scalar;

    // Required methods
    fn add(
        left_point: &Self::Point,
        right_point: &Self::Point,
    ) -> Option<Self::Point>;
    fn subtract(
        left_point: &Self::Point,
        right_point: &Self::Point,
    ) -> Option<Self::Point>;
    fn multiply(
        scalar: &Self::Scalar,
        point: &Self::Point,
    ) -> Option<Self::Point>;
}

Required Associated Types§

Required Methods§

Source

fn add( left_point: &Self::Point, right_point: &Self::Point, ) -> Option<Self::Point>

Adds two curve points: P_0 + P_1.

Source

fn subtract( left_point: &Self::Point, right_point: &Self::Point, ) -> Option<Self::Point>

Subtracts two curve points: P_0 - P_1.

NOTE: Altneratively, one can consider replacing this with a negate function that maps a curve point P -> -P. Then subtraction can be computed by combining negate and add syscalls. However, subtract is a much more widely used function than negate.

Source

fn multiply(scalar: &Self::Scalar, point: &Self::Point) -> Option<Self::Point>

Multiplies a scalar S with a curve point P: S*P

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§