Skip to main content

ToyPolyCommit

Struct ToyPolyCommit 

Source
pub struct ToyPolyCommit {
    pub tau: u64,
    pub q: u64,
}
Expand description

Polynomial commitment scheme toy (Kate-style, educational model).

In real KZG commitments, the commitment is an elliptic curve point. Here we use a simplified polynomial evaluation model.

§WARNING

This is a structural illustration only. It provides NO cryptographic security.

Fields§

§tau: u64

Evaluation point (the “trusted setup” scalar τ)

§q: u64

Field modulus

Implementations§

Source§

impl ToyPolyCommit

Source

pub fn new(tau: u64, q: u64) -> Self

Create a toy polynomial commitment context.

Source

pub fn commit(&self, coeffs: &[u64]) -> u64

Commit to a polynomial given as coefficient vector (lowest degree first).

Commitment = p(τ) mod q (educational stand-in for g^{p(τ)} on an EC).

Source

pub fn evaluate(&self, coeffs: &[u64], z: u64) -> u64

Evaluate the polynomial at a given point z.

Source

pub fn verify_opening( &self, commitment: u64, z: u64, v: u64, coeffs: &[u64], ) -> bool

Verify an opening: checks that the committed value matches the claimed evaluation p(z) = v by comparing with stored commitment.

In real KZG this requires a pairing check.

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> 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<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.