pub struct Skein512 {
pub n_blocks: usize,
pub message: Vec<[Wire; 8]>,
pub digest: [Wire; 8],
}Expand description
Skein512 circuit that processes a fixed number of 64-byte message blocks
This circuit implements the full Skein-512 hash function for fixed-length inputs, following the reference implementation. Unlike variable-length hash circuits, this expects exactly n_blocks of 64 bytes each as input.
§Circuit Structure
- Configuration Block: Process fixed config block to establish initial chaining value
- Message Blocks: Process each of the n_blocks message blocks in sequence
- Output Block: Generate final 512-bit digest
Each stage uses UBI (Unique Block Iteration) compression with appropriate tweak values.
§Arguments
n_blocks- Number of 64-byte message blocks this circuit will processmessage- Vector of message block wires, each containing 8 × 64-bit wordsdigest- Array of 8 wires representing the 512-bit output digest
Fields§
§n_blocks: usizeNumber of 64-byte blocks this circuit processes
message: Vec<[Wire; 8]>Input message as blocks of 8 × 64-bit words each
digest: [Wire; 8]Expected 512-bit digest as 8 × 64-bit words
Implementations§
Source§impl Skein512
impl Skein512
pub fn new(builder: &CircuitBuilder, n_blocks: usize) -> Self
Sourcepub fn populate_message(
&self,
w: &mut WitnessFiller<'_>,
message_blocks: &[[u8; 64]],
)
pub fn populate_message( &self, w: &mut WitnessFiller<'_>, message_blocks: &[[u8; 64]], )
Populate the message wires with input message blocks
Sourcepub fn populate_digest(
&self,
w: &mut WitnessFiller<'_>,
expected_digest: [u8; 64],
)
pub fn populate_digest( &self, w: &mut WitnessFiller<'_>, expected_digest: [u8; 64], )
Populate the digest wire with expected hash output
Sourcepub const fn digest_wires(&self) -> [Wire; 8]
pub const fn digest_wires(&self) -> [Wire; 8]
Get the digest wires
Sourcepub fn message_wires(&self) -> &[[Wire; 8]]
pub fn message_wires(&self) -> &[[Wire; 8]]
Get the message block wires
Auto Trait Implementations§
impl Freeze for Skein512
impl RefUnwindSafe for Skein512
impl Send for Skein512
impl Sync for Skein512
impl Unpin for Skein512
impl UnsafeUnpin for Skein512
impl UnwindSafe for Skein512
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
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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