Struct bitcoin::util::hash::Sha256dHash
[−]
[src]
pub struct Sha256dHash(_);
A Bitcoin hash, 32-bytes, computed from x as SHA256(SHA256(x))
Methods
impl Sha256dHash
[src]
fn as_ptr(&self) -> *const u8
Converts the object to a raw pointer
fn as_mut_ptr(&mut self) -> *mut u8
Converts the object to a mutable raw pointer
fn len(&self) -> usize
Returns the length of the object as an array
fn is_empty(&self) -> bool
Returns whether the object, as an array, is empty. Always false.
impl Sha256dHash
[src]
fn from_data(data: &[u8]) -> Sha256dHash
Create a hash by hashing some data
fn into_le(self) -> Uint256
Converts a hash to a little-endian Uint256
fn into_be(self) -> Uint256
Converts a hash to a big-endian Uint256
fn into_hash32(self) -> Hash32
Converts a hash to a Hash32 by truncation
fn into_hash48(self) -> Hash48
Converts a hash to a Hash48 by truncation
fn from_hex(s: &str) -> Result<Sha256dHash, HexError>
Decodes a big-endian (i.e. reversed vs sha256sum output) hex string as a Sha256dHash
fn into_hash64(self) -> Hash64
Converts a hash to a Hash64 by truncation
fn le_hex_string(&self) -> String
Human-readable hex output
fn be_hex_string(&self) -> String
Human-readable hex output
Trait Implementations
impl<'a> From<&'a [u8]> for Sha256dHash
[src]
fn from(data: &'a [u8]) -> Sha256dHash
Performs the conversion.
impl Index<usize> for Sha256dHash
[src]
type Output = u8
The returned type after indexing
fn index(&self, index: usize) -> &u8
The method for the indexing (Foo[Bar]
) operation
impl Index<Range<usize>> for Sha256dHash
[src]
type Output = [u8]
The returned type after indexing
fn index(&self, index: Range<usize>) -> &[u8]
The method for the indexing (Foo[Bar]
) operation
impl Index<RangeTo<usize>> for Sha256dHash
[src]
type Output = [u8]
The returned type after indexing
fn index(&self, index: RangeTo<usize>) -> &[u8]
The method for the indexing (Foo[Bar]
) operation
impl Index<RangeFrom<usize>> for Sha256dHash
[src]
type Output = [u8]
The returned type after indexing
fn index(&self, index: RangeFrom<usize>) -> &[u8]
The method for the indexing (Foo[Bar]
) operation
impl Index<RangeFull> for Sha256dHash
[src]
type Output = [u8]
The returned type after indexing
fn index(&self, _: RangeFull) -> &[u8]
The method for the indexing (Foo[Bar]
) operation
impl PartialEq for Sha256dHash
[src]
fn eq(&self, other: &Sha256dHash) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl Eq for Sha256dHash
[src]
impl PartialOrd for Sha256dHash
[src]
fn partial_cmp(&self, other: &Sha256dHash) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for Sha256dHash
[src]
fn cmp(&self, other: &Sha256dHash) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl Clone for Sha256dHash
[src]
fn clone(&self) -> Sha256dHash
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Copy for Sha256dHash
[src]
impl Hash for Sha256dHash
[src]
fn hash<H>(&self, state: &mut H) where H: Hasher
Feeds this value into the state given, updating the hasher as necessary.
fn hash_slice<H>(data: &[Sha256dHash], state: &mut H) where H: Hasher
Feeds a slice of this type into the state provided.
impl Rand for Sha256dHash
[src]
fn rand<R: Rng>(r: &mut R) -> Sha256dHash
Generates a random instance of this type using the specified source of randomness. Read more
impl Default for Sha256dHash
[src]
fn default() -> Sha256dHash
Returns the "default value" for a type. Read more
impl Serialize for Sha256dHash
[src]
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> where S: Serializer
Serializes this value into this serializer.
impl Deserialize for Sha256dHash
[src]
fn deserialize<D>(d: &mut D) -> Result<Sha256dHash, D::Error> where D: Deserializer
Deserialize this value given this Deserializer
.
impl<S: SimpleEncoder> ConsensusEncodable<S> for Sha256dHash
[src]
fn consensus_encode(&self, s: &mut S) -> Result<(), S::Error>
Encode an object with a well-defined format
impl<D: SimpleDecoder> ConsensusDecodable<D> for Sha256dHash
[src]
fn consensus_decode(d: &mut D) -> Result<Sha256dHash, D::Error>
Decode an object with a well-defined format