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]) -> &Hash
pub fn from_bytes_ref(bytes: &[u8; 32]) -> &Hash
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 Hash
pub fn from_bytes_mut(bytes: &mut [u8; 32]) -> &mut Hash
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]) -> Hash
pub const fn const_hash(bytes: &[u8]) -> Hash
Computes hash from bytes in const context.
Warning: this function is inefficient. It should be only used in const context.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Hash
impl<'de> Deserialize<'de> for Hash
Source§fn deserialize<D>(d: D) -> Result<Hash, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(d: D) -> Result<Hash, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<DescriptorId> for Hash
impl From<DescriptorId> for Hash
Source§fn from(hashtype: DescriptorId) -> Hash
fn from(hashtype: DescriptorId) -> Hash
Converts to this type from the input type.
Source§impl From<Hash> for DescriptorId
impl From<Hash> for DescriptorId
Source§fn from(inner: Hash) -> DescriptorId
fn from(inner: Hash) -> DescriptorId
Converts to this type from the input type.
Source§impl From<Hash> for WScriptHash
impl From<Hash> for WScriptHash
Source§fn from(inner: Hash) -> WScriptHash
fn from(inner: Hash) -> WScriptHash
Converts to this type from the input type.
Source§impl From<WScriptHash> for Hash
impl From<WScriptHash> for Hash
Source§fn from(hashtype: WScriptHash) -> Hash
fn from(hashtype: WScriptHash) -> Hash
Converts to this type from the input type.
Source§impl Hash for Hash
impl Hash for Hash
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§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§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 as_byte_array(&self) -> &<Hash as Hash>::Bytes
fn as_byte_array(&self) -> &<Hash as Hash>::Bytes
Returns a reference to the underlying byte array.
Source§fn from_byte_array(bytes: <Hash as Hash>::Bytes) -> Hash
fn from_byte_array(bytes: <Hash as Hash>::Bytes) -> Hash
Constructs a hash from the underlying byte array.
Source§fn hash_byte_chunks<B, I>(byte_slices: I) -> Self
fn hash_byte_chunks<B, I>(byte_slices: I) -> Self
Hashes all the byte slices retrieved from the iterator together.
Source§impl IntoAssets for Hash
impl IntoAssets for Hash
Source§fn into_assets(self) -> Assets
fn into_assets(self) -> Assets
Convert
self into a Assets structSource§impl Ord for Hash
impl Ord for Hash
Source§impl PartialOrd for Hash
impl PartialOrd for Hash
Source§impl SerdeHash for Hash
impl SerdeHash for Hash
Source§fn from_slice_delegated(sl: &[u8]) -> Result<Hash, FromSliceError>
fn from_slice_delegated(sl: &[u8]) -> Result<Hash, FromSliceError>
Helper function to turn a deserialized slice into the correct hash type.
Source§fn serialize<S>(
&self,
s: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
s: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Do serde serialization.
Source§fn deserialize<'de, D>(d: D) -> Result<Self, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<'de, D>(d: D) -> Result<Self, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Do serde deserialization.
Source§impl Serialize for Hash
impl Serialize for Hash
Source§fn serialize<S>(
&self,
s: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
s: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for Hash
impl Eq for Hash
impl StructuralPartialEq for Hash
Auto Trait Implementations§
impl Freeze for Hash
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> Base32Len for T
impl<T> Base32Len for T
Source§fn base32_len(&self) -> usize
fn base32_len(&self) -> usize
Calculate the base32 serialized length
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
Source§impl<T> CheckBase32<Vec<u5>> for T
impl<T> CheckBase32<Vec<u5>> for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> ToBase32 for T
impl<T> ToBase32 for T
Source§fn write_base32<W>(&self, writer: &mut W) -> Result<(), <W as WriteBase32>::Err>where
W: WriteBase32,
fn write_base32<W>(&self, writer: &mut W) -> Result<(), <W as WriteBase32>::Err>where
W: WriteBase32,
Encode as base32 and write it to the supplied writer
Implementations shouldn’t allocate.
Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self into the result. Lower case
letters are used (e.g. f9b4ca)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self into the result. Upper case
letters are used (e.g. F9B4CA)