1use crate::consts::F1600_ROUNDS;
3use crate::types::*;
4#[cfg(feature = "parallel")]
5use hybrid_array::ArraySize;
6
7#[cfg(target_arch = "aarch64")]
8pub(crate) mod aarch64_sha3;
9#[cfg(any(
10 keccak_backend = "simd128",
11 keccak_backend = "simd256",
12 keccak_backend = "simd512",
13))]
14pub(crate) mod simd;
15pub(crate) mod soft;
16
17pub trait BackendClosure {
19 fn call_once<B: Backend>(self);
21}
22
23pub trait Backend {
25 #[cfg(feature = "parallel")]
27 type ParSize1600: ArraySize;
28
29 #[must_use]
34 fn get_p1600<const ROUNDS: usize>() -> Fn1600;
35
36 #[cfg(feature = "parallel")]
41 #[inline]
42 #[must_use]
43 fn get_par_p1600<const ROUNDS: usize>() -> ParFn1600<Self> {
44 |par_state| par_state.iter_mut().for_each(Self::get_p1600::<ROUNDS>())
45 }
46
47 #[must_use]
49 fn get_f1600() -> Fn1600 {
50 Self::get_p1600::<F1600_ROUNDS>()
51 }
52
53 #[cfg(feature = "parallel")]
55 #[inline]
56 #[must_use]
57 fn get_par_f1600() -> ParFn1600<Self> {
58 Self::get_par_p1600::<F1600_ROUNDS>()
59 }
60}