PublicKey

Struct PublicKey 

Source
pub struct PublicKey(/* private fields */);
Expand description

Public key represented as a polynomial with coefficients over the Falcon prime field.

Implementations§

Source§

impl PublicKey

Source

pub fn verify(&self, message: Word, signature: &Signature) -> bool

Verifies the provided signature against provided message and this public key.

Source

pub fn recover_from(_message: Word, signature: &Signature) -> PublicKey

Recovers from the signature the public key associated to the secret key used to sign a message.

Source

pub fn to_commitment(&self) -> Word

Returns a commitment to the public key using the RPO256 hash function.

Methods from Deref<Target = Polynomial<FalconFelt>>§

Source

pub fn hadamard_mul(&self, other: &Polynomial<F>) -> Polynomial<F>

Multiplies two polynomials coefficient-wise (Hadamard multiplication).

Source

pub fn hadamard_div(&self, other: &Polynomial<F>) -> Polynomial<F>

Divides two polynomials coefficient-wise (Hadamard division).

Source

pub fn hadamard_inv(&self) -> Polynomial<F>

Computes the coefficient-wise inverse (Hadamard inverse).

Source

pub fn degree(&self) -> Option<usize>

Returns the degree of the polynomial.

Source

pub fn lc(&self) -> F

Returns the leading coefficient of the polynomial.

Source

pub fn reduce_by_cyclotomic(&self, n: usize) -> Polynomial<F>

Reduce the polynomial by X^n + 1.

Source

pub fn field_norm(&self) -> Polynomial<F>

Computes the field norm of the polynomial as an element of the cyclotomic ring F[ X ] / <X^n + 1 > relative to one of half the size, i.e., F[ X ] / <X^(n/2) + 1> .

Corresponds to formula 3.25 in the spec [1, p.30].

Source

pub fn lift_next_cyclotomic(&self) -> Polynomial<F>

Lifts an element from a cyclotomic polynomial ring to one of double the size.

Source

pub fn galois_adjoint(&self) -> Polynomial<F>

Computes the galois adjoint of the polynomial in the cyclotomic ring F[ X ] / < X^n + 1 > , which corresponds to f(x^2).

Source

pub fn karatsuba(&self, other: &Polynomial<F>) -> Polynomial<F>

Multiply two polynomials using Karatsuba’s divide-and-conquer algorithm.

Source

pub fn shift(&self, shamt: usize) -> Polynomial<F>

Shifts the polynomial by the specified amount (adds leading zeros).

Source

pub fn map<G, C>(&self, closure: C) -> Polynomial<G>
where G: Clone, C: FnMut(&F) -> G,

Applies a function to each coefficient and returns a new polynomial.

Source

pub fn fold<G, C>(&self, initial_value: G, closure: C) -> G
where C: FnMut(G, &F) -> G + Clone,

Folds the coefficients using the provided function and initial value.

Source

pub fn norm_squared(&self) -> u64

Computes the squared L2 norm of the polynomial.

Source

pub fn to_elements(&self) -> Vec<BaseElement>

Returns the coefficients of this polynomial as field elements.

Trait Implementations§

Source§

impl Clone for PublicKey

Source§

fn clone(&self) -> PublicKey

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PublicKey

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Deref for PublicKey

Source§

type Target = Polynomial<FalconFelt>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &<PublicKey as Deref>::Target

Dereferences the value.
Source§

impl Deserializable for PublicKey

Source§

fn read_from<R>(source: &mut R) -> Result<PublicKey, DeserializationError>
where R: ByteReader,

Reads a sequence of bytes from the provided source, attempts to deserialize these bytes into Self, and returns the result. Read more
Source§

fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>

Attempts to deserialize the provided bytes into Self and returns the result. Read more
Source§

impl From<Polynomial<FalconFelt>> for PublicKey

Source§

fn from(pk_poly: Polynomial<FalconFelt>) -> PublicKey

Converts to this type from the input type.
Source§

impl PartialEq for PublicKey

Source§

fn eq(&self, other: &PublicKey) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl SequentialCommit for PublicKey

Source§

type Commitment = Word

A type of the commitment which must be derivable from Word.
Source§

fn to_elements(&self) -> Vec<BaseElement>

Returns a representation of the object as a sequence of fields elements.
Source§

fn to_commitment(&self) -> Self::Commitment

Computes the commitment to the object. Read more
Source§

impl Serializable for &PublicKey

Source§

fn write_into<W>(&self, target: &mut W)
where W: ByteWriter,

Serializes self into bytes and writes these bytes into the target.
Source§

fn to_bytes(&self) -> Vec<u8>

Serializes self into a vector of bytes.
Source§

fn get_size_hint(&self) -> usize

Returns an estimate of how many bytes are needed to represent self. Read more
Source§

impl Eq for PublicKey

Source§

impl StructuralPartialEq for PublicKey

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V