Trait breez_sdk_core::bitcoin::util::key::secp256k1::hashes::Hash

pub trait Hash:
    Copy
    + Clone
    + PartialEq
    + Eq
    + PartialOrd
    + Ord
    + Hash
    + Debug
    + Display
    + LowerHex
    + Index<RangeFull, Output = [u8], Output = [u8], Output = [u8], Output = [u8], Output = u8>
    + Index<RangeFrom<usize>>
    + Index<RangeTo<usize>>
    + Index<Range<usize>>
    + Index<usize>
    + Borrow<[u8]> {
    type Engine: HashEngine;
    type Inner: FromHex;

    const LEN: usize;
    const DISPLAY_BACKWARD: bool = false;

    // Required methods
    fn from_engine(e: Self::Engine) -> Self;
    fn from_slice(sl: &[u8]) -> Result<Self, Error>;
    fn into_inner(self) -> Self::Inner;
    fn as_inner(&self) -> &Self::Inner;
    fn from_inner(inner: Self::Inner) -> Self;
    fn all_zeros() -> Self;

    // Provided methods
    fn engine() -> Self::Engine { ... }
    fn hash(data: &[u8]) -> Self { ... }
}
Expand description

Trait which applies to hashes of all types.

Required Associated Types§

type Engine: HashEngine

A hashing engine which bytes can be serialized into. It is expected to implement the io::Write trait, and to never return errors under any conditions.

type Inner: FromHex

The byte array that represents the hash internally.

Required Associated Constants§

const LEN: usize

Length of the hash, in bytes.

Provided Associated Constants§

const DISPLAY_BACKWARD: bool = false

Flag indicating whether user-visible serializations of this hash should be backward. For some reason Satoshi decided this should be true for Sha256dHash, so here we are.

Required Methods§

fn from_engine(e: Self::Engine) -> Self

Produces a hash from the current state of a given engine.

fn from_slice(sl: &[u8]) -> Result<Self, Error>

Copies a byte slice into a hash object.

fn into_inner(self) -> Self::Inner

Unwraps the hash and returns the underlying byte array.

fn as_inner(&self) -> &Self::Inner

Unwraps the hash and returns a reference to the underlying byte array.

fn from_inner(inner: Self::Inner) -> Self

Constructs a hash from the underlying byte array.

fn all_zeros() -> Self

Returns an all zero hash.

An all zeros hash is a made up construct because there is not a known input that can create it, however it is used in various places in Bitcoin e.g., the Bitcoin genesis block’s previous blockhash and the coinbase transaction’s outpoint txid.

Provided Methods§

fn engine() -> Self::Engine

Constructs a new engine.

fn hash(data: &[u8]) -> Self

Hashes some bytes.

Object Safety§

This trait is not object safe.

Implementors§

§

impl Hash for BlockHash

§

type Engine = <Hash as Hash>::Engine

§

type Inner = <Hash as Hash>::Inner

§

const LEN: usize = 32usize

§

const DISPLAY_BACKWARD: bool = true

§

impl Hash for FilterHash

§

type Engine = <Hash as Hash>::Engine

§

type Inner = <Hash as Hash>::Inner

§

const LEN: usize = 32usize

§

const DISPLAY_BACKWARD: bool = true

§

impl Hash for FilterHeader

§

type Engine = <Hash as Hash>::Engine

§

type Inner = <Hash as Hash>::Inner

§

const LEN: usize = 32usize

§

const DISPLAY_BACKWARD: bool = true

§

impl Hash for PubkeyHash

§

type Engine = <Hash as Hash>::Engine

§

type Inner = <Hash as Hash>::Inner

§

const LEN: usize = 20usize

§

const DISPLAY_BACKWARD: bool = false

§

impl Hash for ScriptHash

§

type Engine = <Hash as Hash>::Engine

§

type Inner = <Hash as Hash>::Inner

§

const LEN: usize = 20usize

§

const DISPLAY_BACKWARD: bool = false

§

impl Hash for Sighash

§

type Engine = <Hash as Hash>::Engine

§

type Inner = <Hash as Hash>::Inner

§

const LEN: usize = 32usize

§

const DISPLAY_BACKWARD: bool = true

§

impl Hash for TxMerkleNode

§

type Engine = <Hash as Hash>::Engine

§

type Inner = <Hash as Hash>::Inner

§

const LEN: usize = 32usize

§

const DISPLAY_BACKWARD: bool = true

§

impl Hash for Txid

§

type Engine = <Hash as Hash>::Engine

§

type Inner = <Hash as Hash>::Inner

§

const LEN: usize = 32usize

§

const DISPLAY_BACKWARD: bool = true

§

impl Hash for WPubkeyHash

