Trait commit_verify::tagged_hash::TaggedHash[][src]

pub trait TaggedHash<'a, T> where
    Self: Wrapper<Inner = Hash<T>>,
    T: 'a + Tag
{ fn hash(msg: impl AsRef<[u8]>) -> Self
    where
        Self: Sized
, { ... }
fn from_hash<X>(hash: X) -> Self
    where
        Self: Sized,
        X: Hash<Inner = [u8; 32]>
, { ... }
fn from_slice(slice: &[u8]) -> Result<Self, Error>
    where
        Self: Sized
, { ... }
fn as_slice(&'a self) -> &'a [u8; 32] { ... }
fn from_hex(hex: &str) -> Result<Self, Error>
    where
        Self: Sized
, { ... } }
Expand description

Trait with convenience functions, which is auto-implemented for all types wrapping sha256t::Hash, i.e. BIP-340-like hash types.

Provided methods

fn hash(msg: impl AsRef<[u8]>) -> Self where
    Self: Sized
[src]

Expand description

Constructs tagged hash out of a given message data

fn from_hash<X>(hash: X) -> Self where
    Self: Sized,
    X: Hash<Inner = [u8; 32]>, 
[src]

Expand description

Constructs tagged hash out of other hash type.

Danger: this does not guarantees that the hash is tagged

fn from_slice(slice: &[u8]) -> Result<Self, Error> where
    Self: Sized
[src]

Expand description

Constructs tagged hash from byte slice. If slice length is not equal to 32 bytes, fails with Error::InvalidLength (this is just a wrapper for sha256t::Hash::from_slice).

fn as_slice(&'a self) -> &'a [u8; 32][src]

Expand description

Returns 32-byte slice array representing internal hash data

fn from_hex(hex: &str) -> Result<Self, Error> where
    Self: Sized
[src]

Expand description

Constructs tagged hash from a given hexadecimal string

Loading content...

Implementors

impl<'a, U, T> TaggedHash<'a, T> for U where
    U: Wrapper<Inner = Hash<T>>,
    T: 'a + Tag
[src]

Loading content...