Trait bitcoin_hashes::Hash

source ·
pub trait Hash: Copy + Clone + PartialEq + Eq + Debug + Display + LowerHex + Index<RangeFull, Output = [u8]> + Index<RangeFrom<usize>, Output = [u8]> + Index<RangeTo<usize>, Output = [u8]> + Index<Range<usize>, Output = [u8]> + Index<usize, Output = u8> + ToHex {
    type Engine: HashEngine;

    fn engine() -> Self::Engine;
    fn from_engine(e: Self::Engine) -> Self;
    fn len() -> usize;
    fn block_size() -> usize;
    fn from_slice(sl: &[u8]) -> Result<Self, Error>;

    fn hash(data: &[u8]) -> Self { ... }
    fn display_backward() -> bool { ... }
}
Expand description

Trait which applies to hashes of all types

Required Associated Types

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.

Required Methods

Construct a new engine

Produce a hash from the current state of a given engine

Length of the hash, in bytes

Length of the hash’s internal block size, in bytes

Copies a byte slice into a hash object

Provided Methods

Hashes some bytes

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.

Implementors