Added clonability for sha hash state. Useful for incremental hashing

This commit is contained in:
Peter Farr 2019-11-11 11:09:49 -08:00
parent dc72a8e2c4
commit 22f029064a
2 changed files with 2 additions and 0 deletions

View File

@ -5,6 +5,7 @@ pub type SHA_LONG = c_uint;
pub const SHA_LBLOCK: c_int = 16;
#[repr(C)]
#[derive(Clone)]
pub struct SHA_CTX {
pub h0: SHA_LONG,
pub h1: SHA_LONG,

View File

@ -110,6 +110,7 @@ pub fn sha512(data: &[u8]) -> [u8; 64] {
///
/// SHA1 is known to be insecure - it should not be used unless required for
/// compatibility with existing systems.
#[derive(Clone)]
pub struct Sha1(ffi::SHA_CTX);
impl Sha1 {