pub struct Blake2s {
pub length: usize,
pub message: Vec<Wire>,
pub digest: [Wire; 8],
}Expand description
BLAKE2s hash function circuit for a fixed-length message.
This struct is a complete circuit that verifies a message of a fixed, compile-time-known length produces a specific 256-bit digest.
The message bytes are packed little-endian into 64-bit words.
Fields§
§length: usizeMessage size in bytes this circuit supports.
message: Vec<Wire>Witness wires for the input message, packed little-endian into 64-bit words.
digest: [Wire; 8]Witness wires for the expected 256-bit digest, as 8 32-bit words.
Implementations§
Source§impl Blake2s
impl Blake2s
Sourcepub fn new_witness(builder: &mut CircuitBuilder, length: usize) -> Self
pub fn new_witness(builder: &mut CircuitBuilder, length: usize) -> Self
Creates a new BLAKE2s circuit with witness variables.
The message length is fixed at circuit construction time, so it shapes the circuit rather than being a witness value itself.
§Arguments
builder- Circuit builder to add constraints to.length- The exact message size, in bytes, this circuit will verify.
§Returns
A struct holding the witness wires for the message and the expected digest.
Sourcepub fn populate_message(&self, witness: &mut WitnessFiller<'_>, message: &[u8])
pub fn populate_message(&self, witness: &mut WitnessFiller<'_>, message: &[u8])
Sourcepub fn populate_digest(
&self,
witness: &mut WitnessFiller<'_>,
digest: &[u8; 32],
)
pub fn populate_digest( &self, witness: &mut WitnessFiller<'_>, digest: &[u8; 32], )
Populates the expected-digest witness wires.
§Arguments
witness- Witness filler to populate.digest- The expected 32-byte BLAKE2s digest.
Auto Trait Implementations§
impl Freeze for Blake2s
impl RefUnwindSafe for Blake2s
impl Send for Blake2s
impl Sync for Blake2s
impl Unpin for Blake2s
impl UnsafeUnpin for Blake2s
impl UnwindSafe for Blake2s
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