Trait ethcore_bigint::hash::FixedHash
[−]
[src]
pub trait FixedHash: Sized { fn new() -> Self; fn zero() -> Self; fn random() -> Self; fn randomize(&mut self); fn len() -> usize; fn from_slice(src: &[u8]) -> Self; fn clone_from_slice(&mut self, src: &[u8]) -> usize; fn copy_to(&self, dest: &mut [u8]); fn contains<'a>(&'a self, b: &'a Self) -> bool; fn is_zero(&self) -> bool; fn low_u64(&self) -> u64; }
Trait for a fixed-size byte array to be used as the output of hash functions.
Required Methods
fn new() -> Self
Create a new, zero-initialised, instance.
fn zero() -> Self
Synonym for new()
. Prefer to new as it's more readable.
fn random() -> Self
Create a new, cryptographically random, instance.
fn randomize(&mut self)
Assign self have a cryptographically random value.
fn len() -> usize
Get the size of this object in bytes.
fn from_slice(src: &[u8]) -> Self
Convert a slice of bytes of length len()
to an instance of this type.
fn clone_from_slice(&mut self, src: &[u8]) -> usize
Assign self to be of the same value as a slice of bytes of length len()
.
fn copy_to(&self, dest: &mut [u8])
Copy the data of this object into some mutable slice of length len()
.
fn contains<'a>(&'a self, b: &'a Self) -> bool
Returns true
if all bits set in b
are also set in self
.
fn is_zero(&self) -> bool
Returns true
if no bits are set.
fn low_u64(&self) -> u64
Returns the lowest 8 bytes interpreted as a BigEndian integer.