[][src]Struct exonum::crypto::Hash

pub struct Hash(_);

The result of applying the SHA-256 hash function to data.

This function splits the input data into blocks and runs each block through a cycle of 64 iterations. The result of the function is a hash 256 bits or 32 bytes in length.

Examples

The example below generates the hash of the indicated data.

use exonum::crypto::{self, Hash};

let data = [1, 2, 3];
let hash_from_data = crypto::hash(&data);
let default_hash = Hash::default();

Methods

impl Hash
[src]

pub fn zero() -> Self
[src]

Creates a new instance filled with zeros.

impl Hash
[src]

pub fn new(bytes_array: [u8; 32]) -> Self
[src]

Creates a new instance from bytes array.

pub fn from_slice(bytes_slice: &[u8]) -> Option<Self>
[src]

Creates a new instance from bytes slice.

pub fn to_hex(&self) -> String
[src]

Returns a hex representation of binary data. Lower case letters are used (e.g. f9b4ca).

Trait Implementations

impl<'a> ExonumJson for &'a Hash
[src]

impl ExonumJsonDeserialize for Hash
[src]

impl<'a> Field<'a> for &'a Hash
[src]

fn check(
    buffer: &'a [u8],
    from: CheckedOffset,
    to: CheckedOffset,
    latest_segment: CheckedOffset
) -> Result
[src]

Checks if data in the buffer could be deserialized. Returns an index of latest data seen. Default implementation simply checks that the length of segment equals field size. Read more

impl UniqueHash for Hash
[src]

impl StorageKey for Hash
[src]

impl StorageValue for Hash
[src]

impl ProofMapKey for Hash
[src]

type Output = Self

The type of keys as read from the database. Read more

impl Eq for Hash
[src]

impl PartialOrd<Hash> for Hash
[src]

impl Copy for Hash
[src]

impl Default for Hash
[src]

Returns a hash consisting of zeros.

impl PartialEq<Hash> for Hash
[src]

impl AsRef<[u8]> for Hash
[src]

impl Clone for Hash
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Ord for Hash
[src]

fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl Debug for Hash
[src]

impl Display for Hash
[src]

impl Hash for Hash
[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Index<Range<usize>> for Hash
[src]

type Output = [u8]

The returned type after indexing.

impl Index<RangeTo<usize>> for Hash
[src]

type Output = [u8]

The returned type after indexing.

impl Index<RangeFrom<usize>> for Hash
[src]

type Output = [u8]

The returned type after indexing.

impl Index<RangeFull> for Hash
[src]

type Output = [u8]

The returned type after indexing.

impl<'de> Deserialize<'de> for Hash
[src]

impl Serialize for Hash
[src]

impl FromHex for Hash
[src]

type Error = FromHexError

Auto Trait Implementations

impl Send for Hash

impl Sync for Hash

Blanket Implementations

impl<T> SerializeContent for T where
    T: Serialize
[src]

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T

impl<T> Erased for T

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<Q, K> Equivalent for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> ToHex for T where
    T: AsRef<[u8]>, 
[src]

impl<T> Clear for T where
    T: InitializableFromZeroed + ?Sized

impl<T> InitializableFromZeroed for T where
    T: Default

impl<T> Same for T

type Output = T

Should always be Self