+/// Calculate the sha512 digest of some data on the given channel
+fn sha512_digest(rx: Receiver<Arc<Vec<u8>>>) -> JoinHandle<(Algorithm, Vec<u8>)> {
+ thread::spawn(move || {
+ let mut sha512 = Sha512::new();
+ while let Ok(chunk) = rx.recv() {
+ sha512.update(&*chunk);
+ }
+ let result = sha512.finalize();
+ (Algorithm::Sha512, result.to_vec())
+ })
+}
+