Skip to main content

WinternitzPubkey

Struct WinternitzPubkey 

Source
pub struct WinternitzPubkey<const N: usize> { /* private fields */ }
Expand description

Public Winternitz key: N message scalars followed by 2 checksum scalars, each 32 bytes. Total size is (N + 2) * 32 bytes.

Each pubkey scalar equals SHA256 applied 255 times to the corresponding privkey scalar. N must be even and in 16..=32 (compile-time enforced).

Implementations§

Source§

impl<const N: usize> WinternitzPubkey<N>

Source

pub fn as_bytes(&self) -> &[u8]

Return the pubkey’s (N + 2) * 32 raw bytes (message scalars then checksum scalars), with no copy.

Source

pub fn merklize(&self) -> WinternitzRoot

Compute the Merkle root over all N + 2 scalars. Leaves are SHA256(0x00 || scalar); internal nodes are SHA256(0x01 || L || R) (domain-separated). The tree shape is “rightmost-duplication on odd levels” — equivalently, an online stack-collapse where leaves are streamed left-to-right, adjacent same-level entries combine on push, and any orphan top-of-stack at drain is lifted to its left neighbour’s level by repeated self-duplication.

Trait Implementations§

Source§

impl<const N: usize> Debug for WinternitzPubkey<N>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<const N: usize> Display for WinternitzPubkey<N>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<const N: usize> From<&WinternitzPrivkey<N>> for WinternitzPubkey<N>

Source§

fn from(sk: &WinternitzPrivkey<N>) -> Self

Converts to this type from the input type.
Source§

impl<const N: usize> From<&WinternitzPubkey<N>> for WinternitzRoot

Source§

fn from(pk: &WinternitzPubkey<N>) -> Self

Converts to this type from the input type.
Source§

impl<const N: usize> From<WinternitzPrivkey<N>> for WinternitzPubkey<N>

Source§

fn from(sk: WinternitzPrivkey<N>) -> Self

Converts to this type from the input type.
Source§

impl<const N: usize> From<WinternitzPubkey<N>> for WinternitzRoot

Source§

fn from(pk: WinternitzPubkey<N>) -> Self

Converts to this type from the input type.
Source§

impl<'a, const N: usize> TryFrom<&'a [u8]> for &'a WinternitzPubkey<N>

Source§

type Error = WinternitzError

The type returned in the event of a conversion error.
Source§

fn try_from(value: &'a [u8]) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<const N: usize> Freeze for WinternitzPubkey<N>

§

impl<const N: usize> RefUnwindSafe for WinternitzPubkey<N>

§

impl<const N: usize> Send for WinternitzPubkey<N>

§

impl<const N: usize> Sync for WinternitzPubkey<N>

§

impl<const N: usize> Unpin for WinternitzPubkey<N>

§

impl<const N: usize> UnsafeUnpin for WinternitzPubkey<N>

§

impl<const N: usize> UnwindSafe for WinternitzPubkey<N>

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.

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> 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.