crypto/hash: impl Writer for Hasher to allow use of Reader-Writer convenience functions
This commit is contained in:
parent
1b7ab0238e
commit
b9f95b4ce4
|
|
@ -1,5 +1,6 @@
|
|||
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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue