pub struct WinternitzSignature<const N: usize> { /* private fields */ }Expand description
Winternitz one-time signature: N message scalars and 2 checksum scalars,
each 32 bytes. Total size is (N + 2) * 32 bytes.
Verify with Self::verify against a WinternitzRoot and the original
message. Verification reconstructs the corresponding pubkey by completing
each chain, merklizes, and compares to the supplied root.
Implementations§
Source§impl<const N: usize> WinternitzSignature<N>
impl<const N: usize> WinternitzSignature<N>
Sourcepub fn new(scalars: [[u8; 32]; N], checksum: [[u8; 32]; 2]) -> Self
pub fn new(scalars: [[u8; 32]; N], checksum: [[u8; 32]; 2]) -> Self
Create a signature from N * [u8;32] scalars + 2 checksum scalars.
Sourcepub fn as_bytes(&self) -> &[u8]
pub fn as_bytes(&self) -> &[u8]
Return the signature’s (N + 2) * 32 raw bytes (message scalars then
checksum scalars), with no copy.
Sourcepub fn verify(&self, message: &[&[u8]], root: &WinternitzRoot) -> bool
pub fn verify(&self, message: &[&[u8]], root: &WinternitzRoot) -> bool
Verify this signature against a message and a stored root. Returns
true if the signature is valid. The message is supplied as a slice
of byte slices (matching solana_sha256_hasher::hashv), so callers
can mix domain-separation tags or context bytes with the payload
without an intermediate allocation.
Sourcepub fn verify_prehashed(&self, hash: &[u8; N], root: &WinternitzRoot) -> bool
pub fn verify_prehashed(&self, hash: &[u8; N], root: &WinternitzRoot) -> bool
Verify against a pre-hashed message digest. See Self::hash for the
expected digest construction.
Sourcepub fn recover_pubkey(&self, message: &[&[u8]]) -> WinternitzPubkey<N>
pub fn recover_pubkey(&self, message: &[&[u8]]) -> WinternitzPubkey<N>
Recover the WinternitzPubkey implied by this signature over the
given message. No verification is performed — pair with
WinternitzPubkey::merklize (or rely on the Into<WinternitzRoot>
impl) and compare against a trusted root to verify.
The message is supplied as a slice of byte slices so callers can
include domain-separation tags or context bytes alongside the payload
(matching solana_sha256_hasher::hashv).
Sourcepub fn recover_pubkey_prehashed(&self, hash: &[u8; N]) -> WinternitzPubkey<N>
pub fn recover_pubkey_prehashed(&self, hash: &[u8; N]) -> WinternitzPubkey<N>
Recover the WinternitzPubkey from a pre-hashed message digest. See
Self::hash for the expected digest construction.