aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCody P Schafer <[email protected]>2014-11-07 12:19:01 -0500
committerCody P Schafer <[email protected]>2014-11-07 16:56:18 -0500
commitb9f95b4ce4887c481ac4934e02a7a3aca4a316a6 (patch)
treef92b45accfc79679250b86e225c23915edd6436c /src
parentMerge pull request #93 from jmesmon/fix-tcpstream (diff)
downloadrust-openssl-b9f95b4ce4887c481ac4934e02a7a3aca4a316a6.tar.xz
rust-openssl-b9f95b4ce4887c481ac4934e02a7a3aca4a316a6.zip
crypto/hash: impl Writer for Hasher to allow use of Reader-Writer convenience functions
Diffstat (limited to 'src')
-rw-r--r--src/crypto/hash.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/crypto/hash.rs b/src/crypto/hash.rs
index a72b8d9f..60517adf 100644
--- a/src/crypto/hash.rs
+++ b/src/crypto/hash.rs
@@ -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();