pub struct Transcript<H: Hasher = DefaultHasher> { /* private fields */ }Expand description
Fiat-Shamir transcript as a continuous hash chain: inputs update the running state; challenges are produced by finalizing a clone and re-absorbing the digest so each squeeze depends on every prior op.
Generic over H so SHA3 / Blake3 / Poseidon
backends are interchangeable.
Implementations§
Source§impl<H: Hasher> Transcript<H>
impl<H: Hasher> Transcript<H>
Sourcepub fn append_message(&mut self, label: &'static [u8], message: &[u8])
pub fn append_message(&mut self, label: &'static [u8], message: &[u8])
Append labelled bytes. The length prefix is required to block length-extension collisions between messages.
Sourcepub fn append_u64(&mut self, label: &'static [u8], value: u64)
pub fn append_u64(&mut self, label: &'static [u8], value: u64)
Append a u64 for protocol context
(num_rows, num_cols, bus heights, …).
pub fn append_field<F: TowerField>(&mut self, label: &'static [u8], element: F)
Sourcepub fn append_field_list<F: TowerField>(
&mut self,
label: &'static [u8],
elements: &[F],
)
pub fn append_field_list<F: TowerField>( &mut self, label: &'static [u8], elements: &[F], )
Append a list of field elements
(e.g. a polynomial’s round coefficients).
Length-prefixed and serialized via
TowerField::to_bytes() for canonical,
padding-free, endian-agnostic hashing.
Sourcepub fn challenge_field<F: TowerField>(
&mut self,
label: &'static [u8],
) -> Result<F>
pub fn challenge_field<F: TowerField>( &mut self, label: &'static [u8], ) -> Result<F>
Draw a field challenge via the wide-pipe Fiat-Shamir pattern: finalize a clone of the running hasher (preserving full internal entropy), then re-absorb the digest so the next challenge depends on this one.
Trait Implementations§
Auto Trait Implementations§
impl<H> Freeze for Transcript<H>where
H: Freeze,
impl<H> RefUnwindSafe for Transcript<H>where
H: RefUnwindSafe,
impl<H> Send for Transcript<H>
impl<H> Sync for Transcript<H>
impl<H> Unpin for Transcript<H>where
H: Unpin,
impl<H> UnsafeUnpin for Transcript<H>where
H: UnsafeUnpin,
impl<H> UnwindSafe for Transcript<H>where
H: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more