pub trait HashBytes {
    // Required methods
    fn from_iter<I: Iterator<Item = u8>>(iter: I) -> Self
       where Self: Sized;
    fn max_bits() -> usize;
    fn as_slice(&self) -> &[u8] ;
}
Expand description

Interface for types used for storing hash data.

This is implemented for Vec<u8>, Box<[u8]> and arrays that are multiples/combinations of useful x86 bytewise SIMD register widths (64, 128, 256, 512 bits).

Please feel free to open a pull request on Github if you need this implemented for a different array size.

Required Methods§

source

fn from_iter<I: Iterator<Item = u8>>(iter: I) -> Selfwhere Self: Sized,

Construct this type from an iterator of bytes.

If this type has a finite capacity (i.e. an array) then it can ignore extra data (the hash API will not create a hash larger than this type can contain). Unused capacity must be zeroed.

source

fn max_bits() -> usize

Return the maximum capacity of this type, in bits.

If this type has an arbitrary/theoretically infinite capacity, return usize::max_value().

source

fn as_slice(&self) -> &[u8]

Get the hash bytes as a slice.

Implementations on Foreign Types§

source§

impl HashBytes for Vec<u8>

source§

fn from_iter<I: Iterator<Item = u8>>(iter: I) -> Self

source§

fn max_bits() -> usize

source§

fn as_slice(&self) -> &[u8]

source§

impl HashBytes for [u8; 40]

source§

fn from_iter<I: Iterator<Item = u8>>(iter: I) -> Self

source§

fn max_bits() -> usize

source§

fn as_slice(&self) -> &[u8]

source§

impl HashBytes for [u8; 48]

source§

fn from_iter<I: Iterator<Item = u8>>(iter: I) -> Self

source§

fn max_bits() -> usize

source§

fn as_slice(&self) -> &[u8]

source§

impl HashBytes for [u8; 64]

source§

fn from_iter<I: Iterator<Item = u8>>(iter: I) -> Self

source§

fn max_bits() -> usize

source§

fn as_slice(&self) -> &[u8]

source§

impl HashBytes for Box<[u8]>

source§

fn from_iter<I: Iterator<Item = u8>>(iter: I) -> Self

source§

fn max_bits() -> usize

source§

fn as_slice(&self) -> &[u8]

source§

impl HashBytes for [u8; 32]

source§

fn from_iter<I: Iterator<Item = u8>>(iter: I) -> Self

source§

fn max_bits() -> usize

source§

fn as_slice(&self) -> &[u8]

source§

impl HashBytes for [u8; 16]

source§

fn from_iter<I: Iterator<Item = u8>>(iter: I) -> Self

source§

fn max_bits() -> usize

source§

fn as_slice(&self) -> &[u8]

source§

impl HashBytes for [u8; 56]

source§

fn from_iter<I: Iterator<Item = u8>>(iter: I) -> Self

source§

fn max_bits() -> usize

source§

fn as_slice(&self) -> &[u8]

source§

impl HashBytes for [u8; 8]

source§

fn from_iter<I: Iterator<Item = u8>>(iter: I) -> Self

source§

fn max_bits() -> usize

source§

fn as_slice(&self) -> &[u8]

source§

impl HashBytes for [u8; 24]

source§

fn from_iter<I: Iterator<Item = u8>>(iter: I) -> Self

source§

fn max_bits() -> usize

source§

fn as_slice(&self) -> &[u8]

Implementors§