solana_zk_token_sdk::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

Object Safety§

This trait is not object safe.

Implementors§