1#![no_std]
2#![doc = include_str!("../README.md")]
3#![doc(
4 html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg",
5 html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg"
6)]
7#![cfg_attr(docsrs, feature(doc_auto_cfg))]
8#![warn(missing_docs)]
9#![cfg_attr(
10 any(sha2_backend = "riscv-zknh", sha2_backend = "riscv-zknh-compact"),
11 feature(riscv_ext_intrinsics)
12)]
13#![allow(clippy::needless_range_loop)]
14
15#[cfg(all(
16 any(sha2_backend = "riscv-zknh", sha2_backend = "riscv-zknh-compact"),
17 not(any(any(target_arch = "riscv32", target_arch = "riscv64")))
18))]
19compile_error!("The Zknh backends can be enabled only for RISC-V targets");
20
21pub use digest::{self, Digest};
22
23use digest::{
24 block_api::CtOutWrapper,
25 consts::{U28, U32, U48, U64},
26};
27
28pub mod block_api;
30
31#[rustfmt::skip]
32mod consts;
33mod sha256;
34mod sha512;
35
36digest::buffer_fixed!(
37 pub struct Sha256(CtOutWrapper<block_api::Sha256VarCore, U32>);
39 oid: "2.16.840.1.101.3.4.2.1";
40 impl: FixedHashTraits;
41);
42digest::buffer_fixed!(
43 pub struct Sha384(CtOutWrapper<block_api::Sha512VarCore, U48>);
45 oid: "2.16.840.1.101.3.4.2.2";
46 impl: FixedHashTraits;
47);
48digest::buffer_fixed!(
49 pub struct Sha512(CtOutWrapper<block_api::Sha512VarCore, U64>);
51 oid: "2.16.840.1.101.3.4.2.3";
52 impl: FixedHashTraits;
53);
54digest::buffer_fixed!(
55 pub struct Sha224(CtOutWrapper<block_api::Sha256VarCore, U28>);
57 oid: "2.16.840.1.101.3.4.2.4";
58 impl: FixedHashTraits;
59);
60digest::buffer_fixed!(
61 pub struct Sha512_224(CtOutWrapper<block_api::Sha512VarCore, U28>);
63 oid: "2.16.840.1.101.3.4.2.5";
64 impl: FixedHashTraits;
65);
66digest::buffer_fixed!(
67 pub struct Sha512_256(CtOutWrapper<block_api::Sha512VarCore, U32>);
69 oid: "2.16.840.1.101.3.4.2.6";
70 impl: FixedHashTraits;
71);