Initial commit
[hashcat.git] / nv / m01800.cu
1 /**
2  * Author......: Jens Steube <jens.steube@gmail.com>
3  * License.....: MIT
4  */
5
6 #define _SHA512_
7
8 #include "include/constants.h"
9 #include "include/kernel_vendor.h"
10
11 #ifdef  VLIW1
12 #define VECT_SIZE1
13 #endif
14
15 #ifdef  VLIW2
16 #define VECT_SIZE1
17 #endif
18
19 #define DGST_R0 0
20 #define DGST_R1 1
21 #define DGST_R2 2
22 #define DGST_R3 3
23
24 #include "include/kernel_functions.c"
25 #include "types_nv.c"
26 #include "common_nv.c"
27
28 #ifdef  VECT_SIZE1
29 #define VECT_COMPARE_M "check_multi_vect1_comp4.c"
30 #endif
31
32 #define PUTCHAR64_BE(a,p,c) ((u8 *)(a))[(p) ^ 7] = (u8) (c)
33 #define GETCHAR64_BE(a,p)   ((u8 *)(a))[(p) ^ 7]
34
35 typedef struct
36 {
37   u64x state[8];
38   u64x buf[16];
39   int    len;
40
41 } sha512_ctx_t;
42
43 __device__ __constant__ u64 k_sha512[80] =
44 {
45   SHA512C00, SHA512C01, SHA512C02, SHA512C03,
46   SHA512C04, SHA512C05, SHA512C06, SHA512C07,
47   SHA512C08, SHA512C09, SHA512C0a, SHA512C0b,
48   SHA512C0c, SHA512C0d, SHA512C0e, SHA512C0f,
49   SHA512C10, SHA512C11, SHA512C12, SHA512C13,
50   SHA512C14, SHA512C15, SHA512C16, SHA512C17,
51   SHA512C18, SHA512C19, SHA512C1a, SHA512C1b,
52   SHA512C1c, SHA512C1d, SHA512C1e, SHA512C1f,
53   SHA512C20, SHA512C21, SHA512C22, SHA512C23,
54   SHA512C24, SHA512C25, SHA512C26, SHA512C27,
55   SHA512C28, SHA512C29, SHA512C2a, SHA512C2b,
56   SHA512C2c, SHA512C2d, SHA512C2e, SHA512C2f,
57   SHA512C30, SHA512C31, SHA512C32, SHA512C33,
58   SHA512C34, SHA512C35, SHA512C36, SHA512C37,
59   SHA512C38, SHA512C39, SHA512C3a, SHA512C3b,
60   SHA512C3c, SHA512C3d, SHA512C3e, SHA512C3f,
61   SHA512C40, SHA512C41, SHA512C42, SHA512C43,
62   SHA512C44, SHA512C45, SHA512C46, SHA512C47,
63   SHA512C48, SHA512C49, SHA512C4a, SHA512C4b,
64   SHA512C4c, SHA512C4d, SHA512C4e, SHA512C4f,
65 };
66
67 __device__ static void sha512_transform (const u64x w[16], u64x digest[8])
68 {
69   u64x w0_t = w[ 0];
70   u64x w1_t = w[ 1];
71   u64x w2_t = w[ 2];
72   u64x w3_t = w[ 3];
73   u64x w4_t = w[ 4];
74   u64x w5_t = w[ 5];
75   u64x w6_t = w[ 6];
76   u64x w7_t = w[ 7];
77   u64x w8_t = w[ 8];
78   u64x w9_t = w[ 9];
79   u64x wa_t = w[10];
80   u64x wb_t = w[11];
81   u64x wc_t = w[12];
82   u64x wd_t = w[13];
83   u64x we_t = w[14];
84   u64x wf_t = w[15];
85
86   u64x a = digest[0];
87   u64x b = digest[1];
88   u64x c = digest[2];
89   u64x d = digest[3];
90   u64x e = digest[4];
91   u64x f = digest[5];
92   u64x g = digest[6];
93   u64x h = digest[7];
94
95   #define ROUND_EXPAND()                            \
96   {                                                 \
97     w0_t = SHA512_EXPAND (we_t, w9_t, w1_t, w0_t);  \
98     w1_t = SHA512_EXPAND (wf_t, wa_t, w2_t, w1_t);  \
99     w2_t = SHA512_EXPAND (w0_t, wb_t, w3_t, w2_t);  \
100     w3_t = SHA512_EXPAND (w1_t, wc_t, w4_t, w3_t);  \
101     w4_t = SHA512_EXPAND (w2_t, wd_t, w5_t, w4_t);  \
102     w5_t = SHA512_EXPAND (w3_t, we_t, w6_t, w5_t);  \
103     w6_t = SHA512_EXPAND (w4_t, wf_t, w7_t, w6_t);  \
104     w7_t = SHA512_EXPAND (w5_t, w0_t, w8_t, w7_t);  \
105     w8_t = SHA512_EXPAND (w6_t, w1_t, w9_t, w8_t);  \
106     w9_t = SHA512_EXPAND (w7_t, w2_t, wa_t, w9_t);  \
107     wa_t = SHA512_EXPAND (w8_t, w3_t, wb_t, wa_t);  \
108     wb_t = SHA512_EXPAND (w9_t, w4_t, wc_t, wb_t);  \
109     wc_t = SHA512_EXPAND (wa_t, w5_t, wd_t, wc_t);  \
110     wd_t = SHA512_EXPAND (wb_t, w6_t, we_t, wd_t);  \
111     we_t = SHA512_EXPAND (wc_t, w7_t, wf_t, we_t);  \
112     wf_t = SHA512_EXPAND (wd_t, w8_t, w0_t, wf_t);  \
113   }
114
115   #define ROUND_STEP(i)                                                                   \
116   {                                                                                       \
117     SHA512_STEP (SHA512_F0o, SHA512_F1o, a, b, c, d, e, f, g, h, w0_t, k_sha512[i +  0]); \
118     SHA512_STEP (SHA512_F0o, SHA512_F1o, h, a, b, c, d, e, f, g, w1_t, k_sha512[i +  1]); \
119     SHA512_STEP (SHA512_F0o, SHA512_F1o, g, h, a, b, c, d, e, f, w2_t, k_sha512[i +  2]); \
120     SHA512_STEP (SHA512_F0o, SHA512_F1o, f, g, h, a, b, c, d, e, w3_t, k_sha512[i +  3]); \
121     SHA512_STEP (SHA512_F0o, SHA512_F1o, e, f, g, h, a, b, c, d, w4_t, k_sha512[i +  4]); \
122     SHA512_STEP (SHA512_F0o, SHA512_F1o, d, e, f, g, h, a, b, c, w5_t, k_sha512[i +  5]); \
123     SHA512_STEP (SHA512_F0o, SHA512_F1o, c, d, e, f, g, h, a, b, w6_t, k_sha512[i +  6]); \
124     SHA512_STEP (SHA512_F0o, SHA512_F1o, b, c, d, e, f, g, h, a, w7_t, k_sha512[i +  7]); \
125     SHA512_STEP (SHA512_F0o, SHA512_F1o, a, b, c, d, e, f, g, h, w8_t, k_sha512[i +  8]); \
126     SHA512_STEP (SHA512_F0o, SHA512_F1o, h, a, b, c, d, e, f, g, w9_t, k_sha512[i +  9]); \
127     SHA512_STEP (SHA512_F0o, SHA512_F1o, g, h, a, b, c, d, e, f, wa_t, k_sha512[i + 10]); \
128     SHA512_STEP (SHA512_F0o, SHA512_F1o, f, g, h, a, b, c, d, e, wb_t, k_sha512[i + 11]); \
129     SHA512_STEP (SHA512_F0o, SHA512_F1o, e, f, g, h, a, b, c, d, wc_t, k_sha512[i + 12]); \
130     SHA512_STEP (SHA512_F0o, SHA512_F1o, d, e, f, g, h, a, b, c, wd_t, k_sha512[i + 13]); \
131     SHA512_STEP (SHA512_F0o, SHA512_F1o, c, d, e, f, g, h, a, b, we_t, k_sha512[i + 14]); \
132     SHA512_STEP (SHA512_F0o, SHA512_F1o, b, c, d, e, f, g, h, a, wf_t, k_sha512[i + 15]); \
133   }
134
135   ROUND_STEP (0);
136
137   for (int i = 16; i < 80; i += 16)
138   {
139     ROUND_EXPAND (); ROUND_STEP (i);
140   }
141
142   digest[0] += a;
143   digest[1] += b;
144   digest[2] += c;
145   digest[3] += d;
146   digest[4] += e;
147   digest[5] += f;
148   digest[6] += g;
149   digest[7] += h;
150 }
151
152 __device__ static void sha512_init (sha512_ctx_t *sha512_ctx)
153 {
154   sha512_ctx->state[0] = SHA512M_A;
155   sha512_ctx->state[1] = SHA512M_B;
156   sha512_ctx->state[2] = SHA512M_C;
157   sha512_ctx->state[3] = SHA512M_D;
158   sha512_ctx->state[4] = SHA512M_E;
159   sha512_ctx->state[5] = SHA512M_F;
160   sha512_ctx->state[6] = SHA512M_G;
161   sha512_ctx->state[7] = SHA512M_H;
162
163   sha512_ctx->len = 0;
164 }
165
166 __device__ static void sha512_update (sha512_ctx_t *sha512_ctx, const u64x *buf, int len)
167 {
168   int pos = sha512_ctx->len & 0x7f;
169
170   sha512_ctx->len += len;
171
172   if ((pos + len) < 128)
173   {
174     for (int i = 0; i < len; i++)
175     {
176       PUTCHAR64_BE (sha512_ctx->buf, pos++, GETCHAR64_BE (buf, i));
177     }
178
179     return;
180   }
181
182   int cnt = 128 - pos;
183
184   for (int i = 0; i < cnt; i++)
185   {
186     PUTCHAR64_BE (sha512_ctx->buf, pos++, GETCHAR64_BE (buf, i));
187   }
188
189   sha512_transform (sha512_ctx->buf, sha512_ctx->state);
190
191   len -= cnt;
192
193   for (int i = 0; i < len; i++)
194   {
195     PUTCHAR64_BE (sha512_ctx->buf, i, GETCHAR64_BE (buf, cnt + i));
196   }
197 }
198
199 __device__ static void sha512_final (sha512_ctx_t *sha512_ctx)
200 {
201   int pos = sha512_ctx->len & 0x7f;
202
203   for (int i = pos; i < 128; i++)
204   {
205     PUTCHAR64_BE (sha512_ctx->buf, i, 0);
206   }
207
208   PUTCHAR64_BE (sha512_ctx->buf, pos, 0x80);
209
210   if (pos >= 112)
211   {
212     sha512_transform (sha512_ctx->buf, sha512_ctx->state);
213
214     sha512_ctx->buf[ 0] = 0;
215     sha512_ctx->buf[ 1] = 0;
216     sha512_ctx->buf[ 2] = 0;
217     sha512_ctx->buf[ 3] = 0;
218     sha512_ctx->buf[ 4] = 0;
219     sha512_ctx->buf[ 5] = 0;
220     sha512_ctx->buf[ 6] = 0;
221     sha512_ctx->buf[ 7] = 0;
222     sha512_ctx->buf[ 8] = 0;
223     sha512_ctx->buf[ 9] = 0;
224     sha512_ctx->buf[10] = 0;
225     sha512_ctx->buf[11] = 0;
226     sha512_ctx->buf[12] = 0;
227     sha512_ctx->buf[13] = 0;
228     sha512_ctx->buf[14] = 0;
229     sha512_ctx->buf[15] = 0;
230   }
231
232   sha512_ctx->buf[15] = sha512_ctx->len * 8;
233
234   sha512_transform (sha512_ctx->buf, sha512_ctx->state);
235 }
236
237 extern "C" __global__ void __launch_bounds__ (256, 1) m01800_init (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, sha512crypt_tmp_t *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
238 {
239   /**
240    * base
241    */
242
243   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
244
245   if (gid >= gid_max) return;
246
247   u32x w0[4];
248
249   w0[0] = pws[gid].i[0];
250   w0[1] = pws[gid].i[1];
251   w0[2] = pws[gid].i[2];
252   w0[3] = pws[gid].i[3];
253
254   const u32 pw_len = pws[gid].pw_len;
255
256   /**
257    * salt
258    */
259
260   u32 salt_buf[4];
261
262   salt_buf[0] = salt_bufs[salt_pos].salt_buf[0];
263   salt_buf[1] = salt_bufs[salt_pos].salt_buf[1];
264   salt_buf[2] = salt_bufs[salt_pos].salt_buf[2];
265   salt_buf[3] = salt_bufs[salt_pos].salt_buf[3];
266
267   u32 salt_len = salt_bufs[salt_pos].salt_len;
268
269   /**
270    * buffers
271    */
272
273   u64x pw[2];
274
275   pw[0] = swap_workaround (hl32_to_64 (w0[1], w0[0]));
276   pw[1] = swap_workaround (hl32_to_64 (w0[3], w0[2]));
277
278   u64x salt[2];
279
280   salt[0] = swap_workaround (hl32_to_64 (salt_buf[1], salt_buf[0]));
281   salt[1] = swap_workaround (hl32_to_64 (salt_buf[3], salt_buf[2]));
282
283   /**
284    * begin
285    */
286
287   sha512_ctx_t sha512_ctx;
288
289   sha512_init (&sha512_ctx);
290
291   sha512_update (&sha512_ctx, pw, pw_len);
292   sha512_update (&sha512_ctx, salt, salt_len);
293   sha512_update (&sha512_ctx, pw, pw_len);
294
295   sha512_final (&sha512_ctx);
296
297   u64x tmp[8];
298
299   tmp[0] = sha512_ctx.state[0];
300   tmp[1] = sha512_ctx.state[1];
301   tmp[2] = sha512_ctx.state[2];
302   tmp[3] = sha512_ctx.state[3];
303   tmp[4] = sha512_ctx.state[4];
304   tmp[5] = sha512_ctx.state[5];
305   tmp[6] = sha512_ctx.state[6];
306   tmp[7] = sha512_ctx.state[7];
307
308   sha512_init (&sha512_ctx);
309
310   sha512_update (&sha512_ctx, pw, pw_len);
311   sha512_update (&sha512_ctx, salt, salt_len);
312   sha512_update (&sha512_ctx, tmp, pw_len);
313
314   for (u32 j = pw_len; j; j >>= 1)
315   {
316     if (j & 1)
317     {
318       sha512_update (&sha512_ctx, tmp, 64);
319     }
320     else
321     {
322       sha512_update (&sha512_ctx, pw, pw_len);
323     }
324   }
325
326   sha512_final (&sha512_ctx);
327
328   tmps[gid].l_alt_result[0] = sha512_ctx.state[0];
329   tmps[gid].l_alt_result[1] = sha512_ctx.state[1];
330   tmps[gid].l_alt_result[2] = sha512_ctx.state[2];
331   tmps[gid].l_alt_result[3] = sha512_ctx.state[3];
332   tmps[gid].l_alt_result[4] = sha512_ctx.state[4];
333   tmps[gid].l_alt_result[5] = sha512_ctx.state[5];
334   tmps[gid].l_alt_result[6] = sha512_ctx.state[6];
335   tmps[gid].l_alt_result[7] = sha512_ctx.state[7];
336
337   // p_bytes
338
339   sha512_init (&sha512_ctx);
340
341   for (u32 j = 0; j < pw_len; j++)
342   {
343     sha512_update (&sha512_ctx, pw, pw_len);
344   }
345
346   sha512_final (&sha512_ctx);
347
348   tmps[gid].l_p_bytes[0] = sha512_ctx.state[0];
349   tmps[gid].l_p_bytes[1] = sha512_ctx.state[1];
350
351   // s_bytes
352
353   sha512_init (&sha512_ctx);
354
355   for (u32 j = 0; j < 16 + ((tmps[gid].l_alt_result[0] >> 56) & 0xff); j++)
356   {
357     sha512_update (&sha512_ctx, salt, salt_len);
358   }
359
360   sha512_final (&sha512_ctx);
361
362   tmps[gid].l_s_bytes[0] = sha512_ctx.state[0];
363   tmps[gid].l_s_bytes[1] = sha512_ctx.state[1];
364 }
365
366 extern "C" __global__ void __launch_bounds__ (256, 1) m01800_loop (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, sha512crypt_tmp_t *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
367 {
368   /**
369    * base
370    */
371
372   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
373
374   if (gid >= gid_max) return;
375
376
377   u64x l_p_bytes0[2];
378
379   l_p_bytes0[0] = tmps[gid].l_p_bytes[0];
380   l_p_bytes0[1] = tmps[gid].l_p_bytes[1];
381
382   const u32 pw_len = pws[gid].pw_len;
383
384   u64x l_s_bytes0[2];
385
386   l_s_bytes0[0] = tmps[gid].l_s_bytes[0];
387   l_s_bytes0[1] = tmps[gid].l_s_bytes[1];
388
389   const u32 salt_len = salt_bufs[salt_pos].salt_len;
390
391   u32 wpc_len[8];
392
393   wpc_len[0] = 64     +        0 +      0 + pw_len;
394   wpc_len[1] = pw_len +        0 +      0 + 64;
395   wpc_len[2] = 64     + salt_len +      0 + pw_len;
396   wpc_len[3] = pw_len + salt_len +      0 + 64;
397   wpc_len[4] = 64     +        0 + pw_len + pw_len;
398   wpc_len[5] = pw_len +        0 + pw_len + 64;
399   wpc_len[6] = 64     + salt_len + pw_len + pw_len;
400   wpc_len[7] = pw_len + salt_len + pw_len + 64;
401
402   u64 wpc[8][16] = { 0 };
403
404   for (u32 i = 0; i < 8; i++)
405   {
406     u32 block_len = 0;
407
408     if (i & 1)
409     {
410       for (u32 j = 0; j < pw_len; j++)
411       {
412         PUTCHAR64_BE (wpc[i], block_len++, GETCHAR64_BE (l_p_bytes0, j));
413       }
414     }
415     else
416     {
417       block_len += 64;
418     }
419
420     if (i & 2)
421     {
422       for (u32 j = 0; j < salt_len; j++)
423       {
424         PUTCHAR64_BE (wpc[i], block_len++, GETCHAR64_BE (l_s_bytes0, j));
425       }
426     }
427
428     if (i & 4)
429     {
430       for (u32 j = 0; j < pw_len; j++)
431       {
432         PUTCHAR64_BE (wpc[i], block_len++, GETCHAR64_BE (l_p_bytes0, j));
433       }
434     }
435
436     if (i & 1)
437     {
438       block_len += 64;
439     }
440     else
441     {
442       for (u32 j = 0; j < pw_len; j++)
443       {
444         PUTCHAR64_BE (wpc[i], block_len++, GETCHAR64_BE (l_p_bytes0, j));
445       }
446     }
447
448     PUTCHAR64_BE (wpc[i], block_len, 0x80);
449
450     wpc[i][15] = block_len * 8;
451   }
452
453   /**
454    * base
455    */
456
457   u64x l_alt_result[8];
458
459   l_alt_result[0] = tmps[gid].l_alt_result[0];
460   l_alt_result[1] = tmps[gid].l_alt_result[1];
461   l_alt_result[2] = tmps[gid].l_alt_result[2];
462   l_alt_result[3] = tmps[gid].l_alt_result[3];
463   l_alt_result[4] = tmps[gid].l_alt_result[4];
464   l_alt_result[5] = tmps[gid].l_alt_result[5];
465   l_alt_result[6] = tmps[gid].l_alt_result[6];
466   l_alt_result[7] = tmps[gid].l_alt_result[7];
467
468
469   /* Repeatedly run the collected hash value through SHA512 to burn
470      CPU cycles.  */
471
472   for (u32 i = 0, j = loop_pos; i < loop_cnt; i++, j++)
473   {
474     const u32 j1 = (j & 1) ? 1 : 0;
475     const u32 j3 = (j % 3) ? 2 : 0;
476     const u32 j7 = (j % 7) ? 4 : 0;
477
478     const u32 pc = j1 + j3 + j7;
479
480     u64 block[16];
481
482     block[ 0] = wpc[pc][ 0];
483     block[ 1] = wpc[pc][ 1];
484     block[ 2] = wpc[pc][ 2];
485     block[ 3] = wpc[pc][ 3];
486     block[ 4] = wpc[pc][ 4];
487     block[ 5] = wpc[pc][ 5];
488     block[ 6] = wpc[pc][ 6];
489     block[ 7] = wpc[pc][ 7];
490     block[ 8] = wpc[pc][ 8];
491     block[ 9] = wpc[pc][ 9];
492     block[10] = wpc[pc][10];
493     block[11] = wpc[pc][11];
494     block[12] = wpc[pc][12];
495     block[13] = wpc[pc][13];
496     block[14] = wpc[pc][14];
497     block[15] = wpc[pc][15];
498
499     if (j1)
500     {
501       const u32 block_len = wpc_len[pc];
502
503       #pragma unroll 64
504       for (u32 k = 0, p = block_len - 64; k < 64; k++, p++)
505       {
506         PUTCHAR64_BE (block, p, GETCHAR64_BE (l_alt_result, k));
507       }
508     }
509     else
510     {
511       block[0] = l_alt_result[0];
512       block[1] = l_alt_result[1];
513       block[2] = l_alt_result[2];
514       block[3] = l_alt_result[3];
515       block[4] = l_alt_result[4];
516       block[5] = l_alt_result[5];
517       block[6] = l_alt_result[6];
518       block[7] = l_alt_result[7];
519     }
520
521     l_alt_result[0] = SHA512M_A;
522     l_alt_result[1] = SHA512M_B;
523     l_alt_result[2] = SHA512M_C;
524     l_alt_result[3] = SHA512M_D;
525     l_alt_result[4] = SHA512M_E;
526     l_alt_result[5] = SHA512M_F;
527     l_alt_result[6] = SHA512M_G;
528     l_alt_result[7] = SHA512M_H;
529
530     sha512_transform (block, l_alt_result);
531   }
532
533   tmps[gid].l_alt_result[0] = l_alt_result[0];
534   tmps[gid].l_alt_result[1] = l_alt_result[1];
535   tmps[gid].l_alt_result[2] = l_alt_result[2];
536   tmps[gid].l_alt_result[3] = l_alt_result[3];
537   tmps[gid].l_alt_result[4] = l_alt_result[4];
538   tmps[gid].l_alt_result[5] = l_alt_result[5];
539   tmps[gid].l_alt_result[6] = l_alt_result[6];
540   tmps[gid].l_alt_result[7] = l_alt_result[7];
541 }
542
543 extern "C" __global__ void __launch_bounds__ (256, 1) m01800_comp (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, sha512crypt_tmp_t *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
544 {
545   /**
546    * base
547    */
548
549   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
550
551   if (gid >= gid_max) return;
552
553   const u32 lid = threadIdx.x;
554
555   const u64x a = swap_workaround (tmps[gid].l_alt_result[0]);
556   const u64x b = swap_workaround (tmps[gid].l_alt_result[1]);
557
558   const u32x r0 = l32_from_64 (a);
559   const u32x r1 = h32_from_64 (a);
560   const u32x r2 = l32_from_64 (b);
561   const u32x r3 = h32_from_64 (b);
562
563   #define il_pos 0
564
565   #include VECT_COMPARE_M
566 }