Struct bitcoin::util::hash::Sha256dHash
source · pub struct Sha256dHash(_);
Expand description
A Bitcoin hash, 32-bytes, computed from x as SHA256(SHA256(x))
Implementations§
source§impl Sha256dHash
impl Sha256dHash
source§impl Sha256dHash
impl Sha256dHash
sourcepub fn from_data(data: &[u8]) -> Sha256dHash
pub fn from_data(data: &[u8]) -> Sha256dHash
Create a hash by hashing some data
sourcepub fn into_hash32(self) -> Hash32
pub fn into_hash32(self) -> Hash32
Converts a hash to a Hash32 by truncation
sourcepub fn into_hash48(self) -> Hash48
pub fn into_hash48(self) -> Hash48
Converts a hash to a Hash48 by truncation
sourcepub fn from_hex(s: &str) -> Result<Sha256dHash, HexError>
pub fn from_hex(s: &str) -> Result<Sha256dHash, HexError>
Decodes a big-endian (i.e. reversed vs sha256sum output) hex string as a Sha256dHash
sourcepub fn into_hash64(self) -> Hash64
pub fn into_hash64(self) -> Hash64
Converts a hash to a Hash64 by truncation
sourcepub fn le_hex_string(&self) -> String
pub fn le_hex_string(&self) -> String
Human-readable hex output
sourcepub fn be_hex_string(&self) -> String
pub fn be_hex_string(&self) -> String
Human-readable hex output
Trait Implementations§
source§impl Clone for Sha256dHash
impl Clone for Sha256dHash
source§fn clone(&self) -> Sha256dHash
fn clone(&self) -> Sha256dHash
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for Sha256dHash
impl Debug for Sha256dHash
source§impl<D: Decoder> Decodable<D> for Sha256dHash
impl<D: Decoder> Decodable<D> for Sha256dHash
source§fn consensus_decode(d: &mut D) -> Result<Sha256dHash, Error>
fn consensus_decode(d: &mut D) -> Result<Sha256dHash, Error>
Decode an object with a well-defined format
source§impl Default for Sha256dHash
impl Default for Sha256dHash
source§fn default() -> Sha256dHash
fn default() -> Sha256dHash
Returns the “default value” for a type. Read more
source§impl Display for Sha256dHash
impl Display for Sha256dHash
source§impl<S: Encoder> Encodable<S> for Sha256dHash
impl<S: Encoder> Encodable<S> for Sha256dHash
source§impl<'a> From<&'a [u8]> for Sha256dHash
impl<'a> From<&'a [u8]> for Sha256dHash
source§fn from(data: &'a [u8]) -> Sha256dHash
fn from(data: &'a [u8]) -> Sha256dHash
Converts to this type from the input type.
source§impl FromStr for Sha256dHash
impl FromStr for Sha256dHash
source§impl Hash for Sha256dHash
impl Hash for Sha256dHash
source§impl Index<RangeFull> for Sha256dHash
impl Index<RangeFull> for Sha256dHash
source§impl Index<usize> for Sha256dHash
impl Index<usize> for Sha256dHash
source§impl LowerHex for Sha256dHash
impl LowerHex for Sha256dHash
source§impl Ord for Sha256dHash
impl Ord for Sha256dHash
source§fn cmp(&self, other: &Sha256dHash) -> Ordering
fn cmp(&self, other: &Sha256dHash) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq<Sha256dHash> for Sha256dHash
impl PartialEq<Sha256dHash> for Sha256dHash
source§fn eq(&self, other: &Sha256dHash) -> bool
fn eq(&self, other: &Sha256dHash) -> bool
source§impl PartialOrd<Sha256dHash> for Sha256dHash
impl PartialOrd<Sha256dHash> for Sha256dHash
source§fn partial_cmp(&self, other: &Sha256dHash) -> Option<Ordering>
fn partial_cmp(&self, other: &Sha256dHash) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more