Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/hmac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -117,6 +118,11 @@ impl <D: Digest> Mac for Hmac<D> {
fn output_bytes(&self) -> usize { self.digest.output_bytes() }
}

impl <D: Digest> io::Write for Hmac<D> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { self.input(buf); Ok(buf.len()) }
fn flush(&mut self) -> io::Result<()> { Ok(()) }
}

#[cfg(test)]
mod test {
use std::iter::repeat;
Expand Down