[][src]Trait secp256kfun::marker::PointType

pub trait PointType: Sized + Clone + Copy {
    type NegationType: Default;
}

Every T of a Point<T,S,Z> implements the PointType trait.

There are several different point types.

  • Normal: A point represented internally with Affine coordinates, with x and y coordinates (if it's not zero). These can be directly serialized or hahsed.
  • Jacobian: A non-Normal represented internally in Jacobian coordinates. Usually the result of a point operation. Before being serialized or hashed, you have to normalize it.
  • BasePoint: A Normal point that has pre-computed multiplication tables like G.
  • EvenY/SquareY: A Normal point whose y-coordinate is known to be even or square at compile time.

To normalize a Point<Jacobian> you mark it as Normal:

use secp256kfun::{g, marker::*, Scalar, G};
let scalar = Scalar::random(&mut rand::thread_rng());
let jacobian_point = g!(scalar * G);
let normal_point = jacobian_point.mark::<Normal>();
let bytes = normal_point.to_bytes(); // we can now serialize it

Associated Types

type NegationType: Default

The point type returned from the negation of a point of this type.

Loading content...

Implementors

impl PointType for Jacobian[src]

impl<N: Normalized> PointType for N[src]

Loading content...