Added clonability for sha hash state. Useful for incremental hashing
This commit is contained in:
parent
dc72a8e2c4
commit
22f029064a
|
|
@ -5,6 +5,7 @@ pub type SHA_LONG = c_uint;
|
||||||
pub const SHA_LBLOCK: c_int = 16;
|
pub const SHA_LBLOCK: c_int = 16;
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
#[derive(Clone)]
|
||||||
pub struct SHA_CTX {
|
pub struct SHA_CTX {
|
||||||
pub h0: SHA_LONG,
|
pub h0: SHA_LONG,
|
||||||
pub h1: SHA_LONG,
|
pub h1: SHA_LONG,
|
||||||
|
|
|
||||||
|
|
@ -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
|
/// SHA1 is known to be insecure - it should not be used unless required for
|
||||||
/// compatibility with existing systems.
|
/// compatibility with existing systems.
|
||||||
|
#[derive(Clone)]
|
||||||
pub struct Sha1(ffi::SHA_CTX);
|
pub struct Sha1(ffi::SHA_CTX);
|
||||||
|
|
||||||
impl Sha1 {
|
impl Sha1 {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue