Coverage Report

Created: 2026-02-14 07:33

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/sha2-0.11.0-rc.5/src/sha512.rs
Line
Count
Source
1
cfg_if::cfg_if! {
2
    if #[cfg(sha2_backend = "soft")] {
3
        mod soft;
4
        use soft::compress;
5
    } else if #[cfg(sha2_backend = "soft-compact")] {
6
        mod soft_compact;
7
        use soft_compact::compress;
8
    } else if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
9
        mod soft;
10
        mod x86_avx2;
11
        use x86_avx2::compress;
12
    } else if #[cfg(all(
13
        any(target_arch = "riscv32", target_arch = "riscv64"),
14
        sha2_backend = "riscv-zknh"
15
    ))] {
16
        mod riscv_zknh;
17
        mod riscv_zknh_utils;
18
        use riscv_zknh::compress;
19
    } else if #[cfg(all(
20
        any(target_arch = "riscv32", target_arch = "riscv64"),
21
        sha2_backend = "riscv-zknh-compact"
22
    ))] {
23
        mod riscv_zknh_compact;
24
        mod riscv_zknh_utils;
25
        use riscv_zknh_compact::compress;
26
    } else if #[cfg(target_arch = "aarch64")] {
27
        mod soft;
28
        mod aarch64_sha2;
29
        use aarch64_sha2::compress;
30
    } else if #[cfg(target_arch = "loongarch64")] {
31
        mod loongarch64_asm;
32
        use loongarch64_asm::compress;
33
    } else if #[cfg(all(target_arch = "wasm32", target_feature = "simd128"))] {
34
        mod wasm32_simd128;
35
        use wasm32_simd128::compress;
36
    } else {
37
        mod soft;
38
        use soft::compress;
39
    }
40
}
41
42
#[inline(always)]
43
#[allow(dead_code)]
44
0
fn to_u64s(block: &[u8; 128]) -> [u64; 16] {
45
0
    core::array::from_fn(|i| {
46
0
        let chunk = block[8 * i..][..8].try_into().unwrap();
47
0
        u64::from_be_bytes(chunk)
48
0
    })
49
0
}
50
51
/// Raw SHA-512 compression function.
52
///
53
/// This is a low-level "hazmat" API which provides direct access to the core
54
/// functionality of SHA-512.
55
0
pub fn compress512(state: &mut [u64; 8], blocks: &[[u8; 128]]) {
56
0
    compress(state, blocks)
57
0
}