diff --git a/src/hmac.rs b/src/hmac.rs index 1fc77445..f910e1a5 100644 --- a/src/hmac.rs +++ b/src/hmac.rs @@ -8,6 +8,7 @@ * This module implements the Hmac function - a Message Authentication Code using a Digest. */ +use std::io; use std::iter::repeat; use cryptoutil; @@ -117,6 +118,11 @@ impl Mac for Hmac { fn output_bytes(&self) -> usize { self.digest.output_bytes() } } +impl io::Write for Hmac { + fn write(&mut self, buf: &[u8]) -> io::Result { self.input(buf); Ok(buf.len()) } + fn flush(&mut self) -> io::Result<()> { Ok(()) } +} + #[cfg(test)] mod test { use std::iter::repeat;