-
Notifications
You must be signed in to change notification settings - Fork 0
/
des_s_p.h
142 lines (141 loc) · 6.34 KB
/
des_s_p.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/*
* s_p.h - contains combined Sbox and P permutation table
*/
static unsigned long S_P[8][64] = {
/* SBOX 1 */
0x820200, 0x20000, 0x80800000, 0x80820200,
0x800000, 0x80020200, 0x80020000, 0x80800000,
0x80020200, 0x820200, 0x820000, 0x80000200,
0x80800200, 0x800000, 0, 0x80020000,
0x20000, 0x80000000, 0x800200, 0x20200,
0x80820200, 0x820000, 0x80000200, 0x800200,
0x80000000, 0x200, 0x20200, 0x80820000,
0x200, 0x80800200, 0x80820000, 0,
0, 0x80820200, 0x800200, 0x80020000,
0x820200, 0x20000, 0x80000200, 0x800200,
0x80820000, 0x200, 0x20200, 0x80800000,
0x80020200, 0x80000000, 0x80800000, 0x820000,
0x80820200, 0x20200, 0x820000, 0x80800200,
0x800000, 0x80000200, 0x80020000, 0,
0x20000, 0x800000, 0x80800200, 0x820200,
0x80000000, 0x80820000, 0x200, 0x80020200,
/* SBOX 2 */
0x10042004, 0, 0x42000, 0x10040000,
0x10000004, 0x2004, 0x10002000, 0x42000,
0x2000, 0x10040004, 0x4, 0x10002000,
0x40004, 0x10042000, 0x10040000, 0x4,
0x40000, 0x10002004, 0x10040004, 0x2000,
0x42004, 0x10000000, 0, 0x40004,
0x10002004, 0x42004, 0x10042000, 0x10000004,
0x10000000, 0x40000, 0x2004, 0x10042004,
0x40004, 0x10042000, 0x10002000, 0x42004,
0x10042004, 0x40004, 0x10000004, 0,
0x10000000, 0x2004, 0x40000, 0x10040004,
0x2000, 0x10000000, 0x42004, 0x10002004,
0x10042000, 0x2000, 0, 0x10000004,
0x4, 0x10042004, 0x42000, 0x10040000,
0x10040004, 0x40000, 0x2004, 0x10002000,
0x10002004, 0x4, 0x10040000, 0x42000,
/* SBOX 3 */
0x41000000, 0x1010040, 0x40, 0x41000040,
0x40010000, 0x1000000, 0x41000040, 0x10040,
0x1000040, 0x10000, 0x1010000, 0x40000000,
0x41010040, 0x40000040, 0x40000000, 0x41010000,
0, 0x40010000, 0x1010040, 0x40,
0x40000040, 0x41010040, 0x10000, 0x41000000,
0x41010000, 0x1000040, 0x40010040, 0x1010000,
0x10040, 0, 0x1000000, 0x40010040,
0x1010040, 0x40, 0x40000000, 0x10000,
0x40000040, 0x40010000, 0x1010000, 0x41000040,
0, 0x1010040, 0x10040, 0x41010000,
0x40010000, 0x1000000, 0x41010040, 0x40000000,
0x40010040, 0x41000000, 0x1000000, 0x41010040,
0x10000, 0x1000040, 0x41000040, 0x10040,
0x1000040, 0, 0x41010000, 0x40000040,
0x41000000, 0x40010040, 0x40, 0x1010000,
/* SBOX 4 */
0x100402, 0x4000400, 0x2, 0x4100402,
0, 0x4100000, 0x4000402, 0x100002,
0x4100400, 0x4000002, 0x4000000, 0x402,
0x4000002, 0x100402, 0x100000, 0x4000000,
0x4100002, 0x100400, 0x400, 0x2,
0x100400, 0x4000402, 0x4100000, 0x400,
0x402, 0, 0x100002, 0x4100400,
0x4000400, 0x4100002, 0x4100402, 0x100000,
0x4100002, 0x402, 0x100000, 0x4000002,
0x100400, 0x4000400, 0x2, 0x4100000,
0x4000402, 0, 0x400, 0x100002,
0, 0x4100002, 0x4100400, 0x400,
0x4000000, 0x4100402, 0x100402, 0x100000,
0x4100402, 0x2, 0x4000400, 0x100402,
0x100002, 0x100400, 0x4100000, 0x4000402,
0x402, 0x4000000, 0x4000002, 0x4100400,
/* SBOX 5 */
0x2000000, 0x4000, 0x100, 0x2004108,
0x2004008, 0x2000100, 0x4108, 0x2004000,
0x4000, 0x8, 0x2000008, 0x4100,
0x2000108, 0x2004008, 0x2004100, 0,
0x4100, 0x2000000, 0x4008, 0x108,
0x2000100, 0x4108, 0, 0x2000008,
0x8, 0x2000108, 0x2004108, 0x4008,
0x2004000, 0x100, 0x108, 0x2004100,
0x2004100, 0x2000108, 0x4008, 0x2004000,
0x4000, 0x8, 0x2000008, 0x2000100,
0x2000000, 0x4100, 0x2004108, 0,
0x4108, 0x2000000, 0x100, 0x4008,
0x2000108, 0x100, 0, 0x2004108,
0x2004008, 0x2004100, 0x108, 0x4000,
0x4100, 0x2004008, 0x2000100, 0x108,
0x8, 0x4108, 0x2004000, 0x2000008,
/* SBOX 6 */
0x20000010, 0x80010, 0, 0x20080800,
0x80010, 0x800, 0x20000810, 0x80000,
0x810, 0x20080810, 0x80800, 0x20000000,
0x20000800, 0x20000010, 0x20080000, 0x80810,
0x80000, 0x20000810, 0x20080010, 0,
0x800, 0x10, 0x20080800, 0x20080010,
0x20080810, 0x20080000, 0x20000000, 0x810,
0x10, 0x80800, 0x80810, 0x20000800,
0x810, 0x20000000, 0x20000800, 0x80810,
0x20080800, 0x80010, 0, 0x20000800,
0x20000000, 0x800, 0x20080010, 0x80000,
0x80010, 0x20080810, 0x80800, 0x10,
0x20080810, 0x80800, 0x80000, 0x20000810,
0x20000010, 0x20080000, 0x80810, 0,
0x800, 0x20000010, 0x20000810, 0x20080800,
0x20080000, 0x810, 0x10, 0x20080010,
/* SBOX 7 */
0x1000, 0x80, 0x400080, 0x400001,
0x401081, 0x1001, 0x1080, 0,
0x400000, 0x400081, 0x81, 0x401000,
0x1, 0x401080, 0x401000, 0x81,
0x400081, 0x1000, 0x1001, 0x401081,
0, 0x400080, 0x400001, 0x1080,
0x401001, 0x1081, 0x401080, 0x1,
0x1081, 0x401001, 0x80, 0x400000,
0x1081, 0x401000, 0x401001, 0x81,
0x1000, 0x80, 0x400000, 0x401001,
0x400081, 0x1081, 0x1080, 0,
0x80, 0x400001, 0x1, 0x400080,
0, 0x400081, 0x400080, 0x1080,
0x81, 0x1000, 0x401081, 0x400000,
0x401080, 0x1, 0x1001, 0x401081,
0x400001, 0x401080, 0x401000, 0x1001,
/* SBOX 8 */
0x8200020, 0x8208000, 0x8020, 0,
0x8008000, 0x200020, 0x8200000, 0x8208020,
0x20, 0x8000000, 0x208000, 0x8020,
0x208020, 0x8008020, 0x8000020, 0x8200000,
0x8000, 0x208020, 0x200020, 0x8008000,
0x8208020, 0x8000020, 0, 0x208000,
0x8000000, 0x200000, 0x8008020, 0x8200020,
0x200000, 0x8000, 0x8208000, 0x20,
0x200000, 0x8000, 0x8000020, 0x8208020,
0x8020, 0x8000000, 0, 0x208000,
0x8200020, 0x8008020, 0x8008000, 0x200020,
0x8208000, 0x20, 0x200020, 0x8008000,
0x8208020, 0x200000, 0x8200000, 0x8000020,
0x208000, 0x8020, 0x8008020, 0x8200000,
0x20, 0x8208000, 0x208020, 0,
0x8000000, 0x8200020, 0x8000, 0x208020,
};