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