Skip to main content

keccak/
consts.rs

1//! Constants used by the Keccak functions.
2
3/// Length of permuted state.
4pub const PLEN: usize = 25;
5
6/// Number of rounds used by the `f200` function.
7pub const F200_ROUNDS: usize = 18;
8/// Number of rounds used by the `f400` function.
9pub const F400_ROUNDS: usize = 20;
10/// Number of rounds used by the `f800` function.
11pub const F800_ROUNDS: usize = 22;
12/// Number of rounds used by the `f1600` function.
13pub const F1600_ROUNDS: usize = 24;
14
15pub(crate) const RHO: [u32; 24] = [
16    1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 2, 14, 27, 41, 56, 8, 25, 43, 62, 18, 39, 61, 20, 44,
17];
18
19pub(crate) const PI: [usize; 24] = [
20    10, 7, 11, 17, 18, 3, 5, 16, 8, 21, 24, 4, 15, 23, 19, 13, 12, 2, 20, 14, 22, 9, 6, 1,
21];
22
23pub(crate) const RC: [u64; 24] = [
24    0x0000000000000001,
25    0x0000000000008082,
26    0x800000000000808a,
27    0x8000000080008000,
28    0x000000000000808b,
29    0x0000000080000001,
30    0x8000000080008081,
31    0x8000000000008009,
32    0x000000000000008a,
33    0x0000000000000088,
34    0x0000000080008009,
35    0x000000008000000a,
36    0x000000008000808b,
37    0x800000000000008b,
38    0x8000000000008089,
39    0x8000000000008003,
40    0x8000000000008002,
41    0x8000000000000080,
42    0x000000000000800a,
43    0x800000008000000a,
44    0x8000000080008081,
45    0x8000000000008080,
46    0x0000000080000001,
47    0x8000000080008008,
48];