Trait commit_verify::tagged_hash::TaggedHash
source · [−]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
Constructs tagged hash out of a given message data
Constructs tagged hash out of other hash type.
Danger: this does not guarantees that the hash is tagged
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
).
Returns 32-byte slice array representing internal hash data