1#[cfg(feature = "with-openssl")]
11pub use openssl_compat::Sha1;
12#[cfg(not(feature = "with-openssl"))]
13pub use sha1::Sha1;
14
15pub use sha2::{Sha256, Sha512};
16pub use sha3::Sha3_256;
17pub use shake::{Shake128, Shake256, Shake256Reader};
18
19#[cfg(feature = "with-openssl")]
21mod openssl_compat {
22 use openssl::sha::Sha1 as OpenSslSha1;
23
24 use digest::{FixedOutput, HashMarker, Output, OutputSizeUser, Update};
25
26 #[derive(Default, Clone)]
28 pub struct Sha1(OpenSslSha1);
29
30 impl Update for Sha1 {
31 fn update(&mut self, data: &[u8]) {
32 self.0.update(data);
33 }
34 }
35
36 impl OutputSizeUser for Sha1 {
37 type OutputSize = typenum::consts::U20;
38 }
39
40 impl FixedOutput for Sha1 {
41 fn finalize_into(self, out: &mut Output<Self>) {
42 *out = self.0.finish().into();
43 }
44 }
45
46 impl HashMarker for Sha1 {}
47}