Trait bitcoin_hashes::Hash [−][src]
pub trait Hash: Copy + Clone + PartialEq + Eq + Default + PartialOrd + Ord + Hash + 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> + Borrow<[u8]> { type Engine: HashEngine; type Inner: FromHex; const LEN: usize; const DISPLAY_BACKWARD: bool; 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 engine() -> Self::Engine { ... } fn hash(data: &[u8]) -> Self { ... } }
Trait which applies to hashes of all types
Associated Types
type Engine: HashEngine
[src]
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
[src]
The byte array that represents the hash internally
Associated Constants
const LEN: usize
[src]
Length of the hash, in bytes
const DISPLAY_BACKWARD: bool
[src]
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
[src]
Produce a hash from the current state of a given engine
fn from_slice(sl: &[u8]) -> Result<Self, Error>
[src]
Copies a byte slice into a hash object
fn into_inner(self) -> Self::Inner
[src]
Unwraps the hash and returns the underlying byte array
fn as_inner(&self) -> &Self::Inner
[src]
Unwraps the hash and returns a reference to the underlying byte array
fn from_inner(inner: Self::Inner) -> Self
[src]
Constructs a hash from the underlying byte array
Provided methods
fn engine() -> Self::Engine
[src]
Construct a new engine
fn hash(data: &[u8]) -> Self
[src]
Hashes some bytes
Implementors
impl Hash for bitcoin_hashes::hash160::Hash
[src]
impl Hash for bitcoin_hashes::hash160::Hash
[src]type Engine = HashEngine
type Inner = [u8; 20]
fn engine() -> HashEngineⓘNotable traits for HashEngine
impl Write for HashEngine
[src]
Notable traits for HashEngine
impl Write for HashEngine
fn from_engine(e: HashEngine) -> Hash
[src]
const LEN: usize
[src]
fn from_slice(sl: &[u8]) -> Result<Hash, Error>
[src]
fn into_inner(self) -> Self::Inner
[src]
fn as_inner(&self) -> &Self::Inner
[src]
fn from_inner(inner: Self::Inner) -> Self
[src]
impl Hash for bitcoin_hashes::ripemd160::Hash
[src]
impl Hash for bitcoin_hashes::ripemd160::Hash
[src]type Engine = HashEngine
type Inner = [u8; 20]
fn from_engine(e: HashEngine) -> Hash
[src]
const LEN: usize
[src]
fn from_slice(sl: &[u8]) -> Result<Hash, Error>
[src]
fn into_inner(self) -> Self::Inner
[src]
fn as_inner(&self) -> &Self::Inner
[src]
fn from_inner(inner: Self::Inner) -> Self
[src]
impl Hash for bitcoin_hashes::sha1::Hash
[src]
impl Hash for bitcoin_hashes::sha1::Hash
[src]type Engine = HashEngine
type Inner = [u8; 20]
fn from_engine(e: HashEngine) -> Hash
[src]
const LEN: usize
[src]
fn from_slice(sl: &[u8]) -> Result<Hash, Error>
[src]
fn into_inner(self) -> Self::Inner
[src]
fn as_inner(&self) -> &Self::Inner
[src]
fn from_inner(inner: Self::Inner) -> Self
[src]
impl Hash for bitcoin_hashes::sha256::Hash
[src]
impl Hash for bitcoin_hashes::sha256::Hash
[src]type Engine = HashEngine
type Inner = [u8; 32]
fn from_engine(e: HashEngine) -> Hash
[src]
const LEN: usize
[src]
fn from_slice(sl: &[u8]) -> Result<Hash, Error>
[src]
fn into_inner(self) -> Self::Inner
[src]
fn as_inner(&self) -> &Self::Inner
[src]
fn from_inner(inner: Self::Inner) -> Self
[src]
impl Hash for bitcoin_hashes::sha256d::Hash
[src]
impl Hash for bitcoin_hashes::sha256d::Hash
[src]type Engine = HashEngine
type Inner = [u8; 32]
fn engine() -> HashEngineⓘNotable traits for HashEngine
impl Write for HashEngine
[src]
Notable traits for HashEngine
impl Write for HashEngine
fn from_engine(e: HashEngine) -> Hash
[src]
const LEN: usize
[src]
fn from_slice(sl: &[u8]) -> Result<Hash, Error>
[src]
const DISPLAY_BACKWARD: bool
[src]
fn into_inner(self) -> Self::Inner
[src]
fn as_inner(&self) -> &Self::Inner
[src]
fn from_inner(inner: Self::Inner) -> Self
[src]
impl Hash for bitcoin_hashes::sha512::Hash
[src]
impl Hash for bitcoin_hashes::sha512::Hash
[src]type Engine = HashEngine
type Inner = [u8; 64]
fn from_engine(e: HashEngine) -> Hash
[src]
const LEN: usize
[src]
fn from_slice(sl: &[u8]) -> Result<Hash, Error>
[src]
fn into_inner(self) -> Self::Inner
[src]
fn as_inner(&self) -> &Self::Inner
[src]
fn from_inner(inner: Self::Inner) -> Self
[src]
impl Hash for bitcoin_hashes::siphash24::Hash
[src]
impl Hash for bitcoin_hashes::siphash24::Hash
[src]type Engine = HashEngine
type Inner = [u8; 8]
fn from_engine(e: HashEngine) -> Hash
[src]
const LEN: usize
[src]
fn from_slice(sl: &[u8]) -> Result<Hash, Error>
[src]
fn into_inner(self) -> Self::Inner
[src]
fn as_inner(&self) -> &Self::Inner
[src]
fn from_inner(inner: Self::Inner) -> Self
[src]
impl<T: Tag> Hash for bitcoin_hashes::sha256t::Hash<T>
[src]
impl<T: Tag> Hash for bitcoin_hashes::sha256t::Hash<T>
[src]type Engine = HashEngine
type Inner = [u8; 32]
fn engine() -> HashEngineⓘNotable traits for HashEngine
impl Write for HashEngine
[src]
Notable traits for HashEngine
impl Write for HashEngine
fn from_engine(e: HashEngine) -> Hash<T>
[src]
const LEN: usize
[src]
fn from_slice(sl: &[u8]) -> Result<Hash<T>, Error>
[src]
const DISPLAY_BACKWARD: bool
[src]
fn into_inner(self) -> Self::Inner
[src]
fn as_inner(&self) -> &Self::Inner
[src]
fn from_inner(inner: Self::Inner) -> Self
[src]
impl<T: HashTrait> Hash for Hmac<T>
[src]
impl<T: HashTrait> Hash for Hmac<T>
[src]