Skip to main content

PrimeField64

Trait PrimeField64 

pub trait PrimeField64: PrimeField {
    const ORDER_U64: u64;

    // Required method
    fn as_canonical_u64(&self) -> u64;

    // Provided method
    fn to_unique_u64(&self) -> u64 { ... }
}
Expand description

A prime field ℤ/p with order, p < 2^64.

Required Associated Constants§

const ORDER_U64: u64

Required Methods§

fn as_canonical_u64(&self) -> u64

Return the representative of value in canonical form which lies in the range 0 <= x < ORDER_U64.

Provided Methods§

fn to_unique_u64(&self) -> u64

Convert a field element to a u64 such that any two field elements are converted to the same u64 if and only if they represent the same value.

This will be the fastest way to convert a field element to a u64 and is intended for use in hashing. It will also be consistent across different targets.

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.

Implementations on Foreign Types§

§

impl PrimeField64 for Goldilocks

§

const ORDER_U64: u64 = P

§

fn as_canonical_u64(&self) -> u64

§

impl<FP> PrimeField64 for MontyField31<FP>
where FP: FieldParameters,

§

const ORDER_U64: u64

§

fn as_canonical_u64(&self) -> u64

§

fn to_unique_u64(&self) -> u64

Implementors§

§

impl PrimeField64 for Felt

§

const ORDER_U64: u64 = <Goldilocks as PrimeField64>::ORDER_U64