threefish/
consts.rs

1#![allow(clippy::unreadable_literal)]
2
3// Magic constant for key schedule
4pub const C240: u64 = 0x1BD11BDAA9FC1A22;
5
6// Rotation constants for the different key lengths
7pub const R256: [[u8; 2]; 8] = [
8    [14, 16],
9    [52, 57],
10    [23, 40],
11    [5, 37],
12    [25, 33],
13    [46, 12],
14    [58, 22],
15    [32, 32],
16];
17
18pub const R512: [[u8; 4]; 8] = [
19    [46, 36, 19, 37],
20    [33, 27, 14, 42],
21    [17, 49, 36, 39],
22    [44, 9, 54, 56],
23    [39, 30, 34, 24],
24    [13, 50, 10, 17],
25    [25, 29, 39, 43],
26    [8, 35, 56, 22],
27];
28
29pub const R1024: [[u8; 8]; 8] = [
30    [24, 13, 8, 47, 8, 17, 22, 37],
31    [38, 19, 10, 55, 49, 18, 23, 52],
32    [33, 4, 51, 13, 34, 41, 59, 17],
33    [5, 20, 48, 41, 47, 28, 16, 25],
34    [41, 9, 37, 31, 12, 47, 44, 30],
35    [16, 34, 56, 51, 4, 53, 42, 41],
36    [31, 44, 47, 46, 19, 42, 44, 25],
37    [9, 48, 35, 52, 23, 31, 37, 20],
38];
39
40// Permutation tables for the different key lengths
41pub const P256: [u8; 4] = [0, 3, 2, 1];
42pub const P512: [u8; 8] = [6, 1, 0, 7, 2, 5, 4, 3];
43pub const P1024: [u8; 16] = [0, 15, 2, 11, 6, 13, 4, 9, 14, 1, 8, 5, 10, 3, 12, 7];