Signature

pub trait EcStateTrait

Trait functions

init

Initializes an EC computation with the zero point.

Signature

fn init() -> EcState

Examples

let mut state = EcStateTrait::init();

add

Adds a point to the computation.

Arguments

  • p - The non-zero point to add

Signature

fn add(ref self: EcState, p: NonZero)

sub

Subtracts a point to the computation.

Arguments

  • p - The non-zero point to subtract

Signature

fn sub(ref self: EcState, p: NonZero)

add_mul

Adds the product p * scalar to the state.

Arguments

  • scalar - The scalar to multiply the point by
  • p - The non-zero point to multiply and add

Signature

fn add_mul(ref self: EcState, scalar: felt252, p: NonZero)

finalize_nz

Finalizes the EC computation and returns the result as a non-zero point.

Returns

  • Option - The resulting point, or None if the result is the zero point

Panics

Panics if the result is the point at infinity.

Signature

fn finalize_nz(self: EcState) -> Option>

finalize

Finalizes the EC computation and returns the result. Returns the zero point if the computation results in the point at infinity.

Signature

fn finalize(self: EcState) -> EcPoint