use sha2::{Digest, Sha256}; fn main() { let blobs = Blobs::new(128 * 1024); for blob in blobs.take(10) { println!("{}", sha256(&blob)); } } struct Blobs { size: usize, } impl Blobs { fn new(size: usize) -> Self { Self { size } } } impl Iterator for Blobs { type Item = Vec; fn next(&mut self) -> Option { Some(vec![0; self.size]) } } fn sha256(data: &[u8]) -> String { let mut hasher = Sha256::new(); hasher.update(data); let hash = hasher.finalize(); format!("{:x}", hash) }