Fix path to includes
[hashcat.git] / OpenCL / m04900_a3.cl
1 /**
2  * Author......: Jens Steube <jens.steube@gmail.com>
3  * License.....: MIT
4  */
5
6 #define _SHA1_
7
8 #include "include/constants.h"
9 #include "include/kernel_vendor.h"
10
11 #define DGST_R0 3
12 #define DGST_R1 4
13 #define DGST_R2 2
14 #define DGST_R3 1
15
16 #include "include/kernel_functions.c"
17 #include "OpenCL/types_ocl.c"
18 #include "OpenCL/common.c"
19
20 #define COMPARE_S "OpenCL/check_single_comp4.c"
21 #define COMPARE_M "OpenCL/check_multi_comp4.c"
22
23 static void m04900m (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_len, __global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __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)
24 {
25   /**
26    * modifier
27    */
28
29   const u32 gid = get_global_id (0);
30   const u32 lid = get_local_id (0);
31
32   /**
33    * salt
34    */
35
36   u32 salt_buf0_t[4];
37
38   salt_buf0_t[0] = salt_bufs[salt_pos].salt_buf[0];
39   salt_buf0_t[1] = salt_bufs[salt_pos].salt_buf[1];
40   salt_buf0_t[2] = salt_bufs[salt_pos].salt_buf[2];
41   salt_buf0_t[3] = salt_bufs[salt_pos].salt_buf[3];
42
43   u32 salt_buf1_t[4];
44
45   salt_buf1_t[0] = salt_bufs[salt_pos].salt_buf[4];
46   salt_buf1_t[1] = salt_bufs[salt_pos].salt_buf[5];
47   salt_buf1_t[2] = salt_bufs[salt_pos].salt_buf[6];
48   salt_buf1_t[3] = salt_bufs[salt_pos].salt_buf[7];
49
50   u32 salt_buf2_t[4];
51
52   salt_buf2_t[0] = 0;
53   salt_buf2_t[1] = 0;
54   salt_buf2_t[2] = 0;
55   salt_buf2_t[3] = 0;
56
57   u32 salt_buf3_t[4];
58
59   salt_buf3_t[0] = 0;
60   salt_buf3_t[1] = 0;
61   salt_buf3_t[2] = 0;
62   salt_buf3_t[3] = 0;
63
64   const u32 salt_len = salt_bufs[salt_pos].salt_len;
65
66   const u32 pw_salt_len = salt_len + pw_len + salt_len;
67
68   // first we need to switch the right-hand salt to the correct position (2nd salt)
69
70   switch_buffer_by_offset (salt_buf0_t, salt_buf1_t, salt_buf2_t, salt_buf3_t, salt_len + pw_len);
71
72   u32 salt_buf0[4];
73
74   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[0];
75   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[1];
76   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[2];
77   salt_buf0[3] = salt_bufs[salt_pos].salt_buf[3];
78
79   u32 salt_buf1[4];
80
81   salt_buf1[0] = salt_bufs[salt_pos].salt_buf[4];
82   salt_buf1[1] = salt_bufs[salt_pos].salt_buf[5];
83   salt_buf1[2] = salt_bufs[salt_pos].salt_buf[6];
84   salt_buf1[3] = salt_bufs[salt_pos].salt_buf[7];
85
86   u32 salt_buf2[4];
87
88   salt_buf2[0] = 0;
89   salt_buf2[1] = 0;
90   salt_buf2[2] = 0;
91   salt_buf2[3] = 0;
92
93   u32 salt_buf3[4];
94
95   salt_buf3[0] = 0;
96   salt_buf3[1] = 0;
97   salt_buf3[2] = 0;
98   salt_buf3[3] = 0;
99
100   // concatenate the 1st and 2nd instance of the salt
101
102   salt_buf0[0] |= salt_buf0_t[0];
103   salt_buf0[1] |= salt_buf0_t[1];
104   salt_buf0[2] |= salt_buf0_t[2];
105   salt_buf0[3] |= salt_buf0_t[3];
106
107   salt_buf1[0] |= salt_buf1_t[0];
108   salt_buf1[1] |= salt_buf1_t[1];
109   salt_buf1[2] |= salt_buf1_t[2];
110   salt_buf1[3] |= salt_buf1_t[3];
111
112   salt_buf2[0] |= salt_buf2_t[0];
113   salt_buf2[1] |= salt_buf2_t[1];
114   salt_buf2[2] |= salt_buf2_t[2];
115   salt_buf2[3] |= salt_buf2_t[3];
116
117   salt_buf3[0] |= salt_buf3_t[0];
118   salt_buf3[1] |= salt_buf3_t[1];
119   salt_buf3[2] |= salt_buf3_t[2];
120   salt_buf3[3] |= salt_buf3_t[3];
121
122   append_0x80_4x4 (salt_buf0, salt_buf1, salt_buf2, salt_buf3, pw_salt_len);
123
124   /**
125    * loop
126    */
127
128   u32 w0l = w0[0];
129
130   for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos++)
131   {
132     const u32 w0r = bfs_buf[il_pos].i;
133
134     w0[0] = w0l | w0r;
135
136     u32 w0_t[4];
137
138     w0_t[0] = w0[0];
139     w0_t[1] = w0[1];
140     w0_t[2] = w0[2];
141     w0_t[3] = w0[3];
142
143     u32 w1_t[4];
144
145     w1_t[0] = w1[0];
146     w1_t[1] = w1[1];
147     w1_t[2] = w1[2];
148     w1_t[3] = w1[3];
149
150     u32 w2_t[4];
151
152     w2_t[0] = w2[0];
153     w2_t[1] = w2[1];
154     w2_t[2] = w2[2];
155     w2_t[3] = w2[3];
156
157     u32 w3_t[4];
158
159     w3_t[0] = w3[0];
160     w3_t[1] = w3[1];
161     w3_t[2] = w3[2];
162     w3_t[3] = w3[3];
163
164     /**
165      * put the password after the first salt but before the second salt
166      */
167
168     switch_buffer_by_offset (w0_t, w1_t, w2_t, w3_t, salt_len);
169
170     w0_t[0] |= salt_buf0[0];
171     w0_t[1] |= salt_buf0[1];
172     w0_t[2] |= salt_buf0[2];
173     w0_t[3] |= salt_buf0[3];
174     w1_t[0] |= salt_buf1[0];
175     w1_t[1] |= salt_buf1[1];
176     w1_t[2] |= salt_buf1[2];
177     w1_t[3] |= salt_buf1[3];
178     w2_t[0] |= salt_buf2[0];
179     w2_t[1] |= salt_buf2[1];
180     w2_t[2] |= salt_buf2[2];
181     w2_t[3] |= salt_buf2[3];
182     w3_t[0] |= salt_buf3[0];
183     w3_t[1] |= salt_buf3[1];
184     w3_t[2] |= salt_buf3[2];
185
186     u32 w0 = swap32 (w0_t[0]);
187     u32 w1 = swap32 (w0_t[1]);
188     u32 w2 = swap32 (w0_t[2]);
189     u32 w3 = swap32 (w0_t[3]);
190     u32 w4 = swap32 (w1_t[0]);
191     u32 w5 = swap32 (w1_t[1]);
192     u32 w6 = swap32 (w1_t[2]);
193     u32 w7 = swap32 (w1_t[3]);
194     u32 w8 = swap32 (w2_t[0]);
195     u32 w9 = swap32 (w2_t[1]);
196     u32 wa = swap32 (w2_t[2]);
197     u32 wb = swap32 (w2_t[3]);
198     u32 wc = swap32 (w3_t[0]);
199     u32 wd = swap32 (w3_t[1]);
200     u32 we = swap32 (w3_t[2]);
201     u32 wf = pw_salt_len * 8;
202
203     /**
204      * sha1
205      */
206
207     u32 a = SHA1M_A;
208     u32 b = SHA1M_B;
209     u32 c = SHA1M_C;
210     u32 d = SHA1M_D;
211     u32 e = SHA1M_E;
212
213     #undef K
214     #define K SHA1C00
215
216     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0);
217     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1);
218     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2);
219     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3);
220     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4);
221     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5);
222     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6);
223     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7);
224     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8);
225     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9);
226     SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa);
227     SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb);
228     SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc);
229     SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd);
230     SHA1_STEP (SHA1_F0o, b, c, d, e, a, we);
231     SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf);
232     w0 = rotl32 ((wd ^ w8 ^ w2 ^ w0), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0);
233     w1 = rotl32 ((we ^ w9 ^ w3 ^ w1), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1);
234     w2 = rotl32 ((wf ^ wa ^ w4 ^ w2), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2);
235     w3 = rotl32 ((w0 ^ wb ^ w5 ^ w3), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3);
236
237     #undef K
238     #define K SHA1C01
239
240     w4 = rotl32 ((w1 ^ wc ^ w6 ^ w4), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4);
241     w5 = rotl32 ((w2 ^ wd ^ w7 ^ w5), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5);
242     w6 = rotl32 ((w3 ^ we ^ w8 ^ w6), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6);
243     w7 = rotl32 ((w4 ^ wf ^ w9 ^ w7), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7);
244     w8 = rotl32 ((w5 ^ w0 ^ wa ^ w8), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8);
245     w9 = rotl32 ((w6 ^ w1 ^ wb ^ w9), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9);
246     wa = rotl32 ((w7 ^ w2 ^ wc ^ wa), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa);
247     wb = rotl32 ((w8 ^ w3 ^ wd ^ wb), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb);
248     wc = rotl32 ((w9 ^ w4 ^ we ^ wc), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc);
249     wd = rotl32 ((wa ^ w5 ^ wf ^ wd), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd);
250     we = rotl32 ((wb ^ w6 ^ w0 ^ we), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we);
251     wf = rotl32 ((wc ^ w7 ^ w1 ^ wf), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf);
252     w0 = rotl32 ((wd ^ w8 ^ w2 ^ w0), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0);
253     w1 = rotl32 ((we ^ w9 ^ w3 ^ w1), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1);
254     w2 = rotl32 ((wf ^ wa ^ w4 ^ w2), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2);
255     w3 = rotl32 ((w0 ^ wb ^ w5 ^ w3), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3);
256     w4 = rotl32 ((w1 ^ wc ^ w6 ^ w4), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4);
257     w5 = rotl32 ((w2 ^ wd ^ w7 ^ w5), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5);
258     w6 = rotl32 ((w3 ^ we ^ w8 ^ w6), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6);
259     w7 = rotl32 ((w4 ^ wf ^ w9 ^ w7), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7);
260
261     #undef K
262     #define K SHA1C02
263
264     w8 = rotl32 ((w5 ^ w0 ^ wa ^ w8), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8);
265     w9 = rotl32 ((w6 ^ w1 ^ wb ^ w9), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9);
266     wa = rotl32 ((w7 ^ w2 ^ wc ^ wa), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa);
267     wb = rotl32 ((w8 ^ w3 ^ wd ^ wb), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb);
268     wc = rotl32 ((w9 ^ w4 ^ we ^ wc), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc);
269     wd = rotl32 ((wa ^ w5 ^ wf ^ wd), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd);
270     we = rotl32 ((wb ^ w6 ^ w0 ^ we), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we);
271     wf = rotl32 ((wc ^ w7 ^ w1 ^ wf), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf);
272     w0 = rotl32 ((wd ^ w8 ^ w2 ^ w0), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0);
273     w1 = rotl32 ((we ^ w9 ^ w3 ^ w1), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1);
274     w2 = rotl32 ((wf ^ wa ^ w4 ^ w2), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2);
275     w3 = rotl32 ((w0 ^ wb ^ w5 ^ w3), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3);
276     w4 = rotl32 ((w1 ^ wc ^ w6 ^ w4), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4);
277     w5 = rotl32 ((w2 ^ wd ^ w7 ^ w5), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5);
278     w6 = rotl32 ((w3 ^ we ^ w8 ^ w6), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6);
279     w7 = rotl32 ((w4 ^ wf ^ w9 ^ w7), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7);
280     w8 = rotl32 ((w5 ^ w0 ^ wa ^ w8), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8);
281     w9 = rotl32 ((w6 ^ w1 ^ wb ^ w9), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9);
282     wa = rotl32 ((w7 ^ w2 ^ wc ^ wa), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa);
283     wb = rotl32 ((w8 ^ w3 ^ wd ^ wb), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb);
284
285     #undef K
286     #define K SHA1C03
287
288     wc = rotl32 ((w9 ^ w4 ^ we ^ wc), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc);
289     wd = rotl32 ((wa ^ w5 ^ wf ^ wd), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd);
290     we = rotl32 ((wb ^ w6 ^ w0 ^ we), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we);
291     wf = rotl32 ((wc ^ w7 ^ w1 ^ wf), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf);
292     w0 = rotl32 ((wd ^ w8 ^ w2 ^ w0), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0);
293     w1 = rotl32 ((we ^ w9 ^ w3 ^ w1), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1);
294     w2 = rotl32 ((wf ^ wa ^ w4 ^ w2), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2);
295     w3 = rotl32 ((w0 ^ wb ^ w5 ^ w3), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3);
296     w4 = rotl32 ((w1 ^ wc ^ w6 ^ w4), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4);
297     w5 = rotl32 ((w2 ^ wd ^ w7 ^ w5), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5);
298     w6 = rotl32 ((w3 ^ we ^ w8 ^ w6), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6);
299     w7 = rotl32 ((w4 ^ wf ^ w9 ^ w7), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7);
300     w8 = rotl32 ((w5 ^ w0 ^ wa ^ w8), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8);
301     w9 = rotl32 ((w6 ^ w1 ^ wb ^ w9), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9);
302     wa = rotl32 ((w7 ^ w2 ^ wc ^ wa), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa);
303     wb = rotl32 ((w8 ^ w3 ^ wd ^ wb), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb);
304     wc = rotl32 ((w9 ^ w4 ^ we ^ wc), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc);
305     wd = rotl32 ((wa ^ w5 ^ wf ^ wd), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd);
306     we = rotl32 ((wb ^ w6 ^ w0 ^ we), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we);
307     wf = rotl32 ((wc ^ w7 ^ w1 ^ wf), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf);
308
309     const u32 r0 = d;
310     const u32 r1 = e;
311     const u32 r2 = c;
312     const u32 r3 = b;
313
314     #include COMPARE_M
315   }
316 }
317
318 static void m04900s (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_len, __global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __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)
319 {
320   /**
321    * modifier
322    */
323
324   const u32 gid = get_global_id (0);
325   const u32 lid = get_local_id (0);
326
327   /**
328    * digest
329    */
330
331   const u32 search[4] =
332   {
333     digests_buf[digests_offset].digest_buf[DGST_R0],
334     digests_buf[digests_offset].digest_buf[DGST_R1],
335     digests_buf[digests_offset].digest_buf[DGST_R2],
336     digests_buf[digests_offset].digest_buf[DGST_R3]
337   };
338
339   /**
340    * reverse
341    */
342
343   const u32 e_rev = rotl32 (search[1], 2u);
344
345   /**
346    * salt
347    */
348
349   u32 salt_buf0_t[4];
350
351   salt_buf0_t[0] = salt_bufs[salt_pos].salt_buf[0];
352   salt_buf0_t[1] = salt_bufs[salt_pos].salt_buf[1];
353   salt_buf0_t[2] = salt_bufs[salt_pos].salt_buf[2];
354   salt_buf0_t[3] = salt_bufs[salt_pos].salt_buf[3];
355
356   u32 salt_buf1_t[4];
357
358   salt_buf1_t[0] = salt_bufs[salt_pos].salt_buf[4];
359   salt_buf1_t[1] = salt_bufs[salt_pos].salt_buf[5];
360   salt_buf1_t[2] = salt_bufs[salt_pos].salt_buf[6];
361   salt_buf1_t[3] = salt_bufs[salt_pos].salt_buf[7];
362
363   u32 salt_buf2_t[4];
364
365   salt_buf2_t[0] = 0;
366   salt_buf2_t[1] = 0;
367   salt_buf2_t[2] = 0;
368   salt_buf2_t[3] = 0;
369
370   u32 salt_buf3_t[4];
371
372   salt_buf3_t[0] = 0;
373   salt_buf3_t[1] = 0;
374   salt_buf3_t[2] = 0;
375   salt_buf3_t[3] = 0;
376
377   const u32 salt_len = salt_bufs[salt_pos].salt_len;
378
379   const u32 pw_salt_len = salt_len + pw_len + salt_len;
380
381   // first we need to switch the right-hand salt to the correct position (2nd salt)
382
383   switch_buffer_by_offset (salt_buf0_t, salt_buf1_t, salt_buf2_t, salt_buf3_t, salt_len + pw_len);
384
385   u32 salt_buf0[4];
386
387   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[0];
388   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[1];
389   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[2];
390   salt_buf0[3] = salt_bufs[salt_pos].salt_buf[3];
391
392   u32 salt_buf1[4];
393
394   salt_buf1[0] = salt_bufs[salt_pos].salt_buf[4];
395   salt_buf1[1] = salt_bufs[salt_pos].salt_buf[5];
396   salt_buf1[2] = salt_bufs[salt_pos].salt_buf[6];
397   salt_buf1[3] = salt_bufs[salt_pos].salt_buf[7];
398
399   u32 salt_buf2[4];
400
401   salt_buf2[0] = 0;
402   salt_buf2[1] = 0;
403   salt_buf2[2] = 0;
404   salt_buf2[3] = 0;
405
406   u32 salt_buf3[4];
407
408   salt_buf3[0] = 0;
409   salt_buf3[1] = 0;
410   salt_buf3[2] = 0;
411   salt_buf3[3] = 0;
412
413   // concatenate the 1st and 2nd instance of the salt
414
415   salt_buf0[0] |= salt_buf0_t[0];
416   salt_buf0[1] |= salt_buf0_t[1];
417   salt_buf0[2] |= salt_buf0_t[2];
418   salt_buf0[3] |= salt_buf0_t[3];
419
420   salt_buf1[0] |= salt_buf1_t[0];
421   salt_buf1[1] |= salt_buf1_t[1];
422   salt_buf1[2] |= salt_buf1_t[2];
423   salt_buf1[3] |= salt_buf1_t[3];
424
425   salt_buf2[0] |= salt_buf2_t[0];
426   salt_buf2[1] |= salt_buf2_t[1];
427   salt_buf2[2] |= salt_buf2_t[2];
428   salt_buf2[3] |= salt_buf2_t[3];
429
430   salt_buf3[0] |= salt_buf3_t[0];
431   salt_buf3[1] |= salt_buf3_t[1];
432   salt_buf3[2] |= salt_buf3_t[2];
433   salt_buf3[3] |= salt_buf3_t[3];
434
435   append_0x80_4x4 (salt_buf0, salt_buf1, salt_buf2, salt_buf3, pw_salt_len);
436
437   /**
438    * loop
439    */
440
441   u32 w0l = w0[0];
442
443   for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos++)
444   {
445     const u32 w0r = bfs_buf[il_pos].i;
446
447     w0[0] = w0l | w0r;
448
449     u32 w0_t[4];
450
451     w0_t[0] = w0[0];
452     w0_t[1] = w0[1];
453     w0_t[2] = w0[2];
454     w0_t[3] = w0[3];
455
456     u32 w1_t[4];
457
458     w1_t[0] = w1[0];
459     w1_t[1] = w1[1];
460     w1_t[2] = w1[2];
461     w1_t[3] = w1[3];
462
463     u32 w2_t[4];
464
465     w2_t[0] = w2[0];
466     w2_t[1] = w2[1];
467     w2_t[2] = w2[2];
468     w2_t[3] = w2[3];
469
470     u32 w3_t[4];
471
472     w3_t[0] = w3[0];
473     w3_t[1] = w3[1];
474     w3_t[2] = w3[2];
475     w3_t[3] = w3[3];
476
477     /**
478      * put the password after the first salt but before the second salt
479      */
480
481     switch_buffer_by_offset (w0_t, w1_t, w2_t, w3_t, salt_len);
482
483     w0_t[0] |= salt_buf0[0];
484     w0_t[1] |= salt_buf0[1];
485     w0_t[2] |= salt_buf0[2];
486     w0_t[3] |= salt_buf0[3];
487     w1_t[0] |= salt_buf1[0];
488     w1_t[1] |= salt_buf1[1];
489     w1_t[2] |= salt_buf1[2];
490     w1_t[3] |= salt_buf1[3];
491     w2_t[0] |= salt_buf2[0];
492     w2_t[1] |= salt_buf2[1];
493     w2_t[2] |= salt_buf2[2];
494     w2_t[3] |= salt_buf2[3];
495     w3_t[0] |= salt_buf3[0];
496     w3_t[1] |= salt_buf3[1];
497     w3_t[2] |= salt_buf3[2];
498
499     u32 w0 = swap32 (w0_t[0]);
500     u32 w1 = swap32 (w0_t[1]);
501     u32 w2 = swap32 (w0_t[2]);
502     u32 w3 = swap32 (w0_t[3]);
503     u32 w4 = swap32 (w1_t[0]);
504     u32 w5 = swap32 (w1_t[1]);
505     u32 w6 = swap32 (w1_t[2]);
506     u32 w7 = swap32 (w1_t[3]);
507     u32 w8 = swap32 (w2_t[0]);
508     u32 w9 = swap32 (w2_t[1]);
509     u32 wa = swap32 (w2_t[2]);
510     u32 wb = swap32 (w2_t[3]);
511     u32 wc = swap32 (w3_t[0]);
512     u32 wd = swap32 (w3_t[1]);
513     u32 we = swap32 (w3_t[2]);
514     u32 wf = pw_salt_len * 8;
515
516     /**
517      * sha1
518      */
519
520     u32 a = SHA1M_A;
521     u32 b = SHA1M_B;
522     u32 c = SHA1M_C;
523     u32 d = SHA1M_D;
524     u32 e = SHA1M_E;
525
526     #undef K
527     #define K SHA1C00
528
529     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0);
530     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1);
531     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2);
532     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3);
533     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4);
534     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5);
535     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6);
536     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7);
537     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8);
538     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9);
539     SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa);
540     SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb);
541     SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc);
542     SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd);
543     SHA1_STEP (SHA1_F0o, b, c, d, e, a, we);
544     SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf);
545     w0 = rotl32 ((wd ^ w8 ^ w2 ^ w0), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0);
546     w1 = rotl32 ((we ^ w9 ^ w3 ^ w1), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1);
547     w2 = rotl32 ((wf ^ wa ^ w4 ^ w2), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2);
548     w3 = rotl32 ((w0 ^ wb ^ w5 ^ w3), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3);
549
550     #undef K
551     #define K SHA1C01
552
553     w4 = rotl32 ((w1 ^ wc ^ w6 ^ w4), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4);
554     w5 = rotl32 ((w2 ^ wd ^ w7 ^ w5), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5);
555     w6 = rotl32 ((w3 ^ we ^ w8 ^ w6), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6);
556     w7 = rotl32 ((w4 ^ wf ^ w9 ^ w7), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7);
557     w8 = rotl32 ((w5 ^ w0 ^ wa ^ w8), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8);
558     w9 = rotl32 ((w6 ^ w1 ^ wb ^ w9), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9);
559     wa = rotl32 ((w7 ^ w2 ^ wc ^ wa), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa);
560     wb = rotl32 ((w8 ^ w3 ^ wd ^ wb), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb);
561     wc = rotl32 ((w9 ^ w4 ^ we ^ wc), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc);
562     wd = rotl32 ((wa ^ w5 ^ wf ^ wd), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd);
563     we = rotl32 ((wb ^ w6 ^ w0 ^ we), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we);
564     wf = rotl32 ((wc ^ w7 ^ w1 ^ wf), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf);
565     w0 = rotl32 ((wd ^ w8 ^ w2 ^ w0), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0);
566     w1 = rotl32 ((we ^ w9 ^ w3 ^ w1), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1);
567     w2 = rotl32 ((wf ^ wa ^ w4 ^ w2), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2);
568     w3 = rotl32 ((w0 ^ wb ^ w5 ^ w3), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3);
569     w4 = rotl32 ((w1 ^ wc ^ w6 ^ w4), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4);
570     w5 = rotl32 ((w2 ^ wd ^ w7 ^ w5), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5);
571     w6 = rotl32 ((w3 ^ we ^ w8 ^ w6), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6);
572     w7 = rotl32 ((w4 ^ wf ^ w9 ^ w7), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7);
573
574     #undef K
575     #define K SHA1C02
576
577     w8 = rotl32 ((w5 ^ w0 ^ wa ^ w8), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8);
578     w9 = rotl32 ((w6 ^ w1 ^ wb ^ w9), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9);
579     wa = rotl32 ((w7 ^ w2 ^ wc ^ wa), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa);
580     wb = rotl32 ((w8 ^ w3 ^ wd ^ wb), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb);
581     wc = rotl32 ((w9 ^ w4 ^ we ^ wc), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc);
582     wd = rotl32 ((wa ^ w5 ^ wf ^ wd), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd);
583     we = rotl32 ((wb ^ w6 ^ w0 ^ we), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we);
584     wf = rotl32 ((wc ^ w7 ^ w1 ^ wf), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf);
585     w0 = rotl32 ((wd ^ w8 ^ w2 ^ w0), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0);
586     w1 = rotl32 ((we ^ w9 ^ w3 ^ w1), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1);
587     w2 = rotl32 ((wf ^ wa ^ w4 ^ w2), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2);
588     w3 = rotl32 ((w0 ^ wb ^ w5 ^ w3), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3);
589     w4 = rotl32 ((w1 ^ wc ^ w6 ^ w4), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4);
590     w5 = rotl32 ((w2 ^ wd ^ w7 ^ w5), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5);
591     w6 = rotl32 ((w3 ^ we ^ w8 ^ w6), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6);
592     w7 = rotl32 ((w4 ^ wf ^ w9 ^ w7), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7);
593     w8 = rotl32 ((w5 ^ w0 ^ wa ^ w8), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8);
594     w9 = rotl32 ((w6 ^ w1 ^ wb ^ w9), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9);
595     wa = rotl32 ((w7 ^ w2 ^ wc ^ wa), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa);
596     wb = rotl32 ((w8 ^ w3 ^ wd ^ wb), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb);
597
598     #undef K
599     #define K SHA1C03
600
601     wc = rotl32 ((w9 ^ w4 ^ we ^ wc), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc);
602     wd = rotl32 ((wa ^ w5 ^ wf ^ wd), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd);
603     we = rotl32 ((wb ^ w6 ^ w0 ^ we), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we);
604     wf = rotl32 ((wc ^ w7 ^ w1 ^ wf), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf);
605     w0 = rotl32 ((wd ^ w8 ^ w2 ^ w0), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0);
606     w1 = rotl32 ((we ^ w9 ^ w3 ^ w1), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1);
607     w2 = rotl32 ((wf ^ wa ^ w4 ^ w2), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2);
608     w3 = rotl32 ((w0 ^ wb ^ w5 ^ w3), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3);
609     w4 = rotl32 ((w1 ^ wc ^ w6 ^ w4), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4);
610     w5 = rotl32 ((w2 ^ wd ^ w7 ^ w5), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5);
611     w6 = rotl32 ((w3 ^ we ^ w8 ^ w6), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6);
612     w7 = rotl32 ((w4 ^ wf ^ w9 ^ w7), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7);
613     w8 = rotl32 ((w5 ^ w0 ^ wa ^ w8), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8);
614     w9 = rotl32 ((w6 ^ w1 ^ wb ^ w9), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9);
615     wa = rotl32 ((w7 ^ w2 ^ wc ^ wa), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa);
616     wb = rotl32 ((w8 ^ w3 ^ wd ^ wb), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb);
617
618     if (allx (e != e_rev)) continue;
619
620     wc = rotl32 ((w9 ^ w4 ^ we ^ wc), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc);
621     wd = rotl32 ((wa ^ w5 ^ wf ^ wd), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd);
622     we = rotl32 ((wb ^ w6 ^ w0 ^ we), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we);
623     wf = rotl32 ((wc ^ w7 ^ w1 ^ wf), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf);
624
625     const u32 r0 = d;
626     const u32 r1 = e;
627     const u32 r2 = c;
628     const u32 r3 = b;
629
630     #include COMPARE_S
631   }
632 }
633
634 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m04900_m04 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __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)
635 {
636   /**
637    * base
638    */
639
640   const u32 gid = get_global_id (0);
641
642   if (gid >= gid_max) return;
643
644   /**
645    * modifier
646    */
647
648   const u32 lid = get_local_id (0);
649
650   u32 w0[4];
651
652   w0[0] = pws[gid].i[ 0];
653   w0[1] = pws[gid].i[ 1];
654   w0[2] = pws[gid].i[ 2];
655   w0[3] = pws[gid].i[ 3];
656
657   u32 w1[4];
658
659   w1[0] = 0;
660   w1[1] = 0;
661   w1[2] = 0;
662   w1[3] = 0;
663
664   u32 w2[4];
665
666   w2[0] = 0;
667   w2[1] = 0;
668   w2[2] = 0;
669   w2[3] = 0;
670
671   u32 w3[4];
672
673   w3[0] = 0;
674   w3[1] = 0;
675   w3[2] = pws[gid].i[14];
676   w3[3] = 0;
677
678   const u32 pw_len = pws[gid].pw_len;
679
680   /**
681    * main
682    */
683
684   m04900m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, 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);
685 }
686
687 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m04900_m08 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __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)
688 {
689   /**
690    * base
691    */
692
693   const u32 gid = get_global_id (0);
694
695   if (gid >= gid_max) return;
696
697   /**
698    * modifier
699    */
700
701   const u32 lid = get_local_id (0);
702
703   u32 w0[4];
704
705   w0[0] = pws[gid].i[ 0];
706   w0[1] = pws[gid].i[ 1];
707   w0[2] = pws[gid].i[ 2];
708   w0[3] = pws[gid].i[ 3];
709
710   u32 w1[4];
711
712   w1[0] = pws[gid].i[ 4];
713   w1[1] = pws[gid].i[ 5];
714   w1[2] = pws[gid].i[ 6];
715   w1[3] = pws[gid].i[ 7];
716
717   u32 w2[4];
718
719   w2[0] = 0;
720   w2[1] = 0;
721   w2[2] = 0;
722   w2[3] = 0;
723
724   u32 w3[4];
725
726   w3[0] = 0;
727   w3[1] = 0;
728   w3[2] = pws[gid].i[14];
729   w3[3] = 0;
730
731   const u32 pw_len = pws[gid].pw_len;
732
733   /**
734    * main
735    */
736
737   m04900m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, 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);
738 }
739
740 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m04900_m16 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __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)
741 {
742   /**
743    * base
744    */
745
746   const u32 gid = get_global_id (0);
747
748   if (gid >= gid_max) return;
749
750   /**
751    * modifier
752    */
753
754   const u32 lid = get_local_id (0);
755
756   u32 w0[4];
757
758   w0[0] = pws[gid].i[ 0];
759   w0[1] = pws[gid].i[ 1];
760   w0[2] = pws[gid].i[ 2];
761   w0[3] = pws[gid].i[ 3];
762
763   u32 w1[4];
764
765   w1[0] = pws[gid].i[ 4];
766   w1[1] = pws[gid].i[ 5];
767   w1[2] = pws[gid].i[ 6];
768   w1[3] = pws[gid].i[ 7];
769
770   u32 w2[4];
771
772   w2[0] = pws[gid].i[ 8];
773   w2[1] = pws[gid].i[ 9];
774   w2[2] = pws[gid].i[10];
775   w2[3] = pws[gid].i[11];
776
777   u32 w3[4];
778
779   w3[0] = pws[gid].i[12];
780   w3[1] = pws[gid].i[13];
781   w3[2] = pws[gid].i[14];
782   w3[3] = pws[gid].i[15];
783
784   const u32 pw_len = pws[gid].pw_len;
785
786   /**
787    * main
788    */
789
790   m04900m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, 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);
791 }
792
793 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m04900_s04 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __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)
794 {
795   /**
796    * base
797    */
798
799   const u32 gid = get_global_id (0);
800
801   if (gid >= gid_max) return;
802
803   /**
804    * modifier
805    */
806
807   const u32 lid = get_local_id (0);
808
809   u32 w0[4];
810
811   w0[0] = pws[gid].i[ 0];
812   w0[1] = pws[gid].i[ 1];
813   w0[2] = pws[gid].i[ 2];
814   w0[3] = pws[gid].i[ 3];
815
816   u32 w1[4];
817
818   w1[0] = 0;
819   w1[1] = 0;
820   w1[2] = 0;
821   w1[3] = 0;
822
823   u32 w2[4];
824
825   w2[0] = 0;
826   w2[1] = 0;
827   w2[2] = 0;
828   w2[3] = 0;
829
830   u32 w3[4];
831
832   w3[0] = 0;
833   w3[1] = 0;
834   w3[2] = pws[gid].i[14];
835   w3[3] = 0;
836
837   const u32 pw_len = pws[gid].pw_len;
838
839   /**
840    * main
841    */
842
843   m04900s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, 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);
844 }
845
846 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m04900_s08 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __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)
847 {
848   /**
849    * base
850    */
851
852   const u32 gid = get_global_id (0);
853
854   if (gid >= gid_max) return;
855
856   /**
857    * modifier
858    */
859
860   const u32 lid = get_local_id (0);
861
862   u32 w0[4];
863
864   w0[0] = pws[gid].i[ 0];
865   w0[1] = pws[gid].i[ 1];
866   w0[2] = pws[gid].i[ 2];
867   w0[3] = pws[gid].i[ 3];
868
869   u32 w1[4];
870
871   w1[0] = pws[gid].i[ 4];
872   w1[1] = pws[gid].i[ 5];
873   w1[2] = pws[gid].i[ 6];
874   w1[3] = pws[gid].i[ 7];
875
876   u32 w2[4];
877
878   w2[0] = 0;
879   w2[1] = 0;
880   w2[2] = 0;
881   w2[3] = 0;
882
883   u32 w3[4];
884
885   w3[0] = 0;
886   w3[1] = 0;
887   w3[2] = pws[gid].i[14];
888   w3[3] = 0;
889
890   const u32 pw_len = pws[gid].pw_len;
891
892   /**
893    * main
894    */
895
896   m04900s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, 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);
897 }
898
899 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m04900_s16 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __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)
900 {
901   /**
902    * base
903    */
904
905   const u32 gid = get_global_id (0);
906
907   if (gid >= gid_max) return;
908
909   /**
910    * modifier
911    */
912
913   const u32 lid = get_local_id (0);
914
915   u32 w0[4];
916
917   w0[0] = pws[gid].i[ 0];
918   w0[1] = pws[gid].i[ 1];
919   w0[2] = pws[gid].i[ 2];
920   w0[3] = pws[gid].i[ 3];
921
922   u32 w1[4];
923
924   w1[0] = pws[gid].i[ 4];
925   w1[1] = pws[gid].i[ 5];
926   w1[2] = pws[gid].i[ 6];
927   w1[3] = pws[gid].i[ 7];
928
929   u32 w2[4];
930
931   w2[0] = pws[gid].i[ 8];
932   w2[1] = pws[gid].i[ 9];
933   w2[2] = pws[gid].i[10];
934   w2[3] = pws[gid].i[11];
935
936   u32 w3[4];
937
938   w3[0] = pws[gid].i[12];
939   w3[1] = pws[gid].i[13];
940   w3[2] = pws[gid].i[14];
941   w3[3] = pws[gid].i[15];
942
943   const u32 pw_len = pws[gid].pw_len;
944
945   /**
946    * main
947    */
948
949   m04900s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, 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);
950 }