Type Alias dusk_jubjub::JubJubExtended

source ·
pub type JubJubExtended = ExtendedPoint;
Expand description

An alias for ExtendedPoint

Aliased Type§

struct JubJubExtended { /* private fields */ }

Implementations§

source§

impl JubJubExtended

source

pub const fn from_affine(affine: JubJubAffine) -> Self

Constructs an extended point (with Z = 1) from an affine point using the map (x, y) => (x, y, 1, x, y).

source

pub const fn from_raw_unchecked( u: BlsScalar, v: BlsScalar, z: BlsScalar, t1: BlsScalar, t2: BlsScalar ) -> Self

Constructs an extended point from its raw internals

source

pub const fn get_u(&self) -> BlsScalar

Returns the u-coordinate of this point.

source

pub const fn get_v(&self) -> BlsScalar

Returns the v-coordinate of this point.

source

pub const fn get_z(&self) -> BlsScalar

Returns the z-coordinate of this point.

source

pub const fn get_t1(&self) -> BlsScalar

Returns the t1-coordinate of this point.

source

pub const fn get_t2(&self) -> BlsScalar

Returns the t2-coordinate of this point.

source

pub fn to_hash_inputs(&self) -> [BlsScalar; 2]

Returns two scalars suitable for hashing that represent the Extended Point.

source

pub fn hash_to_point(input: &[u8]) -> Self

Hash an arbitrary slice of bytes to a point on the elliptic curve and in the prime order subgroup.

This algorithm uses rejection sampling to hash to a point on the curve: The input together with a counter are hashed into an array of 32 bytes. If the hash is a canonical representation of a point on the curve and a member of the prime-order subgroup, we return it. If not, we increment the counter, hash and try to de-serialize again. This is the same algorithm we used to generate GENERATOR_NUMS as outlined here.

Note: This implementation of hash_to_point is not constant time, in the long run we want to implement an algorithm outlined here, but we start with this implementation in order to be able to use the API already.