§

type Engine = <Hash as Hash>::Engine

§

type Inner = <Hash as Hash>::Inner

§

const LEN: usize = 20usize

§

const DISPLAY_BACKWARD: bool = false

§

impl Hash for WScriptHash

§

type Engine = <Hash as Hash>::Engine

§

type Inner = <Hash as Hash>::Inner

§

const LEN: usize = 32usize

§

const DISPLAY_BACKWARD: bool = false

§

impl Hash for WitnessCommitment

§

type Engine = <Hash as Hash>::Engine

§

type Inner = <Hash as Hash>::Inner

§

const LEN: usize = 32usize

§

const DISPLAY_BACKWARD: bool = true

§

impl Hash for WitnessMerkleNode

§

type Engine = <Hash as Hash>::Engine

§

type Inner = <Hash as Hash>::Inner

§

const LEN: usize = 32usize

§

const DISPLAY_BACKWARD: bool = true

§

impl Hash for Wtxid

§

type Engine = <Hash as Hash>::Engine

§

type Inner = <Hash as Hash>::Inner

§

const LEN: usize = 32usize

§

const DISPLAY_BACKWARD: bool = true

§

impl Hash for XpubIdentifier

§

type Engine = <Hash as Hash>::Engine

§

type Inner = <Hash as Hash>::Inner

§

const LEN: usize = 20usize

§

const DISPLAY_BACKWARD: bool = false

§

impl Hash for TapBranchHash

§

type Engine = <Hash<TapBranchTag> as Hash>::Engine

§

type Inner = <Hash<TapBranchTag> as Hash>::Inner

§

const LEN: usize = 32usize

§

const DISPLAY_BACKWARD: bool = false

§

impl Hash for TapLeafHash

§

type Engine = <Hash<TapLeafTag> as Hash>::Engine

§

type Inner = <Hash<TapLeafTag> as Hash>::Inner

§

const LEN: usize = 32usize

§

const DISPLAY_BACKWARD: bool = false

§

impl Hash for TapSighashHash

§

type Engine = <Hash<TapSighashTag> as Hash>::Engine

§

type Inner = <Hash<TapSighashTag> as Hash>::Inner

§

const LEN: usize = 32usize

§

const DISPLAY_BACKWARD: bool = false

§

impl Hash for TapTweakHash

§

type Engine = <Hash<TapTweakTag> as Hash>::Engine

§

type Inner = <Hash<TapTweakTag> as Hash>::Inner

§

const LEN: usize = 32usize

§

const DISPLAY_BACKWARD: bool = false

§

impl Hash for breez_sdk_core::bitcoin::util::key::secp256k1::hashes::hash160::Hash

§

type Engine = HashEngine

§

type Inner = [u8; 20]

§

const LEN: usize = 20usize

§

impl Hash for breez_sdk_core::bitcoin::util::key::secp256k1::hashes::ripemd160::Hash

§

type Engine = HashEngine

§

type Inner = [u8; 20]

§

const LEN: usize = 20usize

§

impl Hash for breez_sdk_core::bitcoin::util::key::secp256k1::hashes::sha1::Hash

§

type Engine = HashEngine

§

type Inner = [u8; 20]

§

const LEN: usize = 20usize

§

impl Hash for breez_sdk_core::bitcoin::util::key::secp256k1::hashes::sha256::Hash

§

type Engine = HashEngine

§

type Inner = [u8; 32]

§

const LEN: usize = 32usize

§

impl Hash for breez_sdk_core::bitcoin::util::key::secp256k1::hashes::sha256d::Hash

§

type Engine = HashEngine

§

type Inner = [u8; 32]

§

const LEN: usize = 32usize

§

const DISPLAY_BACKWARD: bool = true

§

impl Hash for breez_sdk_core::bitcoin::util::key::secp256k1::hashes::sha512::Hash

§

type Engine = HashEngine

§

type Inner = [u8; 64]

§

const LEN: usize = 64usize

§

impl Hash for breez_sdk_core::bitcoin::util::key::secp256k1::hashes::siphash24::Hash

§

type Engine = HashEngine

§

type Inner = [u8; 8]

§

const LEN: usize = 8usize

§

impl<T> Hash for breez_sdk_core::bitcoin::util::key::secp256k1::hashes::sha256t::Hash<T>
where T: Tag,

§

type Engine = HashEngine

§

type Inner = [u8; 32]

§

const LEN: usize = 32usize

§

const DISPLAY_BACKWARD: bool = true

§

impl<T> Hash for Hmac<T>
where T: Hash,

§

type Engine = HmacEngine<T>

§

type Inner = <T as Hash>::Inner

§

const LEN: usize = T::LEN