anubis-wormhole 1.0.0

A post-quantum secure file transfer tool based on the Magic Wormhole protocol.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use sha2::{Digest, Sha512};

#[derive(Default)]
pub struct Transcript { h: Sha512 }

impl Transcript {
    pub fn new() -> Self { Self { h: Sha512::new() } }
    pub fn absorb(&mut self, label: &str, data: &[u8]) {
        self.h.update(label.as_bytes());
        self.h.update(&(data.len() as u64).to_be_bytes());
        self.h.update(data);
    }
    pub fn finish(self) -> Vec<u8> { self.h.finalize().to_vec() }
}