Struct bitcoin_hashes::sha256::Hash
source · #[repr(transparent)]pub struct Hash(/* private fields */);
Expand description
Output of the SHA256 hash function.
Implementations§
source§impl Hash
impl Hash
sourcepub fn from_bytes_ref(bytes: &[u8; 32]) -> &Self
pub fn from_bytes_ref(bytes: &[u8; 32]) -> &Self
Zero cost conversion between a fixed length byte array shared reference and a shared reference to this Hash type.
sourcepub fn from_bytes_mut(bytes: &mut [u8; 32]) -> &mut Self
pub fn from_bytes_mut(bytes: &mut [u8; 32]) -> &mut Self
Zero cost conversion between a fixed length byte array exclusive reference and an exclusive reference to this Hash type.
source§impl Hash
impl Hash
sourcepub fn hash_again(&self) -> Hash
pub fn hash_again(&self) -> Hash
Iterate the sha256 algorithm to turn a sha256 hash into a sha256d hash
sourcepub const fn const_hash(bytes: &[u8]) -> Self
pub const fn const_hash(bytes: &[u8]) -> Self
Computes hash from bytes
in const
context.
Warning: this function is inefficient. It should be only used in const
context.
Trait Implementations§
source§impl Hash for Hash
impl Hash for Hash
§type Engine = HashEngine
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.source§const DISPLAY_BACKWARD: bool = false
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.source§fn from_engine(e: HashEngine) -> Hash
fn from_engine(e: HashEngine) -> Hash
Produces a hash from the current state of a given engine.
source§fn from_slice(sl: &[u8]) -> Result<Hash, FromSliceError>
fn from_slice(sl: &[u8]) -> Result<Hash, FromSliceError>
Copies a byte slice into a hash object.
source§fn to_byte_array(self) -> Self::Bytes
fn to_byte_array(self) -> Self::Bytes
Returns the underlying byte array.
source§fn as_byte_array(&self) -> &Self::Bytes
fn as_byte_array(&self) -> &Self::Bytes
Returns a reference to the underlying byte array.
source§fn from_byte_array(bytes: Self::Bytes) -> Self
fn from_byte_array(bytes: Self::Bytes) -> Self
Constructs a hash from the underlying byte array.
source§fn hash_byte_chunks<B, I>(byte_slices: I) -> Selfwhere
B: AsRef<[u8]>,
I: IntoIterator<Item = B>,
fn hash_byte_chunks<B, I>(byte_slices: I) -> Selfwhere B: AsRef<[u8]>, I: IntoIterator<Item = B>,
Hashes all the byte slices retrieved from the iterator together.
source§impl Ord for Hash
impl Ord for Hash
source§impl PartialEq<Hash> for Hash
impl PartialEq<Hash> for Hash
source§impl PartialOrd<Hash> for Hash
impl PartialOrd<Hash> for Hash
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 moreimpl Copy for Hash
impl Eq for Hash
impl StructuralEq for Hash
impl StructuralPartialEq for Hash
Auto Trait Implementations§
impl RefUnwindSafe for Hash
impl Send for Hash
impl Sync for Hash
impl Unpin for Hash
impl UnwindSafe for Hash
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more