1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#![no_std]
extern crate generic_array;
use generic_array::{GenericArray, ArrayLength};
use generic_array::typenum::Unsigned;
pub trait Digest {
type OutputSize: ArrayLength<u8>;
type BlockSize: ArrayLength<u8>;
fn input(&mut self, input: &[u8]);
fn result(self) -> GenericArray<u8, Self::OutputSize>;
fn block_bytes(&self) -> usize { Self::BlockSize::to_usize() }
fn block_bits(&self) -> usize { 8 * Self::BlockSize::to_usize() }
fn output_bytes(&self) -> usize { Self::OutputSize::to_usize() }
fn output_bits(&self) -> usize { 8 * Self::OutputSize::to_usize() }
}