sha3 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sha3 might be problematic. Click here for more details.

@@ -11,10 +11,16 @@ and related or neighboring rights to the source code in this file.
11
11
  http://creativecommons.org/publicdomain/zero/1.0/
12
12
  */
13
13
 
14
- #ifndef _KeccakPermutationReference_h_
15
- #define _KeccakPermutationReference_h_
16
-
17
- void displayRoundConstants(FILE *f);
18
- void displayRhoOffsets(FILE *f);
19
-
14
+ #ifdef UseSchedule
15
+ #if (UseSchedule == 1)
16
+ #include "KeccakF-1600-32-s1.macros"
17
+ #elif (UseSchedule == 2)
18
+ #include "KeccakF-1600-32-s2.macros"
19
+ #elif (UseSchedule == 3)
20
+ #include "KeccakF-1600-32-rvk.macros"
21
+ #else
22
+ #error "This schedule is not supported."
23
+ #endif
24
+ #else
25
+ #include "KeccakF-1600-32-s1.macros"
20
26
  #endif
@@ -0,0 +1,728 @@
1
+ /*
2
+ Code automatically generated by KeccakTools!
3
+
4
+ The Keccak sponge function, designed by Guido Bertoni, Joan Daemen,
5
+ Michaël Peeters and Gilles Van Assche. For more information, feedback or
6
+ questions, please refer to our website: http://keccak.noekeon.org/
7
+
8
+ Implementation by the designers,
9
+ hereby denoted as "the implementer".
10
+
11
+ To the extent possible under law, the implementer has waived all copyright
12
+ and related or neighboring rights to the source code in this file.
13
+ http://creativecommons.org/publicdomain/zero/1.0/
14
+ */
15
+
16
+ #define declareABCDE \
17
+ UINT64 Aba, Abe, Abi, Abo, Abu; \
18
+ UINT64 Aga, Age, Agi, Ago, Agu; \
19
+ UINT64 Aka, Ake, Aki, Ako, Aku; \
20
+ UINT64 Ama, Ame, Ami, Amo, Amu; \
21
+ UINT64 Asa, Ase, Asi, Aso, Asu; \
22
+ UINT64 Bba, Bbe, Bbi, Bbo, Bbu; \
23
+ UINT64 Bga, Bge, Bgi, Bgo, Bgu; \
24
+ UINT64 Bka, Bke, Bki, Bko, Bku; \
25
+ UINT64 Bma, Bme, Bmi, Bmo, Bmu; \
26
+ UINT64 Bsa, Bse, Bsi, Bso, Bsu; \
27
+ UINT64 Ca, Ce, Ci, Co, Cu; \
28
+ UINT64 Da, De, Di, Do, Du; \
29
+ UINT64 Eba, Ebe, Ebi, Ebo, Ebu; \
30
+ UINT64 Ega, Ege, Egi, Ego, Egu; \
31
+ UINT64 Eka, Eke, Eki, Eko, Eku; \
32
+ UINT64 Ema, Eme, Emi, Emo, Emu; \
33
+ UINT64 Esa, Ese, Esi, Eso, Esu; \
34
+
35
+ #define prepareTheta \
36
+ Ca = Aba^Aga^Aka^Ama^Asa; \
37
+ Ce = Abe^Age^Ake^Ame^Ase; \
38
+ Ci = Abi^Agi^Aki^Ami^Asi; \
39
+ Co = Abo^Ago^Ako^Amo^Aso; \
40
+ Cu = Abu^Agu^Aku^Amu^Asu; \
41
+
42
+ #ifdef UseBebigokimisa
43
+ // --- Code for round, with prepare-theta (lane complementing pattern 'bebigokimisa')
44
+ // --- 64-bit lanes mapped to 64-bit words
45
+ #define thetaRhoPiChiIotaPrepareTheta(i, A, E) \
46
+ Da = Cu^ROL64(Ce, 1); \
47
+ De = Ca^ROL64(Ci, 1); \
48
+ Di = Ce^ROL64(Co, 1); \
49
+ Do = Ci^ROL64(Cu, 1); \
50
+ Du = Co^ROL64(Ca, 1); \
51
+ \
52
+ A##ba ^= Da; \
53
+ Bba = A##ba; \
54
+ A##ge ^= De; \
55
+ Bbe = ROL64(A##ge, 44); \
56
+ A##ki ^= Di; \
57
+ Bbi = ROL64(A##ki, 43); \
58
+ A##mo ^= Do; \
59
+ Bbo = ROL64(A##mo, 21); \
60
+ A##su ^= Du; \
61
+ Bbu = ROL64(A##su, 14); \
62
+ E##ba = Bba ^( Bbe | Bbi ); \
63
+ E##ba ^= KeccakF1600RoundConstants[i]; \
64
+ Ca = E##ba; \
65
+ E##be = Bbe ^((~Bbi)| Bbo ); \
66
+ Ce = E##be; \
67
+ E##bi = Bbi ^( Bbo & Bbu ); \
68
+ Ci = E##bi; \
69
+ E##bo = Bbo ^( Bbu | Bba ); \
70
+ Co = E##bo; \
71
+ E##bu = Bbu ^( Bba & Bbe ); \
72
+ Cu = E##bu; \
73
+ \
74
+ A##bo ^= Do; \
75
+ Bga = ROL64(A##bo, 28); \
76
+ A##gu ^= Du; \
77
+ Bge = ROL64(A##gu, 20); \
78
+ A##ka ^= Da; \
79
+ Bgi = ROL64(A##ka, 3); \
80
+ A##me ^= De; \
81
+ Bgo = ROL64(A##me, 45); \
82
+ A##si ^= Di; \
83
+ Bgu = ROL64(A##si, 61); \
84
+ E##ga = Bga ^( Bge | Bgi ); \
85
+ Ca ^= E##ga; \
86
+ E##ge = Bge ^( Bgi & Bgo ); \
87
+ Ce ^= E##ge; \
88
+ E##gi = Bgi ^( Bgo |(~Bgu)); \
89
+ Ci ^= E##gi; \
90
+ E##go = Bgo ^( Bgu | Bga ); \
91
+ Co ^= E##go; \
92
+ E##gu = Bgu ^( Bga & Bge ); \
93
+ Cu ^= E##gu; \
94
+ \
95
+ A##be ^= De; \
96
+ Bka = ROL64(A##be, 1); \
97
+ A##gi ^= Di; \
98
+ Bke = ROL64(A##gi, 6); \
99
+ A##ko ^= Do; \
100
+ Bki = ROL64(A##ko, 25); \
101
+ A##mu ^= Du; \
102
+ Bko = ROL64(A##mu, 8); \
103
+ A##sa ^= Da; \
104
+ Bku = ROL64(A##sa, 18); \
105
+ E##ka = Bka ^( Bke | Bki ); \
106
+ Ca ^= E##ka; \
107
+ E##ke = Bke ^( Bki & Bko ); \
108
+ Ce ^= E##ke; \
109
+ E##ki = Bki ^((~Bko)& Bku ); \
110
+ Ci ^= E##ki; \
111
+ E##ko = (~Bko)^( Bku | Bka ); \
112
+ Co ^= E##ko; \
113
+ E##ku = Bku ^( Bka & Bke ); \
114
+ Cu ^= E##ku; \
115
+ \
116
+ A##bu ^= Du; \
117
+ Bma = ROL64(A##bu, 27); \
118
+ A##ga ^= Da; \
119
+ Bme = ROL64(A##ga, 36); \
120
+ A##ke ^= De; \
121
+ Bmi = ROL64(A##ke, 10); \
122
+ A##mi ^= Di; \
123
+ Bmo = ROL64(A##mi, 15); \
124
+ A##so ^= Do; \
125
+ Bmu = ROL64(A##so, 56); \
126
+ E##ma = Bma ^( Bme & Bmi ); \
127
+ Ca ^= E##ma; \
128
+ E##me = Bme ^( Bmi | Bmo ); \
129
+ Ce ^= E##me; \
130
+ E##mi = Bmi ^((~Bmo)| Bmu ); \
131
+ Ci ^= E##mi; \
132
+ E##mo = (~Bmo)^( Bmu & Bma ); \
133
+ Co ^= E##mo; \
134
+ E##mu = Bmu ^( Bma | Bme ); \
135
+ Cu ^= E##mu; \
136
+ \
137
+ A##bi ^= Di; \
138
+ Bsa = ROL64(A##bi, 62); \
139
+ A##go ^= Do; \
140
+ Bse = ROL64(A##go, 55); \
141
+ A##ku ^= Du; \
142
+ Bsi = ROL64(A##ku, 39); \
143
+ A##ma ^= Da; \
144
+ Bso = ROL64(A##ma, 41); \
145
+ A##se ^= De; \
146
+ Bsu = ROL64(A##se, 2); \
147
+ E##sa = Bsa ^((~Bse)& Bsi ); \
148
+ Ca ^= E##sa; \
149
+ E##se = (~Bse)^( Bsi | Bso ); \
150
+ Ce ^= E##se; \
151
+ E##si = Bsi ^( Bso & Bsu ); \
152
+ Ci ^= E##si; \
153
+ E##so = Bso ^( Bsu | Bsa ); \
154
+ Co ^= E##so; \
155
+ E##su = Bsu ^( Bsa & Bse ); \
156
+ Cu ^= E##su; \
157
+ \
158
+
159
+ // --- Code for round (lane complementing pattern 'bebigokimisa')
160
+ // --- 64-bit lanes mapped to 64-bit words
161
+ #define thetaRhoPiChiIota(i, A, E) \
162
+ Da = Cu^ROL64(Ce, 1); \
163
+ De = Ca^ROL64(Ci, 1); \
164
+ Di = Ce^ROL64(Co, 1); \
165
+ Do = Ci^ROL64(Cu, 1); \
166
+ Du = Co^ROL64(Ca, 1); \
167
+ \
168
+ A##ba ^= Da; \
169
+ Bba = A##ba; \
170
+ A##ge ^= De; \
171
+ Bbe = ROL64(A##ge, 44); \
172
+ A##ki ^= Di; \
173
+ Bbi = ROL64(A##ki, 43); \
174
+ A##mo ^= Do; \
175
+ Bbo = ROL64(A##mo, 21); \
176
+ A##su ^= Du; \
177
+ Bbu = ROL64(A##su, 14); \
178
+ E##ba = Bba ^( Bbe | Bbi ); \
179
+ E##ba ^= KeccakF1600RoundConstants[i]; \
180
+ E##be = Bbe ^((~Bbi)| Bbo ); \
181
+ E##bi = Bbi ^( Bbo & Bbu ); \
182
+ E##bo = Bbo ^( Bbu | Bba ); \
183
+ E##bu = Bbu ^( Bba & Bbe ); \
184
+ \
185
+ A##bo ^= Do; \
186
+ Bga = ROL64(A##bo, 28); \
187
+ A##gu ^= Du; \
188
+ Bge = ROL64(A##gu, 20); \
189
+ A##ka ^= Da; \
190
+ Bgi = ROL64(A##ka, 3); \
191
+ A##me ^= De; \
192
+ Bgo = ROL64(A##me, 45); \
193
+ A##si ^= Di; \
194
+ Bgu = ROL64(A##si, 61); \
195
+ E##ga = Bga ^( Bge | Bgi ); \
196
+ E##ge = Bge ^( Bgi & Bgo ); \
197
+ E##gi = Bgi ^( Bgo |(~Bgu)); \
198
+ E##go = Bgo ^( Bgu | Bga ); \
199
+ E##gu = Bgu ^( Bga & Bge ); \
200
+ \
201
+ A##be ^= De; \
202
+ Bka = ROL64(A##be, 1); \
203
+ A##gi ^= Di; \
204
+ Bke = ROL64(A##gi, 6); \
205
+ A##ko ^= Do; \
206
+ Bki = ROL64(A##ko, 25); \
207
+ A##mu ^= Du; \
208
+ Bko = ROL64(A##mu, 8); \
209
+ A##sa ^= Da; \
210
+ Bku = ROL64(A##sa, 18); \
211
+ E##ka = Bka ^( Bke | Bki ); \
212
+ E##ke = Bke ^( Bki & Bko ); \
213
+ E##ki = Bki ^((~Bko)& Bku ); \
214
+ E##ko = (~Bko)^( Bku | Bka ); \
215
+ E##ku = Bku ^( Bka & Bke ); \
216
+ \
217
+ A##bu ^= Du; \
218
+ Bma = ROL64(A##bu, 27); \
219
+ A##ga ^= Da; \
220
+ Bme = ROL64(A##ga, 36); \
221
+ A##ke ^= De; \
222
+ Bmi = ROL64(A##ke, 10); \
223
+ A##mi ^= Di; \
224
+ Bmo = ROL64(A##mi, 15); \
225
+ A##so ^= Do; \
226
+ Bmu = ROL64(A##so, 56); \
227
+ E##ma = Bma ^( Bme & Bmi ); \
228
+ E##me = Bme ^( Bmi | Bmo ); \
229
+ E##mi = Bmi ^((~Bmo)| Bmu ); \
230
+ E##mo = (~Bmo)^( Bmu & Bma ); \
231
+ E##mu = Bmu ^( Bma | Bme ); \
232
+ \
233
+ A##bi ^= Di; \
234
+ Bsa = ROL64(A##bi, 62); \
235
+ A##go ^= Do; \
236
+ Bse = ROL64(A##go, 55); \
237
+ A##ku ^= Du; \
238
+ Bsi = ROL64(A##ku, 39); \
239
+ A##ma ^= Da; \
240
+ Bso = ROL64(A##ma, 41); \
241
+ A##se ^= De; \
242
+ Bsu = ROL64(A##se, 2); \
243
+ E##sa = Bsa ^((~Bse)& Bsi ); \
244
+ E##se = (~Bse)^( Bsi | Bso ); \
245
+ E##si = Bsi ^( Bso & Bsu ); \
246
+ E##so = Bso ^( Bsu | Bsa ); \
247
+ E##su = Bsu ^( Bsa & Bse ); \
248
+ \
249
+
250
+ #else // UseBebigokimisa
251
+ // --- Code for round, with prepare-theta
252
+ // --- 64-bit lanes mapped to 64-bit words
253
+ #define thetaRhoPiChiIotaPrepareTheta(i, A, E) \
254
+ Da = Cu^ROL64(Ce, 1); \
255
+ De = Ca^ROL64(Ci, 1); \
256
+ Di = Ce^ROL64(Co, 1); \
257
+ Do = Ci^ROL64(Cu, 1); \
258
+ Du = Co^ROL64(Ca, 1); \
259
+ \
260
+ A##ba ^= Da; \
261
+ Bba = A##ba; \
262
+ A##ge ^= De; \
263
+ Bbe = ROL64(A##ge, 44); \
264
+ A##ki ^= Di; \
265
+ Bbi = ROL64(A##ki, 43); \
266
+ A##mo ^= Do; \
267
+ Bbo = ROL64(A##mo, 21); \
268
+ A##su ^= Du; \
269
+ Bbu = ROL64(A##su, 14); \
270
+ E##ba = Bba ^((~Bbe)& Bbi ); \
271
+ E##ba ^= KeccakF1600RoundConstants[i]; \
272
+ Ca = E##ba; \
273
+ E##be = Bbe ^((~Bbi)& Bbo ); \
274
+ Ce = E##be; \
275
+ E##bi = Bbi ^((~Bbo)& Bbu ); \
276
+ Ci = E##bi; \
277
+ E##bo = Bbo ^((~Bbu)& Bba ); \
278
+ Co = E##bo; \
279
+ E##bu = Bbu ^((~Bba)& Bbe ); \
280
+ Cu = E##bu; \
281
+ \
282
+ A##bo ^= Do; \
283
+ Bga = ROL64(A##bo, 28); \
284
+ A##gu ^= Du; \
285
+ Bge = ROL64(A##gu, 20); \
286
+ A##ka ^= Da; \
287
+ Bgi = ROL64(A##ka, 3); \
288
+ A##me ^= De; \
289
+ Bgo = ROL64(A##me, 45); \
290
+ A##si ^= Di; \
291
+ Bgu = ROL64(A##si, 61); \
292
+ E##ga = Bga ^((~Bge)& Bgi ); \
293
+ Ca ^= E##ga; \
294
+ E##ge = Bge ^((~Bgi)& Bgo ); \
295
+ Ce ^= E##ge; \
296
+ E##gi = Bgi ^((~Bgo)& Bgu ); \
297
+ Ci ^= E##gi; \
298
+ E##go = Bgo ^((~Bgu)& Bga ); \
299
+ Co ^= E##go; \
300
+ E##gu = Bgu ^((~Bga)& Bge ); \
301
+ Cu ^= E##gu; \
302
+ \
303
+ A##be ^= De; \
304
+ Bka = ROL64(A##be, 1); \
305
+ A##gi ^= Di; \
306
+ Bke = ROL64(A##gi, 6); \
307
+ A##ko ^= Do; \
308
+ Bki = ROL64(A##ko, 25); \
309
+ A##mu ^= Du; \
310
+ Bko = ROL64(A##mu, 8); \
311
+ A##sa ^= Da; \
312
+ Bku = ROL64(A##sa, 18); \
313
+ E##ka = Bka ^((~Bke)& Bki ); \
314
+ Ca ^= E##ka; \
315
+ E##ke = Bke ^((~Bki)& Bko ); \
316
+ Ce ^= E##ke; \
317
+ E##ki = Bki ^((~Bko)& Bku ); \
318
+ Ci ^= E##ki; \
319
+ E##ko = Bko ^((~Bku)& Bka ); \
320
+ Co ^= E##ko; \
321
+ E##ku = Bku ^((~Bka)& Bke ); \
322
+ Cu ^= E##ku; \
323
+ \
324
+ A##bu ^= Du; \
325
+ Bma = ROL64(A##bu, 27); \
326
+ A##ga ^= Da; \
327
+ Bme = ROL64(A##ga, 36); \
328
+ A##ke ^= De; \
329
+ Bmi = ROL64(A##ke, 10); \
330
+ A##mi ^= Di; \
331
+ Bmo = ROL64(A##mi, 15); \
332
+ A##so ^= Do; \
333
+ Bmu = ROL64(A##so, 56); \
334
+ E##ma = Bma ^((~Bme)& Bmi ); \
335
+ Ca ^= E##ma; \
336
+ E##me = Bme ^((~Bmi)& Bmo ); \
337
+ Ce ^= E##me; \
338
+ E##mi = Bmi ^((~Bmo)& Bmu ); \
339
+ Ci ^= E##mi; \
340
+ E##mo = Bmo ^((~Bmu)& Bma ); \
341
+ Co ^= E##mo; \
342
+ E##mu = Bmu ^((~Bma)& Bme ); \
343
+ Cu ^= E##mu; \
344
+ \
345
+ A##bi ^= Di; \
346
+ Bsa = ROL64(A##bi, 62); \
347
+ A##go ^= Do; \
348
+ Bse = ROL64(A##go, 55); \
349
+ A##ku ^= Du; \
350
+ Bsi = ROL64(A##ku, 39); \
351
+ A##ma ^= Da; \
352
+ Bso = ROL64(A##ma, 41); \
353
+ A##se ^= De; \
354
+ Bsu = ROL64(A##se, 2); \
355
+ E##sa = Bsa ^((~Bse)& Bsi ); \
356
+ Ca ^= E##sa; \
357
+ E##se = Bse ^((~Bsi)& Bso ); \
358
+ Ce ^= E##se; \
359
+ E##si = Bsi ^((~Bso)& Bsu ); \
360
+ Ci ^= E##si; \
361
+ E##so = Bso ^((~Bsu)& Bsa ); \
362
+ Co ^= E##so; \
363
+ E##su = Bsu ^((~Bsa)& Bse ); \
364
+ Cu ^= E##su; \
365
+ \
366
+
367
+ // --- Code for round
368
+ // --- 64-bit lanes mapped to 64-bit words
369
+ #define thetaRhoPiChiIota(i, A, E) \
370
+ Da = Cu^ROL64(Ce, 1); \
371
+ De = Ca^ROL64(Ci, 1); \
372
+ Di = Ce^ROL64(Co, 1); \
373
+ Do = Ci^ROL64(Cu, 1); \
374
+ Du = Co^ROL64(Ca, 1); \
375
+ \
376
+ A##ba ^= Da; \
377
+ Bba = A##ba; \
378
+ A##ge ^= De; \
379
+ Bbe = ROL64(A##ge, 44); \
380
+ A##ki ^= Di; \
381
+ Bbi = ROL64(A##ki, 43); \
382
+ A##mo ^= Do; \
383
+ Bbo = ROL64(A##mo, 21); \
384
+ A##su ^= Du; \
385
+ Bbu = ROL64(A##su, 14); \
386
+ E##ba = Bba ^((~Bbe)& Bbi ); \
387
+ E##ba ^= KeccakF1600RoundConstants[i]; \
388
+ E##be = Bbe ^((~Bbi)& Bbo ); \
389
+ E##bi = Bbi ^((~Bbo)& Bbu ); \
390
+ E##bo = Bbo ^((~Bbu)& Bba ); \
391
+ E##bu = Bbu ^((~Bba)& Bbe ); \
392
+ \
393
+ A##bo ^= Do; \
394
+ Bga = ROL64(A##bo, 28); \
395
+ A##gu ^= Du; \
396
+ Bge = ROL64(A##gu, 20); \
397
+ A##ka ^= Da; \
398
+ Bgi = ROL64(A##ka, 3); \
399
+ A##me ^= De; \
400
+ Bgo = ROL64(A##me, 45); \
401
+ A##si ^= Di; \
402
+ Bgu = ROL64(A##si, 61); \
403
+ E##ga = Bga ^((~Bge)& Bgi ); \
404
+ E##ge = Bge ^((~Bgi)& Bgo ); \
405
+ E##gi = Bgi ^((~Bgo)& Bgu ); \
406
+ E##go = Bgo ^((~Bgu)& Bga ); \
407
+ E##gu = Bgu ^((~Bga)& Bge ); \
408
+ \
409
+ A##be ^= De; \
410
+ Bka = ROL64(A##be, 1); \
411
+ A##gi ^= Di; \
412
+ Bke = ROL64(A##gi, 6); \
413
+ A##ko ^= Do; \
414
+ Bki = ROL64(A##ko, 25); \
415
+ A##mu ^= Du; \
416
+ Bko = ROL64(A##mu, 8); \
417
+ A##sa ^= Da; \
418
+ Bku = ROL64(A##sa, 18); \
419
+ E##ka = Bka ^((~Bke)& Bki ); \
420
+ E##ke = Bke ^((~Bki)& Bko ); \
421
+ E##ki = Bki ^((~Bko)& Bku ); \
422
+ E##ko = Bko ^((~Bku)& Bka ); \
423
+ E##ku = Bku ^((~Bka)& Bke ); \
424
+ \
425
+ A##bu ^= Du; \
426
+ Bma = ROL64(A##bu, 27); \
427
+ A##ga ^= Da; \
428
+ Bme = ROL64(A##ga, 36); \
429
+ A##ke ^= De; \
430
+ Bmi = ROL64(A##ke, 10); \
431
+ A##mi ^= Di; \
432
+ Bmo = ROL64(A##mi, 15); \
433
+ A##so ^= Do; \
434
+ Bmu = ROL64(A##so, 56); \
435
+ E##ma = Bma ^((~Bme)& Bmi ); \
436
+ E##me = Bme ^((~Bmi)& Bmo ); \
437
+ E##mi = Bmi ^((~Bmo)& Bmu ); \
438
+ E##mo = Bmo ^((~Bmu)& Bma ); \
439
+ E##mu = Bmu ^((~Bma)& Bme ); \
440
+ \
441
+ A##bi ^= Di; \
442
+ Bsa = ROL64(A##bi, 62); \
443
+ A##go ^= Do; \
444
+ Bse = ROL64(A##go, 55); \
445
+ A##ku ^= Du; \
446
+ Bsi = ROL64(A##ku, 39); \
447
+ A##ma ^= Da; \
448
+ Bso = ROL64(A##ma, 41); \
449
+ A##se ^= De; \
450
+ Bsu = ROL64(A##se, 2); \
451
+ E##sa = Bsa ^((~Bse)& Bsi ); \
452
+ E##se = Bse ^((~Bsi)& Bso ); \
453
+ E##si = Bsi ^((~Bso)& Bsu ); \
454
+ E##so = Bso ^((~Bsu)& Bsa ); \
455
+ E##su = Bsu ^((~Bsa)& Bse ); \
456
+ \
457
+
458
+ #endif // UseBebigokimisa
459
+
460
+ const UINT64 KeccakF1600RoundConstants[24] = {
461
+ 0x0000000000000001ULL,
462
+ 0x0000000000008082ULL,
463
+ 0x800000000000808aULL,
464
+ 0x8000000080008000ULL,
465
+ 0x000000000000808bULL,
466
+ 0x0000000080000001ULL,
467
+ 0x8000000080008081ULL,
468
+ 0x8000000000008009ULL,
469
+ 0x000000000000008aULL,
470
+ 0x0000000000000088ULL,
471
+ 0x0000000080008009ULL,
472
+ 0x000000008000000aULL,
473
+ 0x000000008000808bULL,
474
+ 0x800000000000008bULL,
475
+ 0x8000000000008089ULL,
476
+ 0x8000000000008003ULL,
477
+ 0x8000000000008002ULL,
478
+ 0x8000000000000080ULL,
479
+ 0x000000000000800aULL,
480
+ 0x800000008000000aULL,
481
+ 0x8000000080008081ULL,
482
+ 0x8000000000008080ULL,
483
+ 0x0000000080000001ULL,
484
+ 0x8000000080008008ULL };
485
+
486
+ #define copyFromStateAndXor576bits(X, state, input) \
487
+ X##ba = state[ 0]^input[ 0]; \
488
+ X##be = state[ 1]^input[ 1]; \
489
+ X##bi = state[ 2]^input[ 2]; \
490
+ X##bo = state[ 3]^input[ 3]; \
491
+ X##bu = state[ 4]^input[ 4]; \
492
+ X##ga = state[ 5]^input[ 5]; \
493
+ X##ge = state[ 6]^input[ 6]; \
494
+ X##gi = state[ 7]^input[ 7]; \
495
+ X##go = state[ 8]^input[ 8]; \
496
+ X##gu = state[ 9]; \
497
+ X##ka = state[10]; \
498
+ X##ke = state[11]; \
499
+ X##ki = state[12]; \
500
+ X##ko = state[13]; \
501
+ X##ku = state[14]; \
502
+ X##ma = state[15]; \
503
+ X##me = state[16]; \
504
+ X##mi = state[17]; \
505
+ X##mo = state[18]; \
506
+ X##mu = state[19]; \
507
+ X##sa = state[20]; \
508
+ X##se = state[21]; \
509
+ X##si = state[22]; \
510
+ X##so = state[23]; \
511
+ X##su = state[24]; \
512
+
513
+ #define copyFromStateAndXor832bits(X, state, input) \
514
+ X##ba = state[ 0]^input[ 0]; \
515
+ X##be = state[ 1]^input[ 1]; \
516
+ X##bi = state[ 2]^input[ 2]; \
517
+ X##bo = state[ 3]^input[ 3]; \
518
+ X##bu = state[ 4]^input[ 4]; \
519
+ X##ga = state[ 5]^input[ 5]; \
520
+ X##ge = state[ 6]^input[ 6]; \
521
+ X##gi = state[ 7]^input[ 7]; \
522
+ X##go = state[ 8]^input[ 8]; \
523
+ X##gu = state[ 9]^input[ 9]; \
524
+ X##ka = state[10]^input[10]; \
525
+ X##ke = state[11]^input[11]; \
526
+ X##ki = state[12]^input[12]; \
527
+ X##ko = state[13]; \
528
+ X##ku = state[14]; \
529
+ X##ma = state[15]; \
530
+ X##me = state[16]; \
531
+ X##mi = state[17]; \
532
+ X##mo = state[18]; \
533
+ X##mu = state[19]; \
534
+ X##sa = state[20]; \
535
+ X##se = state[21]; \
536
+ X##si = state[22]; \
537
+ X##so = state[23]; \
538
+ X##su = state[24]; \
539
+
540
+ #define copyFromStateAndXor1024bits(X, state, input) \
541
+ X##ba = state[ 0]^input[ 0]; \
542
+ X##be = state[ 1]^input[ 1]; \
543
+ X##bi = state[ 2]^input[ 2]; \
544
+ X##bo = state[ 3]^input[ 3]; \
545
+ X##bu = state[ 4]^input[ 4]; \
546
+ X##ga = state[ 5]^input[ 5]; \
547
+ X##ge = state[ 6]^input[ 6]; \
548
+ X##gi = state[ 7]^input[ 7]; \
549
+ X##go = state[ 8]^input[ 8]; \
550
+ X##gu = state[ 9]^input[ 9]; \
551
+ X##ka = state[10]^input[10]; \
552
+ X##ke = state[11]^input[11]; \
553
+ X##ki = state[12]^input[12]; \
554
+ X##ko = state[13]^input[13]; \
555
+ X##ku = state[14]^input[14]; \
556
+ X##ma = state[15]^input[15]; \
557
+ X##me = state[16]; \
558
+ X##mi = state[17]; \
559
+ X##mo = state[18]; \
560
+ X##mu = state[19]; \
561
+ X##sa = state[20]; \
562
+ X##se = state[21]; \
563
+ X##si = state[22]; \
564
+ X##so = state[23]; \
565
+ X##su = state[24]; \
566
+
567
+ #define copyFromStateAndXor1088bits(X, state, input) \
568
+ X##ba = state[ 0]^input[ 0]; \
569
+ X##be = state[ 1]^input[ 1]; \
570
+ X##bi = state[ 2]^input[ 2]; \
571
+ X##bo = state[ 3]^input[ 3]; \
572
+ X##bu = state[ 4]^input[ 4]; \
573
+ X##ga = state[ 5]^input[ 5]; \
574
+ X##ge = state[ 6]^input[ 6]; \
575
+ X##gi = state[ 7]^input[ 7]; \
576
+ X##go = state[ 8]^input[ 8]; \
577
+ X##gu = state[ 9]^input[ 9]; \
578
+ X##ka = state[10]^input[10]; \
579
+ X##ke = state[11]^input[11]; \
580
+ X##ki = state[12]^input[12]; \
581
+ X##ko = state[13]^input[13]; \
582
+ X##ku = state[14]^input[14]; \
583
+ X##ma = state[15]^input[15]; \
584
+ X##me = state[16]^input[16]; \
585
+ X##mi = state[17]; \
586
+ X##mo = state[18]; \
587
+ X##mu = state[19]; \
588
+ X##sa = state[20]; \
589
+ X##se = state[21]; \
590
+ X##si = state[22]; \
591
+ X##so = state[23]; \
592
+ X##su = state[24]; \
593
+
594
+ #define copyFromStateAndXor1152bits(X, state, input) \
595
+ X##ba = state[ 0]^input[ 0]; \
596
+ X##be = state[ 1]^input[ 1]; \
597
+ X##bi = state[ 2]^input[ 2]; \
598
+ X##bo = state[ 3]^input[ 3]; \
599
+ X##bu = state[ 4]^input[ 4]; \
600
+ X##ga = state[ 5]^input[ 5]; \
601
+ X##ge = state[ 6]^input[ 6]; \
602
+ X##gi = state[ 7]^input[ 7]; \
603
+ X##go = state[ 8]^input[ 8]; \
604
+ X##gu = state[ 9]^input[ 9]; \
605
+ X##ka = state[10]^input[10]; \
606
+ X##ke = state[11]^input[11]; \
607
+ X##ki = state[12]^input[12]; \
608
+ X##ko = state[13]^input[13]; \
609
+ X##ku = state[14]^input[14]; \
610
+ X##ma = state[15]^input[15]; \
611
+ X##me = state[16]^input[16]; \
612
+ X##mi = state[17]^input[17]; \
613
+ X##mo = state[18]; \
614
+ X##mu = state[19]; \
615
+ X##sa = state[20]; \
616
+ X##se = state[21]; \
617
+ X##si = state[22]; \
618
+ X##so = state[23]; \
619
+ X##su = state[24]; \
620
+
621
+ #define copyFromStateAndXor1344bits(X, state, input) \
622
+ X##ba = state[ 0]^input[ 0]; \
623
+ X##be = state[ 1]^input[ 1]; \
624
+ X##bi = state[ 2]^input[ 2]; \
625
+ X##bo = state[ 3]^input[ 3]; \
626
+ X##bu = state[ 4]^input[ 4]; \
627
+ X##ga = state[ 5]^input[ 5]; \
628
+ X##ge = state[ 6]^input[ 6]; \
629
+ X##gi = state[ 7]^input[ 7]; \
630
+ X##go = state[ 8]^input[ 8]; \
631
+ X##gu = state[ 9]^input[ 9]; \
632
+ X##ka = state[10]^input[10]; \
633
+ X##ke = state[11]^input[11]; \
634
+ X##ki = state[12]^input[12]; \
635
+ X##ko = state[13]^input[13]; \
636
+ X##ku = state[14]^input[14]; \
637
+ X##ma = state[15]^input[15]; \
638
+ X##me = state[16]^input[16]; \
639
+ X##mi = state[17]^input[17]; \
640
+ X##mo = state[18]^input[18]; \
641
+ X##mu = state[19]^input[19]; \
642
+ X##sa = state[20]^input[20]; \
643
+ X##se = state[21]; \
644
+ X##si = state[22]; \
645
+ X##so = state[23]; \
646
+ X##su = state[24]; \
647
+
648
+ #define copyFromState(X, state) \
649
+ X##ba = state[ 0]; \
650
+ X##be = state[ 1]; \
651
+ X##bi = state[ 2]; \
652
+ X##bo = state[ 3]; \
653
+ X##bu = state[ 4]; \
654
+ X##ga = state[ 5]; \
655
+ X##ge = state[ 6]; \
656
+ X##gi = state[ 7]; \
657
+ X##go = state[ 8]; \
658
+ X##gu = state[ 9]; \
659
+ X##ka = state[10]; \
660
+ X##ke = state[11]; \
661
+ X##ki = state[12]; \
662
+ X##ko = state[13]; \
663
+ X##ku = state[14]; \
664
+ X##ma = state[15]; \
665
+ X##me = state[16]; \
666
+ X##mi = state[17]; \
667
+ X##mo = state[18]; \
668
+ X##mu = state[19]; \
669
+ X##sa = state[20]; \
670
+ X##se = state[21]; \
671
+ X##si = state[22]; \
672
+ X##so = state[23]; \
673
+ X##su = state[24]; \
674
+
675
+ #define copyToState(state, X) \
676
+ state[ 0] = X##ba; \
677
+ state[ 1] = X##be; \
678
+ state[ 2] = X##bi; \
679
+ state[ 3] = X##bo; \
680
+ state[ 4] = X##bu; \
681
+ state[ 5] = X##ga; \
682
+ state[ 6] = X##ge; \
683
+ state[ 7] = X##gi; \
684
+ state[ 8] = X##go; \
685
+ state[ 9] = X##gu; \
686
+ state[10] = X##ka; \
687
+ state[11] = X##ke; \
688
+ state[12] = X##ki; \
689
+ state[13] = X##ko; \
690
+ state[14] = X##ku; \
691
+ state[15] = X##ma; \
692
+ state[16] = X##me; \
693
+ state[17] = X##mi; \
694
+ state[18] = X##mo; \
695
+ state[19] = X##mu; \
696
+ state[20] = X##sa; \
697
+ state[21] = X##se; \
698
+ state[22] = X##si; \
699
+ state[23] = X##so; \
700
+ state[24] = X##su; \
701
+
702
+ #define copyStateVariables(X, Y) \
703
+ X##ba = Y##ba; \
704
+ X##be = Y##be; \
705
+ X##bi = Y##bi; \
706
+ X##bo = Y##bo; \
707
+ X##bu = Y##bu; \
708
+ X##ga = Y##ga; \
709
+ X##ge = Y##ge; \
710
+ X##gi = Y##gi; \
711
+ X##go = Y##go; \
712
+ X##gu = Y##gu; \
713
+ X##ka = Y##ka; \
714
+ X##ke = Y##ke; \
715
+ X##ki = Y##ki; \
716
+ X##ko = Y##ko; \
717
+ X##ku = Y##ku; \
718
+ X##ma = Y##ma; \
719
+ X##me = Y##me; \
720
+ X##mi = Y##mi; \
721
+ X##mo = Y##mo; \
722
+ X##mu = Y##mu; \
723
+ X##sa = Y##sa; \
724
+ X##se = Y##se; \
725
+ X##si = Y##si; \
726
+ X##so = Y##so; \
727
+ X##su = Y##su; \
728
+