sha_crypt/
defs.rs

1/// Block size for SHA256
2pub const BLOCK_SIZE_SHA256: usize = 32;
3
4/// Block size for SHA512
5pub const BLOCK_SIZE_SHA512: usize = 64;
6
7/// PWD part length of the password string of SHA256
8pub const PW_SIZE_SHA256: usize = 43;
9
10/// PWD part length of the password string of SHA512
11pub const PW_SIZE_SHA512: usize = 86;
12
13/// Maximum length of a salt
14#[cfg(feature = "simple")]
15pub const SALT_MAX_LEN: usize = 16;
16
17/// Encoding table.
18#[cfg(feature = "simple")]
19pub static TAB: &[u8] = b"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
20
21/// Inverse encoding map for SHA512.
22#[rustfmt::skip]
23pub const MAP_SHA512: [u8; 64] = [
24    42, 21, 0,
25    1, 43, 22,
26    23, 2, 44,
27    45, 24, 3,
28    4, 46, 25,
29    26, 5, 47,
30    48, 27, 6,
31    7, 49, 28,
32    29, 8, 50,
33    51, 30, 9,
34    10, 52, 31,
35    32, 11, 53,
36    54, 33, 12,
37    13, 55, 34,
38    35, 14, 56,
39    57, 36, 15,
40    16, 58, 37,
41    38, 17, 59,
42    60, 39, 18,
43    19, 61, 40,
44    41, 20, 62,
45    63,
46];
47
48/// Inverse encoding map for SHA256.
49#[rustfmt::skip]
50pub const MAP_SHA256: [u8; 32] = [
51    20, 10, 0,
52    11, 1, 21,
53    2, 22, 12,
54    23, 13, 3,
55    14, 4, 24,
56    5, 25, 15,
57    26, 16, 6,
58    17, 7, 27,
59    8, 28, 18,
60    29, 19, 9,
61    30, 31,
62];