Skip to main content

Skein512

Struct Skein512 

Source
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

  1. Configuration Block: Process fixed config block to establish initial chaining value
  2. Message Blocks: Process each of the n_blocks message blocks in sequence
  3. 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 process
  • message - Vector of message block wires, each containing 8 × 64-bit words
  • digest - Array of 8 wires representing the 512-bit output digest

Fields§

§n_blocks: usize

Number 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

Source

pub fn new(builder: &CircuitBuilder, n_blocks: usize) -> Self

Source

pub fn populate_message( &self, w: &mut WitnessFiller<'_>, message_blocks: &[[u8; 64]], )

Populate the message wires with input message blocks

Source

pub fn populate_digest( &self, w: &mut WitnessFiller<'_>, expected_digest: [u8; 64], )

Populate the digest wire with expected hash output

Source

pub const fn digest_wires(&self) -> [Wire; 8]

Get the digest wires

Source

pub fn message_wires(&self) -> &[[Wire; 8]]

Get the message block wires

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more