summaryrefslogtreecommitdiffstats
path: root/third_party/heimdal/lib/hcrypto/des-tables.h
blob: 95f371174756805ec574872a4648aaba26349e5a (plain)
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/* GENERATE FILE from gen-des.pl, do not edit */

/* pc1_c_3 bit pattern 5 13 21 */
static int pc1_c_3[8] = {
    0x00000000, 0x00000010, 0x00001000, 0x00001010,
    0x00100000, 0x00100010, 0x00101000, 0x00101010
};
/* pc1_c_4 bit pattern 1 9 17 25 */
static int pc1_c_4[16] = {
    0x00000000, 0x00000001, 0x00000100, 0x00000101,
    0x00010000, 0x00010001, 0x00010100, 0x00010101,
    0x01000000, 0x01000001, 0x01000100, 0x01000101,
    0x01010000, 0x01010001, 0x01010100, 0x01010101
};
/* pc1_d_3 bit pattern 49 41 33 */
static int pc1_d_3[8] = {
    0x00000000, 0x01000000, 0x00010000, 0x01010000,
    0x00000100, 0x01000100, 0x00010100, 0x01010100
};
/* pc1_d_4 bit pattern 57 53 45 37 */
static int pc1_d_4[16] = {
    0x00000000, 0x00100000, 0x00001000, 0x00101000,
    0x00000010, 0x00100010, 0x00001010, 0x00101010,
    0x00000001, 0x00100001, 0x00001001, 0x00101001,
    0x00000011, 0x00100011, 0x00001011, 0x00101011
};
/* pc2_c_1 bit pattern 5 24 7 16 6 10 */
static int pc2_c_1[64] = {
    0x00000000, 0x00004000, 0x00040000, 0x00044000,
    0x00000100, 0x00004100, 0x00040100, 0x00044100,
    0x00020000, 0x00024000, 0x00060000, 0x00064000,
    0x00020100, 0x00024100, 0x00060100, 0x00064100,
    0x00000001, 0x00004001, 0x00040001, 0x00044001,
    0x00000101, 0x00004101, 0x00040101, 0x00044101,
    0x00020001, 0x00024001, 0x00060001, 0x00064001,
    0x00020101, 0x00024101, 0x00060101, 0x00064101,
    0x00080000, 0x00084000, 0x000c0000, 0x000c4000,
    0x00080100, 0x00084100, 0x000c0100, 0x000c4100,
    0x000a0000, 0x000a4000, 0x000e0000, 0x000e4000,
    0x000a0100, 0x000a4100, 0x000e0100, 0x000e4100,
    0x00080001, 0x00084001, 0x000c0001, 0x000c4001,
    0x00080101, 0x00084101, 0x000c0101, 0x000c4101,
    0x000a0001, 0x000a4001, 0x000e0001, 0x000e4001,
    0x000a0101, 0x000a4101, 0x000e0101, 0x000e4101
};
/* pc2_c_2 bit pattern 20 18 12 3 15 23 */
static int pc2_c_2[64] = {
    0x00000000, 0x00000002, 0x00000200, 0x00000202,
    0x00200000, 0x00200002, 0x00200200, 0x00200202,
    0x00001000, 0x00001002, 0x00001200, 0x00001202,
    0x00201000, 0x00201002, 0x00201200, 0x00201202,
    0x00000040, 0x00000042, 0x00000240, 0x00000242,
    0x00200040, 0x00200042, 0x00200240, 0x00200242,
    0x00001040, 0x00001042, 0x00001240, 0x00001242,
    0x00201040, 0x00201042, 0x00201240, 0x00201242,
    0x00000010, 0x00000012, 0x00000210, 0x00000212,
    0x00200010, 0x00200012, 0x00200210, 0x00200212,
    0x00001010, 0x00001012, 0x00001210, 0x00001212,
    0x00201010, 0x00201012, 0x00201210, 0x00201212,
    0x00000050, 0x00000052, 0x00000250, 0x00000252,
    0x00200050, 0x00200052, 0x00200250, 0x00200252,
    0x00001050, 0x00001052, 0x00001250, 0x00001252,
    0x00201050, 0x00201052, 0x00201250, 0x00201252
};
/* pc2_c_3 bit pattern 1 9 19 2 14 22 */
static int pc2_c_3[64] = {
    0x00000000, 0x00000004, 0x00000400, 0x00000404,
    0x00400000, 0x00400004, 0x00400400, 0x00400404,
    0x00000020, 0x00000024, 0x00000420, 0x00000424,
    0x00400020, 0x00400024, 0x00400420, 0x00400424,
    0x00008000, 0x00008004, 0x00008400, 0x00008404,
    0x00408000, 0x00408004, 0x00408400, 0x00408404,
    0x00008020, 0x00008024, 0x00008420, 0x00008424,
    0x00408020, 0x00408024, 0x00408420, 0x00408424,
    0x00800000, 0x00800004, 0x00800400, 0x00800404,
    0x00c00000, 0x00c00004, 0x00c00400, 0x00c00404,
    0x00800020, 0x00800024, 0x00800420, 0x00800424,
    0x00c00020, 0x00c00024, 0x00c00420, 0x00c00424,
    0x00808000, 0x00808004, 0x00808400, 0x00808404,
    0x00c08000, 0x00c08004, 0x00c08400, 0x00c08404,
    0x00808020, 0x00808024, 0x00808420, 0x00808424,
    0x00c08020, 0x00c08024, 0x00c08420, 0x00c08424
};
/* pc2_c_4 bit pattern 11 13 4 17 21 8 */
static int pc2_c_4[64] = {
    0x00000000, 0x00010000, 0x00000008, 0x00010008,
    0x00000080, 0x00010080, 0x00000088, 0x00010088,
    0x00100000, 0x00110000, 0x00100008, 0x00110008,
    0x00100080, 0x00110080, 0x00100088, 0x00110088,
    0x00000800, 0x00010800, 0x00000808, 0x00010808,
    0x00000880, 0x00010880, 0x00000888, 0x00010888,
    0x00100800, 0x00110800, 0x00100808, 0x00110808,
    0x00100880, 0x00110880, 0x00100888, 0x00110888,
    0x00002000, 0x00012000, 0x00002008, 0x00012008,
    0x00002080, 0x00012080, 0x00002088, 0x00012088,
    0x00102000, 0x00112000, 0x00102008, 0x00112008,
    0x00102080, 0x00112080, 0x00102088, 0x00112088,
    0x00002800, 0x00012800, 0x00002808, 0x00012808,
    0x00002880, 0x00012880, 0x00002888, 0x00012888,
    0x00102800, 0x00112800, 0x00102808, 0x00112808,
    0x00102880, 0x00112880, 0x00102888, 0x00112888
};
/* pc2_d_1 bit pattern 51 35 31 52 39 45 */
static int pc2_d_1[64] = {
    0x00000000, 0x00000080, 0x00002000, 0x00002080,
    0x00000001, 0x00000081, 0x00002001, 0x00002081,
    0x00200000, 0x00200080, 0x00202000, 0x00202080,
    0x00200001, 0x00200081, 0x00202001, 0x00202081,
    0x00020000, 0x00020080, 0x00022000, 0x00022080,
    0x00020001, 0x00020081, 0x00022001, 0x00022081,
    0x00220000, 0x00220080, 0x00222000, 0x00222080,
    0x00220001, 0x00220081, 0x00222001, 0x00222081,
    0x00000002, 0x00000082, 0x00002002, 0x00002082,
    0x00000003, 0x00000083, 0x00002003, 0x00002083,
    0x00200002, 0x00200082, 0x00202002, 0x00202082,
    0x00200003, 0x00200083, 0x00202003, 0x00202083,
    0x00020002, 0x00020082, 0x00022002, 0x00022082,
    0x00020003, 0x00020083, 0x00022003, 0x00022083,
    0x00220002, 0x00220082, 0x00222002, 0x00222082,
    0x00220003, 0x00220083, 0x00222003, 0x00222083
};
/* pc2_d_2 bit pattern 50 32 43 36 29 48 */
static int pc2_d_2[64] = {
    0x00000000, 0x00000010, 0x00800000, 0x00800010,
    0x00010000, 0x00010010, 0x00810000, 0x00810010,
    0x00000200, 0x00000210, 0x00800200, 0x00800210,
    0x00010200, 0x00010210, 0x00810200, 0x00810210,
    0x00100000, 0x00100010, 0x00900000, 0x00900010,
    0x00110000, 0x00110010, 0x00910000, 0x00910010,
    0x00100200, 0x00100210, 0x00900200, 0x00900210,
    0x00110200, 0x00110210, 0x00910200, 0x00910210,
    0x00000004, 0x00000014, 0x00800004, 0x00800014,
    0x00010004, 0x00010014, 0x00810004, 0x00810014,
    0x00000204, 0x00000214, 0x00800204, 0x00800214,
    0x00010204, 0x00010214, 0x00810204, 0x00810214,
    0x00100004, 0x00100014, 0x00900004, 0x00900014,
    0x00110004, 0x00110014, 0x00910004, 0x00910014,
    0x00100204, 0x00100214, 0x00900204, 0x00900214,
    0x00110204, 0x00110214, 0x00910204, 0x00910214
};
/* pc2_d_3 bit pattern 41 38 47 33 40 42 */
static int pc2_d_3[64] = {
    0x00000000, 0x00000400, 0x00001000, 0x00001400,
    0x00080000, 0x00080400, 0x00081000, 0x00081400,
    0x00000020, 0x00000420, 0x00001020, 0x00001420,
    0x00080020, 0x00080420, 0x00081020, 0x00081420,
    0x00004000, 0x00004400, 0x00005000, 0x00005400,
    0x00084000, 0x00084400, 0x00085000, 0x00085400,
    0x00004020, 0x00004420, 0x00005020, 0x00005420,
    0x00084020, 0x00084420, 0x00085020, 0x00085420,
    0x00000800, 0x00000c00, 0x00001800, 0x00001c00,
    0x00080800, 0x00080c00, 0x00081800, 0x00081c00,
    0x00000820, 0x00000c20, 0x00001820, 0x00001c20,
    0x00080820, 0x00080c20, 0x00081820, 0x00081c20,
    0x00004800, 0x00004c00, 0x00005800, 0x00005c00,
    0x00084800, 0x00084c00, 0x00085800, 0x00085c00,
    0x00004820, 0x00004c20, 0x00005820, 0x00005c20,
    0x00084820, 0x00084c20, 0x00085820, 0x00085c20
};
/* pc2_d_4 bit pattern 49 37 30 46 34 44 */
static int pc2_d_4[64] = {
    0x00000000, 0x00000100, 0x00040000, 0x00040100,
    0x00000040, 0x00000140, 0x00040040, 0x00040140,
    0x00400000, 0x00400100, 0x00440000, 0x00440100,
    0x00400040, 0x00400140, 0x00440040, 0x00440140,
    0x00008000, 0x00008100, 0x00048000, 0x00048100,
    0x00008040, 0x00008140, 0x00048040, 0x00048140,
    0x00408000, 0x00408100, 0x00448000, 0x00448100,
    0x00408040, 0x00408140, 0x00448040, 0x00448140,
    0x00000008, 0x00000108, 0x00040008, 0x00040108,
    0x00000048, 0x00000148, 0x00040048, 0x00040148,
    0x00400008, 0x00400108, 0x00440008, 0x00440108,
    0x00400048, 0x00400148, 0x00440048, 0x00440148,
    0x00008008, 0x00008108, 0x00048008, 0x00048108,
    0x00008048, 0x00008148, 0x00048048, 0x00048148,
    0x00408008, 0x00408108, 0x00448008, 0x00448108,
    0x00408048, 0x00408148, 0x00448048, 0x00448148
};
static unsigned char odd_parity[256] = {
  1,  1,  2,  2,  4,  4,  7,  7,  8,  8, 11, 11, 13, 13, 14, 14,
 16, 16, 19, 19, 21, 21, 22, 22, 25, 25, 26, 26, 28, 28, 31, 31,
 32, 32, 35, 35, 37, 37, 38, 38, 41, 41, 42, 42, 44, 44, 47, 47,
 49, 49, 50, 50, 52, 52, 55, 55, 56, 56, 59, 59, 61, 61, 62, 62,
 64, 64, 67, 67, 69, 69, 70, 70, 73, 73, 74, 74, 76, 76, 79, 79,
 81, 81, 82, 82, 84, 84, 87, 87, 88, 88, 91, 91, 93, 93, 94, 94,
 97, 97, 98, 98,100,100,103,103,104,104,107,107,109,109,110,110,
112,112,115,115,117,117,118,118,121,121,122,122,124,124,127,127,
128,128,131,131,133,133,134,134,137,137,138,138,140,140,143,143,
145,145,146,146,148,148,151,151,152,152,155,155,157,157,158,158,
161,161,162,162,164,164,167,167,168,168,171,171,173,173,174,174,
176,176,179,179,181,181,182,182,185,185,186,186,188,188,191,191,
193,193,194,194,196,196,199,199,200,200,203,203,205,205,206,206,
208,208,211,211,213,213,214,214,217,217,218,218,220,220,223,223,
224,224,227,227,229,229,230,230,233,233,234,234,236,236,239,239,
241,241,242,242,244,244,247,247,248,248,251,251,253,253,254,254,
 };