[][src]Trait secp256kfun::marker::YChoice

pub trait YChoice: Normalized + Default {
    fn xonly_into_point(x_only: XOnly<Self>) -> Point<Self, Public, NonZero>;
fn bytes_into_point<S>(bytes: [u8; 32]) -> Option<Point<Self, S, NonZero>>;
fn norm_point_matches<T: Normalized, S>(
        point: &Point<T, S, NonZero>
    ) -> bool; }

A trait implemented by EvenY and SquareY.

Every valid x-coordinate on the curve has exactly two valid y-coordinates (with one being the negation of the other) and one and only one of them will be even or square (and it might be the same one). This fact is used to make a Point conform to either one then to compress the point to only its x-coordinate (XOnly<Y: YChoice>). When decompressing the x-coordinate we choose the y-coordinate according to the YChoice.

Note: Usually the methods on this trait are not used directly but are used internally by methods on XOnly and Point.

Required methods

fn xonly_into_point(x_only: XOnly<Self>) -> Point<Self, Public, NonZero>

Converts an XOnly into a Point given the choice of y coordinate.

fn bytes_into_point<S>(bytes: [u8; 32]) -> Option<Point<Self, S, NonZero>>

Converts 32-bytes representing an x-coordinate into a Point.

fn norm_point_matches<T: Normalized, S>(point: &Point<T, S, NonZero>) -> bool

Checks whether a Normalized point has a y-coordinate that matches the YChoice.

Loading content...

Implementors

impl YChoice for EvenY[src]

impl YChoice for SquareY[src]

Loading content...