forked from brichard19/BitCrack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ripemd160.cuh
539 lines (486 loc) · 15.8 KB
/
ripemd160.cuh
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
#ifndef _RIPEMD160_CUH
#define _RIPEMD160_CUH
#include <cuda.h>
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
#include "ptx.cuh"
__constant__ unsigned int _RIPEMD160_IV[5] = {
0x67452301,
0xefcdab89,
0x98badcfe,
0x10325476,
0xc3d2e1f0
};
__constant__ unsigned int _K0 = 0x5a827999;
__constant__ unsigned int _K1 = 0x6ed9eba1;
__constant__ unsigned int _K2 = 0x8f1bbcdc;
__constant__ unsigned int _K3 = 0xa953fd4e;
__constant__ unsigned int _K4 = 0x7a6d76e9;
__constant__ unsigned int _K5 = 0x6d703ef3;
__constant__ unsigned int _K6 = 0x5c4dd124;
__constant__ unsigned int _K7 = 0x50a28be6;
__device__ __forceinline__ unsigned int rotl(unsigned int x, int n)
{
return (x << n) | (x >> (32 - n));
}
__device__ __forceinline__ unsigned int F(unsigned int x, unsigned int y, unsigned int z)
{
return x ^ y ^ z;
}
__device__ __forceinline__ unsigned int G(unsigned int x, unsigned int y, unsigned int z)
{
return (((x) & (y)) | (~(x) & (z)));
}
__device__ __forceinline__ unsigned int H(unsigned int x, unsigned int y, unsigned int z)
{
return (((x) | ~(y)) ^ (z));
}
__device__ __forceinline__ unsigned int I(unsigned int x, unsigned int y, unsigned int z)
{
return (((x) & (z)) | ((y) & ~(z)));
}
__device__ __forceinline__ unsigned int J(unsigned int x, unsigned int y, unsigned int z)
{
return ((x) ^ ((y) | ~(z)));
}
__device__ __forceinline__ void FF(unsigned int &a, unsigned int &b, unsigned int &c, unsigned int &d, unsigned int &e, unsigned int x, unsigned int s)
{
a += F(b, c, d) + x;
a = rotl(a, s) + e;
c = rotl(c, 10);
}
__device__ __forceinline__ void GG(unsigned int &a, unsigned int &b, unsigned int &c, unsigned int &d, unsigned int &e, unsigned int x, unsigned int s)
{
a += G(b, c, d) + x + _K0;
a = rotl(a, s) + e;
c = rotl(c, 10);
}
__device__ __forceinline__ void HH(unsigned int &a, unsigned int &b, unsigned int &c, unsigned int &d, unsigned int &e, unsigned int x, unsigned int s)
{
a += H(b, c, d) + x + _K1;
a = rotl(a, s) + e;
c = rotl(c, 10);
}
__device__ __forceinline__ void II(unsigned int &a, unsigned int &b, unsigned int &c, unsigned int &d, unsigned int &e, unsigned int x, unsigned int s)
{
a += I(b, c, d) + x + _K2;
a = rotl(a, s) + e;
c = rotl(c, 10);
}
__device__ __forceinline__ void JJ(unsigned int &a, unsigned int &b, unsigned int &c, unsigned int &d, unsigned int &e, unsigned int x, unsigned int s)
{
a += J(b, c, d) + x + _K3;
a = rotl(a, s) + e;
c = rotl(c, 10);
}
__device__ __forceinline__ void FFF(unsigned int &a, unsigned int &b, unsigned int &c, unsigned int &d, unsigned int &e, unsigned int x, unsigned int s)
{
a += F(b, c, d) + x;
a = rotl(a, s) + e;
c = rotl(c, 10);
}
__device__ __forceinline__ void GGG(unsigned int &a, unsigned int &b, unsigned int &c, unsigned int &d, unsigned int &e, unsigned int x, unsigned int s)
{
a += G(b, c, d) + x + _K4;
a = rotl(a, s) + e;
c = rotl(c, 10);
}
__device__ __forceinline__ void HHH(unsigned int &a, unsigned int &b, unsigned int &c, unsigned int &d, unsigned int &e, unsigned int x, unsigned int s)
{
a += H(b, c, d) + x + _K5;
a = rotl(a, s) + e;
c = rotl(c, 10);
}
__device__ __forceinline__ void III(unsigned int &a, unsigned int &b, unsigned int &c, unsigned int &d, unsigned int &e, unsigned int x, unsigned int s)
{
a += I(b, c, d) + x + _K6;
a = rotl(a, s) + e;
c = rotl(c, 10);
}
__device__ __forceinline__ void JJJ(unsigned int &a, unsigned int &b, unsigned int &c, unsigned int &d, unsigned int &e, unsigned int x, unsigned int s)
{
a += J(b, c, d) + x + _K7;
a = rotl(a, s) + e;
c = rotl(c, 10);
}
__device__ void ripemd160sha256(const unsigned int x[8], unsigned int digest[5])
{
unsigned int a1 = _RIPEMD160_IV[0];
unsigned int b1 = _RIPEMD160_IV[1];
unsigned int c1 = _RIPEMD160_IV[2];
unsigned int d1 = _RIPEMD160_IV[3];
unsigned int e1 = _RIPEMD160_IV[4];
const unsigned int x8 = 0x00000080;
const unsigned int x14 = 256;
/* round 1 */
FF(a1, b1, c1, d1, e1, x[0], 11);
FF(e1, a1, b1, c1, d1, x[1], 14);
FF(d1, e1, a1, b1, c1, x[2], 15);
FF(c1, d1, e1, a1, b1, x[3], 12);
FF(b1, c1, d1, e1, a1, x[4], 5);
FF(a1, b1, c1, d1, e1, x[5], 8);
FF(e1, a1, b1, c1, d1, x[6], 7);
FF(d1, e1, a1, b1, c1, x[7], 9);
FF(c1, d1, e1, a1, b1, x8, 11);
FF(b1, c1, d1, e1, a1, 0, 13);
FF(a1, b1, c1, d1, e1, 0, 14);
FF(e1, a1, b1, c1, d1, 0, 15);
FF(d1, e1, a1, b1, c1, 0, 6);
FF(c1, d1, e1, a1, b1, 0, 7);
FF(b1, c1, d1, e1, a1, x14, 9);
FF(a1, b1, c1, d1, e1, 0, 8);
/* round 2 */
GG(e1, a1, b1, c1, d1, x[7], 7);
GG(d1, e1, a1, b1, c1, x[4], 6);
GG(c1, d1, e1, a1, b1, 0, 8);
GG(b1, c1, d1, e1, a1, x[1], 13);
GG(a1, b1, c1, d1, e1, 0, 11);
GG(e1, a1, b1, c1, d1, x[6], 9);
GG(d1, e1, a1, b1, c1, 0, 7);
GG(c1, d1, e1, a1, b1, x[3], 15);
GG(b1, c1, d1, e1, a1, 0, 7);
GG(a1, b1, c1, d1, e1, x[0], 12);
GG(e1, a1, b1, c1, d1, 0, 15);
GG(d1, e1, a1, b1, c1, x[5], 9);
GG(c1, d1, e1, a1, b1, x[2], 11);
GG(b1, c1, d1, e1, a1, x14, 7);
GG(a1, b1, c1, d1, e1, 0, 13);
GG(e1, a1, b1, c1, d1, x8, 12);
/* round 3 */
HH(d1, e1, a1, b1, c1, x[3], 11);
HH(c1, d1, e1, a1, b1, 0, 13);
HH(b1, c1, d1, e1, a1, x14, 6);
HH(a1, b1, c1, d1, e1, x[4], 7);
HH(e1, a1, b1, c1, d1, 0, 14);
HH(d1, e1, a1, b1, c1, 0, 9);
HH(c1, d1, e1, a1, b1, x8, 13);
HH(b1, c1, d1, e1, a1, x[1], 15);
HH(a1, b1, c1, d1, e1, x[2], 14);
HH(e1, a1, b1, c1, d1, x[7], 8);
HH(d1, e1, a1, b1, c1, x[0], 13);
HH(c1, d1, e1, a1, b1, x[6], 6);
HH(b1, c1, d1, e1, a1, 0, 5);
HH(a1, b1, c1, d1, e1, 0, 12);
HH(e1, a1, b1, c1, d1, x[5], 7);
HH(d1, e1, a1, b1, c1, 0, 5);
/* round 4 */
II(c1, d1, e1, a1, b1, x[1], 11);
II(b1, c1, d1, e1, a1, 0, 12);
II(a1, b1, c1, d1, e1, 0, 14);
II(e1, a1, b1, c1, d1, 0, 15);
II(d1, e1, a1, b1, c1, x[0], 14);
II(c1, d1, e1, a1, b1, x8, 15);
II(b1, c1, d1, e1, a1, 0, 9);
II(a1, b1, c1, d1, e1, x[4], 8);
II(e1, a1, b1, c1, d1, 0, 9);
II(d1, e1, a1, b1, c1, x[3], 14);
II(c1, d1, e1, a1, b1, x[7], 5);
II(b1, c1, d1, e1, a1, 0, 6);
II(a1, b1, c1, d1, e1, x14, 8);
II(e1, a1, b1, c1, d1, x[5], 6);
II(d1, e1, a1, b1, c1, x[6], 5);
II(c1, d1, e1, a1, b1, x[2], 12);
/* round 5 */
JJ(b1, c1, d1, e1, a1, x[4], 9);
JJ(a1, b1, c1, d1, e1, x[0], 15);
JJ(e1, a1, b1, c1, d1, x[5], 5);
JJ(d1, e1, a1, b1, c1, 0, 11);
JJ(c1, d1, e1, a1, b1, x[7], 6);
JJ(b1, c1, d1, e1, a1, 0, 8);
JJ(a1, b1, c1, d1, e1, x[2], 13);
JJ(e1, a1, b1, c1, d1, 0, 12);
JJ(d1, e1, a1, b1, c1, x14, 5);
JJ(c1, d1, e1, a1, b1, x[1], 12);
JJ(b1, c1, d1, e1, a1, x[3], 13);
JJ(a1, b1, c1, d1, e1, x8, 14);
JJ(e1, a1, b1, c1, d1, 0, 11);
JJ(d1, e1, a1, b1, c1, x[6], 8);
JJ(c1, d1, e1, a1, b1, 0, 5);
JJ(b1, c1, d1, e1, a1, 0, 6);
unsigned int a2 = _RIPEMD160_IV[0];
unsigned int b2 = _RIPEMD160_IV[1];
unsigned int c2 = _RIPEMD160_IV[2];
unsigned int d2 = _RIPEMD160_IV[3];
unsigned int e2 = _RIPEMD160_IV[4];
/* parallel round 1 */
JJJ(a2, b2, c2, d2, e2, x[5], 8);
JJJ(e2, a2, b2, c2, d2, x14, 9);
JJJ(d2, e2, a2, b2, c2, x[7], 9);
JJJ(c2, d2, e2, a2, b2, x[0], 11);
JJJ(b2, c2, d2, e2, a2, 0, 13);
JJJ(a2, b2, c2, d2, e2, x[2], 15);
JJJ(e2, a2, b2, c2, d2, 0, 15);
JJJ(d2, e2, a2, b2, c2, x[4], 5);
JJJ(c2, d2, e2, a2, b2, 0, 7);
JJJ(b2, c2, d2, e2, a2, x[6], 7);
JJJ(a2, b2, c2, d2, e2, 0, 8);
JJJ(e2, a2, b2, c2, d2, x8, 11);
JJJ(d2, e2, a2, b2, c2, x[1], 14);
JJJ(c2, d2, e2, a2, b2, 0, 14);
JJJ(b2, c2, d2, e2, a2, x[3], 12);
JJJ(a2, b2, c2, d2, e2, 0, 6);
/* parallel round 2 */
III(e2, a2, b2, c2, d2, x[6], 9);
III(d2, e2, a2, b2, c2, 0, 13);
III(c2, d2, e2, a2, b2, x[3], 15);
III(b2, c2, d2, e2, a2, x[7], 7);
III(a2, b2, c2, d2, e2, x[0], 12);
III(e2, a2, b2, c2, d2, 0, 8);
III(d2, e2, a2, b2, c2, x[5], 9);
III(c2, d2, e2, a2, b2, 0, 11);
III(b2, c2, d2, e2, a2, x14, 7);
III(a2, b2, c2, d2, e2, 0, 7);
III(e2, a2, b2, c2, d2, x8, 12);
III(d2, e2, a2, b2, c2, 0, 7);
III(c2, d2, e2, a2, b2, x[4], 6);
III(b2, c2, d2, e2, a2, 0, 15);
III(a2, b2, c2, d2, e2, x[1], 13);
III(e2, a2, b2, c2, d2, x[2], 11);
/* parallel round 3 */
HHH(d2, e2, a2, b2, c2, 0, 9);
HHH(c2, d2, e2, a2, b2, x[5], 7);
HHH(b2, c2, d2, e2, a2, x[1], 15);
HHH(a2, b2, c2, d2, e2, x[3], 11);
HHH(e2, a2, b2, c2, d2, x[7], 8);
HHH(d2, e2, a2, b2, c2, x14, 6);
HHH(c2, d2, e2, a2, b2, x[6], 6);
HHH(b2, c2, d2, e2, a2, 0, 14);
HHH(a2, b2, c2, d2, e2, 0, 12);
HHH(e2, a2, b2, c2, d2, x8, 13);
HHH(d2, e2, a2, b2, c2, 0, 5);
HHH(c2, d2, e2, a2, b2, x[2], 14);
HHH(b2, c2, d2, e2, a2, 0, 13);
HHH(a2, b2, c2, d2, e2, x[0], 13);
HHH(e2, a2, b2, c2, d2, x[4], 7);
HHH(d2, e2, a2, b2, c2, 0, 5);
/* parallel round 4 */
GGG(c2, d2, e2, a2, b2, x8, 15);
GGG(b2, c2, d2, e2, a2, x[6], 5);
GGG(a2, b2, c2, d2, e2, x[4], 8);
GGG(e2, a2, b2, c2, d2, x[1], 11);
GGG(d2, e2, a2, b2, c2, x[3], 14);
GGG(c2, d2, e2, a2, b2, 0, 14);
GGG(b2, c2, d2, e2, a2, 0, 6);
GGG(a2, b2, c2, d2, e2, x[0], 14);
GGG(e2, a2, b2, c2, d2, x[5], 6);
GGG(d2, e2, a2, b2, c2, 0, 9);
GGG(c2, d2, e2, a2, b2, x[2], 12);
GGG(b2, c2, d2, e2, a2, 0, 9);
GGG(a2, b2, c2, d2, e2, 0, 12);
GGG(e2, a2, b2, c2, d2, x[7], 5);
GGG(d2, e2, a2, b2, c2, 0, 15);
GGG(c2, d2, e2, a2, b2, x14, 8);
/* parallel round 5 */
FFF(b2, c2, d2, e2, a2, 0, 8);
FFF(a2, b2, c2, d2, e2, 0, 5);
FFF(e2, a2, b2, c2, d2, 0, 12);
FFF(d2, e2, a2, b2, c2, x[4], 9);
FFF(c2, d2, e2, a2, b2, x[1], 12);
FFF(b2, c2, d2, e2, a2, x[5], 5);
FFF(a2, b2, c2, d2, e2, x8, 14);
FFF(e2, a2, b2, c2, d2, x[7], 6);
FFF(d2, e2, a2, b2, c2, x[6], 8);
FFF(c2, d2, e2, a2, b2, x[2], 13);
FFF(b2, c2, d2, e2, a2, 0, 6);
FFF(a2, b2, c2, d2, e2, x14, 5);
FFF(e2, a2, b2, c2, d2, x[0], 15);
FFF(d2, e2, a2, b2, c2, x[3], 13);
FFF(c2, d2, e2, a2, b2, 0, 11);
FFF(b2, c2, d2, e2, a2, 0, 11);
digest[0] = _RIPEMD160_IV[1] + c1 + d2;
digest[1] = _RIPEMD160_IV[2] + d1 + e2;
digest[2] = _RIPEMD160_IV[3] + e1 + a2;
digest[3] = _RIPEMD160_IV[4] + a1 + b2;
digest[4] = _RIPEMD160_IV[0] + b1 + c2;
}
__device__ void ripemd160sha256NoFinal(const unsigned int x[8], unsigned int digest[5])
{
unsigned int a1 = _RIPEMD160_IV[0];
unsigned int b1 = _RIPEMD160_IV[1];
unsigned int c1 = _RIPEMD160_IV[2];
unsigned int d1 = _RIPEMD160_IV[3];
unsigned int e1 = _RIPEMD160_IV[4];
const unsigned int x8 = 0x00000080;
const unsigned int x14 = 256;
/* round 1 */
FF(a1, b1, c1, d1, e1, x[0], 11);
FF(e1, a1, b1, c1, d1, x[1], 14);
FF(d1, e1, a1, b1, c1, x[2], 15);
FF(c1, d1, e1, a1, b1, x[3], 12);
FF(b1, c1, d1, e1, a1, x[4], 5);
FF(a1, b1, c1, d1, e1, x[5], 8);
FF(e1, a1, b1, c1, d1, x[6], 7);
FF(d1, e1, a1, b1, c1, x[7], 9);
FF(c1, d1, e1, a1, b1, x8, 11);
FF(b1, c1, d1, e1, a1, 0, 13);
FF(a1, b1, c1, d1, e1, 0, 14);
FF(e1, a1, b1, c1, d1, 0, 15);
FF(d1, e1, a1, b1, c1, 0, 6);
FF(c1, d1, e1, a1, b1, 0, 7);
FF(b1, c1, d1, e1, a1, x14, 9);
FF(a1, b1, c1, d1, e1, 0, 8);
/* round 2 */
GG(e1, a1, b1, c1, d1, x[7], 7);
GG(d1, e1, a1, b1, c1, x[4], 6);
GG(c1, d1, e1, a1, b1, 0, 8);
GG(b1, c1, d1, e1, a1, x[1], 13);
GG(a1, b1, c1, d1, e1, 0, 11);
GG(e1, a1, b1, c1, d1, x[6], 9);
GG(d1, e1, a1, b1, c1, 0, 7);
GG(c1, d1, e1, a1, b1, x[3], 15);
GG(b1, c1, d1, e1, a1, 0, 7);
GG(a1, b1, c1, d1, e1, x[0], 12);
GG(e1, a1, b1, c1, d1, 0, 15);
GG(d1, e1, a1, b1, c1, x[5], 9);
GG(c1, d1, e1, a1, b1, x[2], 11);
GG(b1, c1, d1, e1, a1, x14, 7);
GG(a1, b1, c1, d1, e1, 0, 13);
GG(e1, a1, b1, c1, d1, x8, 12);
/* round 3 */
HH(d1, e1, a1, b1, c1, x[3], 11);
HH(c1, d1, e1, a1, b1, 0, 13);
HH(b1, c1, d1, e1, a1, x14, 6);
HH(a1, b1, c1, d1, e1, x[4], 7);
HH(e1, a1, b1, c1, d1, 0, 14);
HH(d1, e1, a1, b1, c1, 0, 9);
HH(c1, d1, e1, a1, b1, x8, 13);
HH(b1, c1, d1, e1, a1, x[1], 15);
HH(a1, b1, c1, d1, e1, x[2], 14);
HH(e1, a1, b1, c1, d1, x[7], 8);
HH(d1, e1, a1, b1, c1, x[0], 13);
HH(c1, d1, e1, a1, b1, x[6], 6);
HH(b1, c1, d1, e1, a1, 0, 5);
HH(a1, b1, c1, d1, e1, 0, 12);
HH(e1, a1, b1, c1, d1, x[5], 7);
HH(d1, e1, a1, b1, c1, 0, 5);
/* round 4 */
II(c1, d1, e1, a1, b1, x[1], 11);
II(b1, c1, d1, e1, a1, 0, 12);
II(a1, b1, c1, d1, e1, 0, 14);
II(e1, a1, b1, c1, d1, 0, 15);
II(d1, e1, a1, b1, c1, x[0], 14);
II(c1, d1, e1, a1, b1, x8, 15);
II(b1, c1, d1, e1, a1, 0, 9);
II(a1, b1, c1, d1, e1, x[4], 8);
II(e1, a1, b1, c1, d1, 0, 9);
II(d1, e1, a1, b1, c1, x[3], 14);
II(c1, d1, e1, a1, b1, x[7], 5);
II(b1, c1, d1, e1, a1, 0, 6);
II(a1, b1, c1, d1, e1, x14, 8);
II(e1, a1, b1, c1, d1, x[5], 6);
II(d1, e1, a1, b1, c1, x[6], 5);
II(c1, d1, e1, a1, b1, x[2], 12);
/* round 5 */
JJ(b1, c1, d1, e1, a1, x[4], 9);
JJ(a1, b1, c1, d1, e1, x[0], 15);
JJ(e1, a1, b1, c1, d1, x[5], 5);
JJ(d1, e1, a1, b1, c1, 0, 11);
JJ(c1, d1, e1, a1, b1, x[7], 6);
JJ(b1, c1, d1, e1, a1, 0, 8);
JJ(a1, b1, c1, d1, e1, x[2], 13);
JJ(e1, a1, b1, c1, d1, 0, 12);
JJ(d1, e1, a1, b1, c1, x14, 5);
JJ(c1, d1, e1, a1, b1, x[1], 12);
JJ(b1, c1, d1, e1, a1, x[3], 13);
JJ(a1, b1, c1, d1, e1, x8, 14);
JJ(e1, a1, b1, c1, d1, 0, 11);
JJ(d1, e1, a1, b1, c1, x[6], 8);
JJ(c1, d1, e1, a1, b1, 0, 5);
JJ(b1, c1, d1, e1, a1, 0, 6);
unsigned int a2 = _RIPEMD160_IV[0];
unsigned int b2 = _RIPEMD160_IV[1];
unsigned int c2 = _RIPEMD160_IV[2];
unsigned int d2 = _RIPEMD160_IV[3];
unsigned int e2 = _RIPEMD160_IV[4];
/* parallel round 1 */
JJJ(a2, b2, c2, d2, e2, x[5], 8);
JJJ(e2, a2, b2, c2, d2, x14, 9);
JJJ(d2, e2, a2, b2, c2, x[7], 9);
JJJ(c2, d2, e2, a2, b2, x[0], 11);
JJJ(b2, c2, d2, e2, a2, 0, 13);
JJJ(a2, b2, c2, d2, e2, x[2], 15);
JJJ(e2, a2, b2, c2, d2, 0, 15);
JJJ(d2, e2, a2, b2, c2, x[4], 5);
JJJ(c2, d2, e2, a2, b2, 0, 7);
JJJ(b2, c2, d2, e2, a2, x[6], 7);
JJJ(a2, b2, c2, d2, e2, 0, 8);
JJJ(e2, a2, b2, c2, d2, x8, 11);
JJJ(d2, e2, a2, b2, c2, x[1], 14);
JJJ(c2, d2, e2, a2, b2, 0, 14);
JJJ(b2, c2, d2, e2, a2, x[3], 12);
JJJ(a2, b2, c2, d2, e2, 0, 6);
/* parallel round 2 */
III(e2, a2, b2, c2, d2, x[6], 9);
III(d2, e2, a2, b2, c2, 0, 13);
III(c2, d2, e2, a2, b2, x[3], 15);
III(b2, c2, d2, e2, a2, x[7], 7);
III(a2, b2, c2, d2, e2, x[0], 12);
III(e2, a2, b2, c2, d2, 0, 8);
III(d2, e2, a2, b2, c2, x[5], 9);
III(c2, d2, e2, a2, b2, 0, 11);
III(b2, c2, d2, e2, a2, x14, 7);
III(a2, b2, c2, d2, e2, 0, 7);
III(e2, a2, b2, c2, d2, x8, 12);
III(d2, e2, a2, b2, c2, 0, 7);
III(c2, d2, e2, a2, b2, x[4], 6);
III(b2, c2, d2, e2, a2, 0, 15);
III(a2, b2, c2, d2, e2, x[1], 13);
III(e2, a2, b2, c2, d2, x[2], 11);
/* parallel round 3 */
HHH(d2, e2, a2, b2, c2, 0, 9);
HHH(c2, d2, e2, a2, b2, x[5], 7);
HHH(b2, c2, d2, e2, a2, x[1], 15);
HHH(a2, b2, c2, d2, e2, x[3], 11);
HHH(e2, a2, b2, c2, d2, x[7], 8);
HHH(d2, e2, a2, b2, c2, x14, 6);
HHH(c2, d2, e2, a2, b2, x[6], 6);
HHH(b2, c2, d2, e2, a2, 0, 14);
HHH(a2, b2, c2, d2, e2, 0, 12);
HHH(e2, a2, b2, c2, d2, x8, 13);
HHH(d2, e2, a2, b2, c2, 0, 5);
HHH(c2, d2, e2, a2, b2, x[2], 14);
HHH(b2, c2, d2, e2, a2, 0, 13);
HHH(a2, b2, c2, d2, e2, x[0], 13);
HHH(e2, a2, b2, c2, d2, x[4], 7);
HHH(d2, e2, a2, b2, c2, 0, 5);
/* parallel round 4 */
GGG(c2, d2, e2, a2, b2, x8, 15);
GGG(b2, c2, d2, e2, a2, x[6], 5);
GGG(a2, b2, c2, d2, e2, x[4], 8);
GGG(e2, a2, b2, c2, d2, x[1], 11);
GGG(d2, e2, a2, b2, c2, x[3], 14);
GGG(c2, d2, e2, a2, b2, 0, 14);
GGG(b2, c2, d2, e2, a2, 0, 6);
GGG(a2, b2, c2, d2, e2, x[0], 14);
GGG(e2, a2, b2, c2, d2, x[5], 6);
GGG(d2, e2, a2, b2, c2, 0, 9);
GGG(c2, d2, e2, a2, b2, x[2], 12);
GGG(b2, c2, d2, e2, a2, 0, 9);
GGG(a2, b2, c2, d2, e2, 0, 12);
GGG(e2, a2, b2, c2, d2, x[7], 5);
GGG(d2, e2, a2, b2, c2, 0, 15);
GGG(c2, d2, e2, a2, b2, x14, 8);
/* parallel round 5 */
FFF(b2, c2, d2, e2, a2, 0, 8);
FFF(a2, b2, c2, d2, e2, 0, 5);
FFF(e2, a2, b2, c2, d2, 0, 12);
FFF(d2, e2, a2, b2, c2, x[4], 9);
FFF(c2, d2, e2, a2, b2, x[1], 12);
FFF(b2, c2, d2, e2, a2, x[5], 5);
FFF(a2, b2, c2, d2, e2, x8, 14);
FFF(e2, a2, b2, c2, d2, x[7], 6);
FFF(d2, e2, a2, b2, c2, x[6], 8);
FFF(c2, d2, e2, a2, b2, x[2], 13);
FFF(b2, c2, d2, e2, a2, 0, 6);
FFF(a2, b2, c2, d2, e2, x14, 5);
FFF(e2, a2, b2, c2, d2, x[0], 15);
FFF(d2, e2, a2, b2, c2, x[3], 13);
FFF(c2, d2, e2, a2, b2, 0, 11);
FFF(b2, c2, d2, e2, a2, 0, 11);
digest[0] = c1 + d2;
digest[1] = d1 + e2;
digest[2] = e1 + a2;
digest[3] = a1 + b2;
digest[4] = b1 + c2;
}
#endif