openvm_ecc_guest::weierstrass

Trait FromCompressed

Source
pub trait FromCompressed<Coordinate> {
    // Required methods
    fn decompress(x: Coordinate, rec_id: &u8) -> Self;
    fn hint_decompress(x: &Coordinate, rec_id: &u8) -> Coordinate;
}

Required Methods§

Source

fn decompress(x: Coordinate, rec_id: &u8) -> Self

Given x-coordinate,

§Panics

If the input is not a valid compressed point. The zkVM panics instead of returning an Option because this function can only guarantee correct behavior when decompression is possible, but the function cannot compute the boolean equal to true if and only if decompression is possible.

Source

fn hint_decompress(x: &Coordinate, rec_id: &u8) -> Coordinate

If it exists, hints the unique y coordinate that is less than Coordinate::MODULUS such that (x, y) is a point on the curve and y has parity equal to rec_id. If such y does not exist, undefined behavior.

This is only a hint, and the returned y does not guarantee any of the above properties. They must be checked separately. Normal users should use decompress directly.

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§