mod chacha;
mod crc;
use crate::util::prettybytes;
use anyhow as ah;
pub use crate::generator::chacha::GeneratorChaCha12;
pub use crate::generator::chacha::GeneratorChaCha20;
pub use crate::generator::chacha::GeneratorChaCha8;
pub use crate::generator::crc::GeneratorCrc;
pub trait NextRandom {
fn get_base_size(&self) -> usize;
fn next(&mut self, buf: &mut [u8], count: usize);
fn seek(&mut self, byte_offset: u64) -> ah::Result<()> {
if byte_offset == 0 {
Ok(())
} else {
Err(ah::format_err!(
"The selected random number generator \
does not support seeking to byte offset {}.",
prettybytes(byte_offset, true, true, true)
))
}
}
}