pub struct PublicKey(/* private fields */);Expand description
Public key represented as a polynomial with coefficients over the Falcon prime field.
Implementations§
Source§impl PublicKey
impl PublicKey
Sourcepub fn verify(&self, message: Word, signature: &Signature) -> bool
pub fn verify(&self, message: Word, signature: &Signature) -> bool
Verifies the provided signature against provided message and this public key.
Sourcepub fn recover_from(_message: Word, signature: &Signature) -> PublicKey
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.
Sourcepub fn to_commitment(&self) -> Word
pub fn to_commitment(&self) -> Word
Returns a commitment to the public key using the RPO256 hash function.
Methods from Deref<Target = Polynomial<FalconFelt>>§
Sourcepub fn hadamard_mul(&self, other: &Polynomial<F>) -> Polynomial<F>
pub fn hadamard_mul(&self, other: &Polynomial<F>) -> Polynomial<F>
Multiplies two polynomials coefficient-wise (Hadamard multiplication).
Sourcepub fn hadamard_div(&self, other: &Polynomial<F>) -> Polynomial<F>
pub fn hadamard_div(&self, other: &Polynomial<F>) -> Polynomial<F>
Divides two polynomials coefficient-wise (Hadamard division).
Sourcepub fn hadamard_inv(&self) -> Polynomial<F>
pub fn hadamard_inv(&self) -> Polynomial<F>
Computes the coefficient-wise inverse (Hadamard inverse).
Sourcepub fn reduce_by_cyclotomic(&self, n: usize) -> Polynomial<F>
pub fn reduce_by_cyclotomic(&self, n: usize) -> Polynomial<F>
Reduce the polynomial by X^n + 1.
Sourcepub fn field_norm(&self) -> Polynomial<F>
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].
Sourcepub fn lift_next_cyclotomic(&self) -> Polynomial<F>
pub fn lift_next_cyclotomic(&self) -> Polynomial<F>
Lifts an element from a cyclotomic polynomial ring to one of double the size.
Sourcepub fn galois_adjoint(&self) -> Polynomial<F>
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).
Sourcepub fn karatsuba(&self, other: &Polynomial<F>) -> Polynomial<F>
pub fn karatsuba(&self, other: &Polynomial<F>) -> Polynomial<F>
Multiply two polynomials using Karatsuba’s divide-and-conquer algorithm.
Sourcepub fn shift(&self, shamt: usize) -> Polynomial<F>
pub fn shift(&self, shamt: usize) -> Polynomial<F>
Shifts the polynomial by the specified amount (adds leading zeros).
Sourcepub fn map<G, C>(&self, closure: C) -> Polynomial<G>
pub fn map<G, C>(&self, closure: C) -> Polynomial<G>
Applies a function to each coefficient and returns a new polynomial.
Sourcepub fn fold<G, C>(&self, initial_value: G, closure: C) -> G
pub fn fold<G, C>(&self, initial_value: G, closure: C) -> G
Folds the coefficients using the provided function and initial value.
Sourcepub fn norm_squared(&self) -> u64
pub fn norm_squared(&self) -> u64
Computes the squared L2 norm of the polynomial.
Sourcepub fn to_elements(&self) -> Vec<BaseElement>
pub fn to_elements(&self) -> Vec<BaseElement>
Returns the coefficients of this polynomial as field elements.
Trait Implementations§
Source§impl Deserializable for PublicKey
impl Deserializable for PublicKey
Source§fn read_from<R>(source: &mut R) -> Result<PublicKey, DeserializationError>where
R: ByteReader,
fn read_from<R>(source: &mut R) -> Result<PublicKey, DeserializationError>where
R: ByteReader,
source, attempts to deserialize these bytes
into Self, and returns the result. Read moreSource§fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>
fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>
Source§impl From<Polynomial<FalconFelt>> for PublicKey
impl From<Polynomial<FalconFelt>> for PublicKey
Source§fn from(pk_poly: Polynomial<FalconFelt>) -> PublicKey
fn from(pk_poly: Polynomial<FalconFelt>) -> PublicKey
Source§impl SequentialCommit for PublicKey
impl SequentialCommit for PublicKey
Source§type Commitment = Word
type Commitment = Word
Source§fn to_elements(&self) -> Vec<BaseElement>
fn to_elements(&self) -> Vec<BaseElement>
Source§fn to_commitment(&self) -> Self::Commitment
fn to_commitment(&self) -> Self::Commitment
Source§impl Serializable for &PublicKey
impl Serializable for &PublicKey
Source§fn write_into<W>(&self, target: &mut W)where
W: ByteWriter,
fn write_into<W>(&self, target: &mut W)where
W: ByteWriter,
self into bytes and writes these bytes into the target.