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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#![no_std]
#![doc(
html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg",
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg",
html_root_url = "https://docs.rs/block-buffer/0.10.0-pre.4"
)]
#![warn(missing_docs, rust_2018_idioms)]
#[cfg(feature = "block-padding")]
pub use block_padding;
pub use generic_array;
use core::fmt;
use generic_array::{ArrayLength, GenericArray};
mod buffer;
mod lazy;
mod utils;
pub use buffer::BlockBuffer;
pub use lazy::LazyBlockBuffer;
pub type Block<BlockSize> = GenericArray<u8, BlockSize>;
pub type ParBlock<BlockSize, ParBlocks> = GenericArray<Block<BlockSize>, ParBlocks>;
pub trait DigestBuffer<BlockSize: ArrayLength<u8>>: Default {
fn digest_blocks(&mut self, input: &[u8], compress: impl FnMut(&[Block<BlockSize>]));
fn reset(&mut self);
}
#[derive(Copy, Clone, Debug)]
pub struct InvalidLength;
impl fmt::Display for InvalidLength {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
f.write_str("Invalid Length")
}
}