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, Shake128, Shake256, Shake256Reader};
17
18#[cfg(feature = "with-openssl")]
20mod openssl_compat {
21 use openssl::sha::Sha1 as OpenSslSha1;
22
23 use digest::{FixedOutput, HashMarker, Output, OutputSizeUser, Update};
24
25 #[derive(Default, Clone)]
27 pub struct Sha1(OpenSslSha1);
28
29 impl Update for Sha1 {
30 fn update(&mut self, data: &[u8]) {
31 self.0.update(data);
32 }
33 }
34
35 impl OutputSizeUser for Sha1 {
36 type OutputSize = typenum::consts::U20;
37 }
38
39 impl FixedOutput for Sha1 {
40 fn finalize_into(self, out: &mut Output<Self>) {
41 *out = self.0.finish().into();
42 }
43 }
44
45 impl HashMarker for Sha1 {}
46}