- Dropped all vector code since new GPU's are all scalar, makes the code much easier
[hashcat.git] / OpenCL / m08000_a3.cl
1 /**
2  * Author......: Jens Steube <jens.steube@gmail.com>
3  * License.....: MIT
4  */
5
6 #define _SHA256_
7
8 #include "include/constants.h"
9 #include "include/kernel_vendor.h"
10
11 #define DGST_R0 3
12 #define DGST_R1 7
13 #define DGST_R2 2
14 #define DGST_R3 6
15
16 #include "include/kernel_functions.c"
17 #include "types_ocl.c"
18 #include "common.c"
19
20 #define COMPARE_S "check_single_comp4.c"
21 #define COMPARE_M "check_multi_comp4.c"
22
23 __constant u32 k_sha256[64] =
24 {
25   SHA256C00, SHA256C01, SHA256C02, SHA256C03,
26   SHA256C04, SHA256C05, SHA256C06, SHA256C07,
27   SHA256C08, SHA256C09, SHA256C0a, SHA256C0b,
28   SHA256C0c, SHA256C0d, SHA256C0e, SHA256C0f,
29   SHA256C10, SHA256C11, SHA256C12, SHA256C13,
30   SHA256C14, SHA256C15, SHA256C16, SHA256C17,
31   SHA256C18, SHA256C19, SHA256C1a, SHA256C1b,
32   SHA256C1c, SHA256C1d, SHA256C1e, SHA256C1f,
33   SHA256C20, SHA256C21, SHA256C22, SHA256C23,
34   SHA256C24, SHA256C25, SHA256C26, SHA256C27,
35   SHA256C28, SHA256C29, SHA256C2a, SHA256C2b,
36   SHA256C2c, SHA256C2d, SHA256C2e, SHA256C2f,
37   SHA256C30, SHA256C31, SHA256C32, SHA256C33,
38   SHA256C34, SHA256C35, SHA256C36, SHA256C37,
39   SHA256C38, SHA256C39, SHA256C3a, SHA256C3b,
40   SHA256C3c, SHA256C3d, SHA256C3e, SHA256C3f,
41 };
42
43 static void sha256_transform (u32 digest[8], const u32 w[16])
44 {
45   u32 a = digest[0];
46   u32 b = digest[1];
47   u32 c = digest[2];
48   u32 d = digest[3];
49   u32 e = digest[4];
50   u32 f = digest[5];
51   u32 g = digest[6];
52   u32 h = digest[7];
53
54   u32 w0_t = w[ 0];
55   u32 w1_t = w[ 1];
56   u32 w2_t = w[ 2];
57   u32 w3_t = w[ 3];
58   u32 w4_t = w[ 4];
59   u32 w5_t = w[ 5];
60   u32 w6_t = w[ 6];
61   u32 w7_t = w[ 7];
62   u32 w8_t = w[ 8];
63   u32 w9_t = w[ 9];
64   u32 wa_t = w[10];
65   u32 wb_t = w[11];
66   u32 wc_t = w[12];
67   u32 wd_t = w[13];
68   u32 we_t = w[14];
69   u32 wf_t = w[15];
70
71   #define ROUND_EXPAND()                            \
72   {                                                 \
73     w0_t = SHA256_EXPAND (we_t, w9_t, w1_t, w0_t);  \
74     w1_t = SHA256_EXPAND (wf_t, wa_t, w2_t, w1_t);  \
75     w2_t = SHA256_EXPAND (w0_t, wb_t, w3_t, w2_t);  \
76     w3_t = SHA256_EXPAND (w1_t, wc_t, w4_t, w3_t);  \
77     w4_t = SHA256_EXPAND (w2_t, wd_t, w5_t, w4_t);  \
78     w5_t = SHA256_EXPAND (w3_t, we_t, w6_t, w5_t);  \
79     w6_t = SHA256_EXPAND (w4_t, wf_t, w7_t, w6_t);  \
80     w7_t = SHA256_EXPAND (w5_t, w0_t, w8_t, w7_t);  \
81     w8_t = SHA256_EXPAND (w6_t, w1_t, w9_t, w8_t);  \
82     w9_t = SHA256_EXPAND (w7_t, w2_t, wa_t, w9_t);  \
83     wa_t = SHA256_EXPAND (w8_t, w3_t, wb_t, wa_t);  \
84     wb_t = SHA256_EXPAND (w9_t, w4_t, wc_t, wb_t);  \
85     wc_t = SHA256_EXPAND (wa_t, w5_t, wd_t, wc_t);  \
86     wd_t = SHA256_EXPAND (wb_t, w6_t, we_t, wd_t);  \
87     we_t = SHA256_EXPAND (wc_t, w7_t, wf_t, we_t);  \
88     wf_t = SHA256_EXPAND (wd_t, w8_t, w0_t, wf_t);  \
89   }
90
91   #define ROUND_STEP(i)                                                                   \
92   {                                                                                       \
93     SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w0_t, k_sha256[i +  0]); \
94     SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w1_t, k_sha256[i +  1]); \
95     SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, w2_t, k_sha256[i +  2]); \
96     SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, w3_t, k_sha256[i +  3]); \
97     SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, w4_t, k_sha256[i +  4]); \
98     SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, w5_t, k_sha256[i +  5]); \
99     SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, w6_t, k_sha256[i +  6]); \
100     SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, w7_t, k_sha256[i +  7]); \
101     SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w8_t, k_sha256[i +  8]); \
102     SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w9_t, k_sha256[i +  9]); \
103     SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, wa_t, k_sha256[i + 10]); \
104     SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, wb_t, k_sha256[i + 11]); \
105     SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, wc_t, k_sha256[i + 12]); \
106     SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, wd_t, k_sha256[i + 13]); \
107     SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, we_t, k_sha256[i + 14]); \
108     SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, wf_t, k_sha256[i + 15]); \
109   }
110
111   ROUND_STEP (0);
112
113   #pragma unroll
114   for (int i = 16; i < 64; i += 16)
115   {
116     ROUND_EXPAND (); ROUND_STEP (i);
117   }
118
119   digest[0] += a;
120   digest[1] += b;
121   digest[2] += c;
122   digest[3] += d;
123   digest[4] += e;
124   digest[5] += f;
125   digest[6] += g;
126   digest[7] += h;
127 }
128
129 static void m08000m (u32 w[16], const u32 pw_len, __global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32 * words_buf_r, __global void *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_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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset)
130 {
131   /**
132    * modifier
133    */
134
135   const u32 gid = get_global_id (0);
136   const u32 lid = get_local_id (0);
137
138   /**
139    * salt
140    */
141
142   const u32 salt_buf0 = swap_workaround (salt_bufs[salt_pos].salt_buf[ 0]);
143   const u32 salt_buf1 = swap_workaround (salt_bufs[salt_pos].salt_buf[ 1]);
144   const u32 salt_buf2 = swap_workaround (salt_bufs[salt_pos].salt_buf[ 2]); // 0x80
145
146   /**
147    * loop
148    */
149
150   u32 w0l = w[0];
151
152   for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos++)
153   {
154     const u32 w0r = words_buf_r[il_pos];
155
156     const u32 w0 = w0l | w0r;
157
158     u32 w_t[16];
159
160     w_t[ 0] = w0    >> 8;
161     w_t[ 1] = w[ 1] >> 8;
162     w_t[ 2] = w[ 2] >> 8;
163     w_t[ 3] = w[ 3] >> 8;
164     w_t[ 4] = w[ 4] >> 8;
165     w_t[ 5] = w[ 5] >> 8;
166     w_t[ 6] = w[ 6] >> 8;
167     w_t[ 7] = w[ 7] >> 8;
168     w_t[ 8] = w[ 8] >> 8;
169     w_t[ 9] = w[ 9] >> 8;
170     w_t[10] = w[10] >> 8;
171     w_t[11] = w[11] >> 8;
172     w_t[12] = w[12] >> 8;
173     w_t[13] = w[13] >> 8;
174     w_t[14] = w[14] >> 8;
175     w_t[15] = w[15] >> 8;
176
177     u32 digest[8];
178
179     digest[0] = SHA256M_A;
180     digest[1] = SHA256M_B;
181     digest[2] = SHA256M_C;
182     digest[3] = SHA256M_D;
183     digest[4] = SHA256M_E;
184     digest[5] = SHA256M_F;
185     digest[6] = SHA256M_G;
186     digest[7] = SHA256M_H;
187
188     sha256_transform (digest, w_t); //   0 - 64
189
190     w_t[ 0] = 0;
191     w_t[ 1] = 0;
192     w_t[ 2] = 0;
193     w_t[ 3] = 0;
194     w_t[ 4] = 0;
195     w_t[ 5] = 0;
196     w_t[ 6] = 0;
197     w_t[ 7] = 0;
198     w_t[ 8] = 0;
199     w_t[ 9] = 0;
200     w_t[10] = 0;
201     w_t[11] = 0;
202     w_t[12] = 0;
203     w_t[13] = 0;
204     w_t[14] = 0;
205     w_t[15] = 0;
206
207     sha256_transform (digest, w_t); //  64 - 128
208     sha256_transform (digest, w_t); // 128 - 192
209     sha256_transform (digest, w_t); // 192 - 256
210     sha256_transform (digest, w_t); // 256 - 320
211     sha256_transform (digest, w_t); // 320 - 384
212     sha256_transform (digest, w_t); // 384 - 448
213
214     w_t[15] =               0 | salt_buf0 >> 16;
215
216     sha256_transform (digest, w_t); // 448 - 512
217
218     w_t[ 0] = salt_buf0 << 16 | salt_buf1 >> 16;
219     w_t[ 1] = salt_buf1 << 16 | salt_buf2 >> 16;
220     w_t[ 2] = salt_buf2 << 16 | 0;
221     w_t[15] = (510 + 8) * 8;
222
223     sha256_transform (digest, w_t); // 512 - 576
224
225     const u32 r0 = digest[3];
226     const u32 r1 = digest[7];
227     const u32 r2 = digest[2];
228     const u32 r3 = digest[6];
229
230     #include COMPARE_M
231   }
232 }
233
234 static void m08000s (u32 w[16], const u32 pw_len, __global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32 * words_buf_r, __global void *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_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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset)
235 {
236   /**
237    * modifier
238    */
239
240   const u32 gid = get_global_id (0);
241   const u32 lid = get_local_id (0);
242
243   /**
244    * digest
245    */
246
247   const u32 search[4] =
248   {
249     digests_buf[digests_offset].digest_buf[DGST_R0],
250     digests_buf[digests_offset].digest_buf[DGST_R1],
251     digests_buf[digests_offset].digest_buf[DGST_R2],
252     digests_buf[digests_offset].digest_buf[DGST_R3]
253   };
254
255   /**
256    * salt
257    */
258
259   const u32 salt_buf0 = swap_workaround (salt_bufs[salt_pos].salt_buf[ 0]);
260   const u32 salt_buf1 = swap_workaround (salt_bufs[salt_pos].salt_buf[ 1]);
261   const u32 salt_buf2 = swap_workaround (salt_bufs[salt_pos].salt_buf[ 2]); // 0x80
262
263   /**
264    * loop
265    */
266
267   u32 w0l = w[0];
268
269   for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos++)
270   {
271     const u32 w0r = words_buf_r[il_pos];
272
273     const u32 w0 = w0l | w0r;
274
275     u32 w_t[16];
276
277     w_t[ 0] = w0    >> 8;
278     w_t[ 1] = w[ 1] >> 8;
279     w_t[ 2] = w[ 2] >> 8;
280     w_t[ 3] = w[ 3] >> 8;
281     w_t[ 4] = w[ 4] >> 8;
282     w_t[ 5] = w[ 5] >> 8;
283     w_t[ 6] = w[ 6] >> 8;
284     w_t[ 7] = w[ 7] >> 8;
285     w_t[ 8] = w[ 8] >> 8;
286     w_t[ 9] = w[ 9] >> 8;
287     w_t[10] = w[10] >> 8;
288     w_t[11] = w[11] >> 8;
289     w_t[12] = w[12] >> 8;
290     w_t[13] = w[13] >> 8;
291     w_t[14] = w[14] >> 8;
292     w_t[15] = w[15] >> 8;
293
294     u32 digest[8];
295
296     digest[0] = SHA256M_A;
297     digest[1] = SHA256M_B;
298     digest[2] = SHA256M_C;
299     digest[3] = SHA256M_D;
300     digest[4] = SHA256M_E;
301     digest[5] = SHA256M_F;
302     digest[6] = SHA256M_G;
303     digest[7] = SHA256M_H;
304
305     sha256_transform (digest, w_t); //   0 - 64
306
307     w_t[ 0] = 0;
308     w_t[ 1] = 0;
309     w_t[ 2] = 0;
310     w_t[ 3] = 0;
311     w_t[ 4] = 0;
312     w_t[ 5] = 0;
313     w_t[ 6] = 0;
314     w_t[ 7] = 0;
315     w_t[ 8] = 0;
316     w_t[ 9] = 0;
317     w_t[10] = 0;
318     w_t[11] = 0;
319     w_t[12] = 0;
320     w_t[13] = 0;
321     w_t[14] = 0;
322     w_t[15] = 0;
323
324     sha256_transform (digest, w_t); //  64 - 128
325     sha256_transform (digest, w_t); // 128 - 192
326     sha256_transform (digest, w_t); // 192 - 256
327     sha256_transform (digest, w_t); // 256 - 320
328     sha256_transform (digest, w_t); // 320 - 384
329     sha256_transform (digest, w_t); // 384 - 448
330
331     w_t[15] =               0 | salt_buf0 >> 16;
332
333     sha256_transform (digest, w_t); // 448 - 512
334
335     w_t[ 0] = salt_buf0 << 16 | salt_buf1 >> 16;
336     w_t[ 1] = salt_buf1 << 16 | salt_buf2 >> 16;
337     w_t[ 2] = salt_buf2 << 16 | 0;
338     w_t[15] = (510 + 8) * 8;
339
340     sha256_transform (digest, w_t); // 512 - 576
341
342     const u32 r0 = digest[3];
343     const u32 r1 = digest[7];
344     const u32 r2 = digest[2];
345     const u32 r3 = digest[6];
346
347     #include COMPARE_S
348   }
349 }
350
351 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m08000_m04 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32 * words_buf_r, __global void *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_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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
352 {
353   /**
354    * base
355    */
356
357   const u32 gid = get_global_id (0);
358
359   if (gid >= gid_max) return;
360
361   u32 w[16];
362
363   w[ 0] = pws[gid].i[ 0];
364   w[ 1] = pws[gid].i[ 1];
365   w[ 2] = pws[gid].i[ 2];
366   w[ 3] = pws[gid].i[ 3];
367   w[ 4] = 0;
368   w[ 5] = 0;
369   w[ 6] = 0;
370   w[ 7] = 0;
371   w[ 8] = 0;
372   w[ 9] = 0;
373   w[10] = 0;
374   w[11] = 0;
375   w[12] = 0;
376   w[13] = 0;
377   w[14] = 0;
378   w[15] = 0;
379
380   const u32 pw_len = pws[gid].pw_len;
381
382   /**
383    * main
384    */
385
386   m08000m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
387 }
388
389 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m08000_m08 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32 * words_buf_r, __global void *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_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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
390 {
391   /**
392    * base
393    */
394
395   const u32 gid = get_global_id (0);
396
397   if (gid >= gid_max) return;
398
399   u32 w[16];
400
401   w[ 0] = pws[gid].i[ 0];
402   w[ 1] = pws[gid].i[ 1];
403   w[ 2] = pws[gid].i[ 2];
404   w[ 3] = pws[gid].i[ 3];
405   w[ 4] = pws[gid].i[ 4];
406   w[ 5] = pws[gid].i[ 5];
407   w[ 6] = pws[gid].i[ 6];
408   w[ 7] = pws[gid].i[ 7];
409   w[ 8] = 0;
410   w[ 9] = 0;
411   w[10] = 0;
412   w[11] = 0;
413   w[12] = 0;
414   w[13] = 0;
415   w[14] = 0;
416   w[15] = 0;
417
418   const u32 pw_len = pws[gid].pw_len;
419
420   /**
421    * main
422    */
423
424   m08000m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
425 }
426
427 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m08000_m16 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32 * words_buf_r, __global void *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_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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
428 {
429   /**
430    * base
431    */
432
433   const u32 gid = get_global_id (0);
434
435   if (gid >= gid_max) return;
436
437   u32 w[16];
438
439   w[ 0] = pws[gid].i[ 0];
440   w[ 1] = pws[gid].i[ 1];
441   w[ 2] = pws[gid].i[ 2];
442   w[ 3] = pws[gid].i[ 3];
443   w[ 4] = pws[gid].i[ 4];
444   w[ 5] = pws[gid].i[ 5];
445   w[ 6] = pws[gid].i[ 6];
446   w[ 7] = pws[gid].i[ 7];
447   w[ 8] = pws[gid].i[ 8];
448   w[ 9] = pws[gid].i[ 9];
449   w[10] = pws[gid].i[10];
450   w[11] = pws[gid].i[11];
451   w[12] = pws[gid].i[12];
452   w[13] = pws[gid].i[13];
453   w[14] = pws[gid].i[14];
454   w[15] = pws[gid].i[15];
455
456   const u32 pw_len = pws[gid].pw_len;
457
458   /**
459    * main
460    */
461
462   m08000m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
463 }
464
465 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m08000_s04 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32 * words_buf_r, __global void *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_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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
466 {
467   /**
468    * base
469    */
470
471   const u32 gid = get_global_id (0);
472
473   if (gid >= gid_max) return;
474
475   u32 w[16];
476
477   w[ 0] = pws[gid].i[ 0];
478   w[ 1] = pws[gid].i[ 1];
479   w[ 2] = pws[gid].i[ 2];
480   w[ 3] = pws[gid].i[ 3];
481   w[ 4] = 0;
482   w[ 5] = 0;
483   w[ 6] = 0;
484   w[ 7] = 0;
485   w[ 8] = 0;
486   w[ 9] = 0;
487   w[10] = 0;
488   w[11] = 0;
489   w[12] = 0;
490   w[13] = 0;
491   w[14] = 0;
492   w[15] = 0;
493
494   const u32 pw_len = pws[gid].pw_len;
495
496   /**
497    * main
498    */
499
500   m08000s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
501 }
502
503 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m08000_s08 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32 * words_buf_r, __global void *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_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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
504 {
505   /**
506    * base
507    */
508
509   const u32 gid = get_global_id (0);
510
511   if (gid >= gid_max) return;
512
513   u32 w[16];
514
515   w[ 0] = pws[gid].i[ 0];
516   w[ 1] = pws[gid].i[ 1];
517   w[ 2] = pws[gid].i[ 2];
518   w[ 3] = pws[gid].i[ 3];
519   w[ 4] = pws[gid].i[ 4];
520   w[ 5] = pws[gid].i[ 5];
521   w[ 6] = pws[gid].i[ 6];
522   w[ 7] = pws[gid].i[ 7];
523   w[ 8] = 0;
524   w[ 9] = 0;
525   w[10] = 0;
526   w[11] = 0;
527   w[12] = 0;
528   w[13] = 0;
529   w[14] = 0;
530   w[15] = 0;
531
532   const u32 pw_len = pws[gid].pw_len;
533
534   /**
535    * main
536    */
537
538   m08000s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
539 }
540
541 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m08000_s16 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32 * words_buf_r, __global void *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_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 bfs_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   u32 w[16];
552
553   w[ 0] = pws[gid].i[ 0];
554   w[ 1] = pws[gid].i[ 1];
555   w[ 2] = pws[gid].i[ 2];
556   w[ 3] = pws[gid].i[ 3];
557   w[ 4] = pws[gid].i[ 4];
558   w[ 5] = pws[gid].i[ 5];
559   w[ 6] = pws[gid].i[ 6];
560   w[ 7] = pws[gid].i[ 7];
561   w[ 8] = pws[gid].i[ 8];
562   w[ 9] = pws[gid].i[ 9];
563   w[10] = pws[gid].i[10];
564   w[11] = pws[gid].i[11];
565   w[12] = pws[gid].i[12];
566   w[13] = pws[gid].i[13];
567   w[14] = pws[gid].i[14];
568   w[15] = pws[gid].i[15];
569
570   const u32 pw_len = pws[gid].pw_len;
571
572   /**
573    * main
574    */
575
576   m08000s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
577 }