Commit b9f95b4c authored by Cody P Schafer's avatar Cody P Schafer
Browse files

crypto/hash: impl Writer for Hasher to allow use of Reader-Writer convenience functions

parent 1b7ab023
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
use libc::c_uint;
use std::ptr;
use std::io;

use ffi;

@@ -34,6 +35,13 @@ pub struct Hasher {
    len: uint,
}

impl io::Writer for Hasher {
    fn write(&mut self, buf: &[u8]) -> io::IoResult<()> {
        self.update(buf);
        Ok(())
    }
}

impl Hasher {
    pub fn new(ht: HashType) -> Hasher {
        ffi::init();