Converted _a3 kernels, use SIMD for CPU and GPU
[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 #define NEW_SIMD_CODE
9
10 #include "include/constants.h"
11 #include "include/kernel_vendor.h"
12
13 #define DGST_R0 3
14 #define DGST_R1 4
15 #define DGST_R2 2
16 #define DGST_R3 1
17
18 #include "include/kernel_functions.c"
19 #include "OpenCL/types_ocl.c"
20 #include "OpenCL/common.c"
21 #include "OpenCL/simd.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 kernel_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_le_S (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_S (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 += VECT_SIZE)
131   {
132     const u32x w0r = w0r_create_bft (bfs_buf, il_pos);
133
134     const u32x w0lr = w0l | w0r;
135
136     u32x w0_t[4];
137
138     w0_t[0] = w0lr;
139     w0_t[1] = w0[1];
140     w0_t[2] = w0[2];
141     w0_t[3] = w0[3];
142
143     u32x 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     u32x 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     u32x 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_le (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     u32x w0 = swap32 (w0_t[0]);
187     u32x w1 = swap32 (w0_t[1]);
188     u32x w2 = swap32 (w0_t[2]);
189     u32x w3 = swap32 (w0_t[3]);
190     u32x w4 = swap32 (w1_t[0]);
191     u32x w5 = swap32 (w1_t[1]);
192     u32x w6 = swap32 (w1_t[2]);
193     u32x w7 = swap32 (w1_t[3]);
194     u32x w8 = swap32 (w2_t[0]);
195     u32x w9 = swap32 (w2_t[1]);
196     u32x wa = swap32 (w2_t[2]);
197     u32x wb = swap32 (w2_t[3]);
198     u32x wc = swap32 (w3_t[0]);
199     u32x wd = swap32 (w3_t[1]);
200     u32x we = swap32 (w3_t[2]);
201     u32x wf = pw_salt_len * 8;
202
203     /**
204      * sha1
205      */
206
207     u32x a = SHA1M_A;
208     u32x b = SHA1M_B;
209     u32x c = SHA1M_C;
210     u32x d = SHA1M_D;
211     u32x 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     COMPARE_M_SIMD (d, e, c, b);
310   }
311 }
312
313 static void m04900s (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_len, __global pw_t *pws, __global kernel_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)
314 {
315   /**
316    * modifier
317    */
318
319   const u32 gid = get_global_id (0);
320   const u32 lid = get_local_id (0);
321
322   /**
323    * digest
324    */
325
326   const u32 search[4] =
327   {
328     digests_buf[digests_offset].digest_buf[DGST_R0],
329     digests_buf[digests_offset].digest_buf[DGST_R1],
330     digests_buf[digests_offset].digest_buf[DGST_R2],
331     digests_buf[digests_offset].digest_buf[DGST_R3]
332   };
333
334   /**
335    * reverse
336    */
337
338   const u32 e_rev = rotl32_S (search[1], 2u);
339
340   /**
341    * salt
342    */
343
344   u32 salt_buf0_t[4];
345
346   salt_buf0_t[0] = salt_bufs[salt_pos].salt_buf[0];
347   salt_buf0_t[1] = salt_bufs[salt_pos].salt_buf[1];
348   salt_buf0_t[2] = salt_bufs[salt_pos].salt_buf[2];
349   salt_buf0_t[3] = salt_bufs[salt_pos].salt_buf[3];
350
351   u32 salt_buf1_t[4];
352
353   salt_buf1_t[0] = salt_bufs[salt_pos].salt_buf[4];
354   salt_buf1_t[1] = salt_bufs[salt_pos].salt_buf[5];
355   salt_buf1_t[2] = salt_bufs[salt_pos].salt_buf[6];
356   salt_buf1_t[3] = salt_bufs[salt_pos].salt_buf[7];
357
358   u32 salt_buf2_t[4];
359
360   salt_buf2_t[0] = 0;
361   salt_buf2_t[1] = 0;
362   salt_buf2_t[2] = 0;
363   salt_buf2_t[3] = 0;
364
365   u32 salt_buf3_t[4];
366
367   salt_buf3_t[0] = 0;
368   salt_buf3_t[1] = 0;
369   salt_buf3_t[2] = 0;
370   salt_buf3_t[3] = 0;
371
372   const u32 salt_len = salt_bufs[salt_pos].salt_len;
373
374   const u32 pw_salt_len = salt_len + pw_len + salt_len;
375
376   // first we need to switch the right-hand salt to the correct position (2nd salt)
377
378   switch_buffer_by_offset_le_S (salt_buf0_t, salt_buf1_t, salt_buf2_t, salt_buf3_t, salt_len + pw_len);
379
380   u32 salt_buf0[4];
381
382   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[0];
383   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[1];
384   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[2];
385   salt_buf0[3] = salt_bufs[salt_pos].salt_buf[3];
386
387   u32 salt_buf1[4];
388
389   salt_buf1[0] = salt_bufs[salt_pos].salt_buf[4];
390   salt_buf1[1] = salt_bufs[salt_pos].salt_buf[5];
391   salt_buf1[2] = salt_bufs[salt_pos].salt_buf[6];
392   salt_buf1[3] = salt_bufs[salt_pos].salt_buf[7];
393
394   u32 salt_buf2[4];
395
396   salt_buf2[0] = 0;
397   salt_buf2[1] = 0;
398   salt_buf2[2] = 0;
399   salt_buf2[3] = 0;
400
401   u32 salt_buf3[4];
402
403   salt_buf3[0] = 0;
404   salt_buf3[1] = 0;
405   salt_buf3[2] = 0;
406   salt_buf3[3] = 0;
407
408   // concatenate the 1st and 2nd instance of the salt
409
410   salt_buf0[0] |= salt_buf0_t[0];
411   salt_buf0[1] |= salt_buf0_t[1];
412   salt_buf0[2] |= salt_buf0_t[2];
413   salt_buf0[3] |= salt_buf0_t[3];
414
415   salt_buf1[0] |= salt_buf1_t[0];
416   salt_buf1[1] |= salt_buf1_t[1];
417   salt_buf1[2] |= salt_buf1_t[2];
418   salt_buf1[3] |= salt_buf1_t[3];
419
420   salt_buf2[0] |= salt_buf2_t[0];
421   salt_buf2[1] |= salt_buf2_t[1];
422   salt_buf2[2] |= salt_buf2_t[2];
423   salt_buf2[3] |= salt_buf2_t[3];
424
425   salt_buf3[0] |= salt_buf3_t[0];
426   salt_buf3[1] |= salt_buf3_t[1];
427   salt_buf3[2] |= salt_buf3_t[2];
428   salt_buf3[3] |= salt_buf3_t[3];
429
430   append_0x80_4x4_S (salt_buf0, salt_buf1, salt_buf2, salt_buf3, pw_salt_len);
431
432   /**
433    * loop
434    */
435
436   u32 w0l = w0[0];
437
438   for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos += VECT_SIZE)
439   {
440     const u32x w0r = w0r_create_bft (bfs_buf, il_pos);
441
442     const u32x w0lr = w0l | w0r;
443
444     u32x w0_t[4];
445
446     w0_t[0] = w0lr;
447     w0_t[1] = w0[1];
448     w0_t[2] = w0[2];
449     w0_t[3] = w0[3];
450
451     u32x w1_t[4];
452
453     w1_t[0] = w1[0];
454     w1_t[1] = w1[1];
455     w1_t[2] = w1[2];
456     w1_t[3] = w1[3];
457
458     u32x w2_t[4];
459
460     w2_t[0] = w2[0];
461     w2_t[1] = w2[1];
462     w2_t[2] = w2[2];
463     w2_t[3] = w2[3];
464
465     u32x w3_t[4];
466
467     w3_t[0] = w3[0];
468     w3_t[1] = w3[1];
469     w3_t[2] = w3[2];
470     w3_t[3] = w3[3];
471
472     /**
473      * put the password after the first salt but before the second salt
474      */
475
476     switch_buffer_by_offset_le (w0_t, w1_t, w2_t, w3_t, salt_len);
477
478     w0_t[0] |= salt_buf0[0];
479     w0_t[1] |= salt_buf0[1];
480     w0_t[2] |= salt_buf0[2];
481     w0_t[3] |= salt_buf0[3];
482     w1_t[0] |= salt_buf1[0];
483     w1_t[1] |= salt_buf1[1];
484     w1_t[2] |= salt_buf1[2];
485     w1_t[3] |= salt_buf1[3];
486     w2_t[0] |= salt_buf2[0];
487     w2_t[1] |= salt_buf2[1];
488     w2_t[2] |= salt_buf2[2];
489     w2_t[3] |= salt_buf2[3];
490     w3_t[0] |= salt_buf3[0];
491     w3_t[1] |= salt_buf3[1];
492     w3_t[2] |= salt_buf3[2];
493
494     u32x w0 = swap32 (w0_t[0]);
495     u32x w1 = swap32 (w0_t[1]);
496     u32x w2 = swap32 (w0_t[2]);
497     u32x w3 = swap32 (w0_t[3]);
498     u32x w4 = swap32 (w1_t[0]);
499     u32x w5 = swap32 (w1_t[1]);
500     u32x w6 = swap32 (w1_t[2]);
501     u32x w7 = swap32 (w1_t[3]);
502     u32x w8 = swap32 (w2_t[0]);
503     u32x w9 = swap32 (w2_t[1]);
504     u32x wa = swap32 (w2_t[2]);
505     u32x wb = swap32 (w2_t[3]);
506     u32x wc = swap32 (w3_t[0]);
507     u32x wd = swap32 (w3_t[1]);
508     u32x we = swap32 (w3_t[2]);
509     u32x wf = pw_salt_len * 8;
510
511     /**
512      * sha1
513      */
514
515     u32x a = SHA1M_A;
516     u32x b = SHA1M_B;
517     u32x c = SHA1M_C;
518     u32x d = SHA1M_D;
519     u32x e = SHA1M_E;
520
521     #undef K
522     #define K SHA1C00
523
524     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0);
525     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1);
526     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2);
527     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3);
528     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4);
529     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5);
530     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6);
531     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7);
532     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8);
533     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9);
534     SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa);
535     SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb);
536     SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc);
537     SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd);
538     SHA1_STEP (SHA1_F0o, b, c, d, e, a, we);
539     SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf);
540     w0 = rotl32 ((wd ^ w8 ^ w2 ^ w0), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0);
541     w1 = rotl32 ((we ^ w9 ^ w3 ^ w1), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1);
542     w2 = rotl32 ((wf ^ wa ^ w4 ^ w2), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2);
543     w3 = rotl32 ((w0 ^ wb ^ w5 ^ w3), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3);
544
545     #undef K
546     #define K SHA1C01
547
548     w4 = rotl32 ((w1 ^ wc ^ w6 ^ w4), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4);
549     w5 = rotl32 ((w2 ^ wd ^ w7 ^ w5), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5);
550     w6 = rotl32 ((w3 ^ we ^ w8 ^ w6), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6);
551     w7 = rotl32 ((w4 ^ wf ^ w9 ^ w7), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7);
552     w8 = rotl32 ((w5 ^ w0 ^ wa ^ w8), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8);
553     w9 = rotl32 ((w6 ^ w1 ^ wb ^ w9), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9);
554     wa = rotl32 ((w7 ^ w2 ^ wc ^ wa), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa);
555     wb = rotl32 ((w8 ^ w3 ^ wd ^ wb), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb);
556     wc = rotl32 ((w9 ^ w4 ^ we ^ wc), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc);
557     wd = rotl32 ((wa ^ w5 ^ wf ^ wd), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd);
558     we = rotl32 ((wb ^ w6 ^ w0 ^ we), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we);
559     wf = rotl32 ((wc ^ w7 ^ w1 ^ wf), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf);
560     w0 = rotl32 ((wd ^ w8 ^ w2 ^ w0), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0);
561     w1 = rotl32 ((we ^ w9 ^ w3 ^ w1), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1);
562     w2 = rotl32 ((wf ^ wa ^ w4 ^ w2), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2);
563     w3 = rotl32 ((w0 ^ wb ^ w5 ^ w3), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3);
564     w4 = rotl32 ((w1 ^ wc ^ w6 ^ w4), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4);
565     w5 = rotl32 ((w2 ^ wd ^ w7 ^ w5), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5);
566     w6 = rotl32 ((w3 ^ we ^ w8 ^ w6), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6);
567     w7 = rotl32 ((w4 ^ wf ^ w9 ^ w7), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7);
568
569     #undef K
570     #define K SHA1C02
571
572     w8 = rotl32 ((w5 ^ w0 ^ wa ^ w8), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8);
573     w9 = rotl32 ((w6 ^ w1 ^ wb ^ w9), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9);
574     wa = rotl32 ((w7 ^ w2 ^ wc ^ wa), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa);
575     wb = rotl32 ((w8 ^ w3 ^ wd ^ wb), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb);
576     wc = rotl32 ((w9 ^ w4 ^ we ^ wc), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc);
577     wd = rotl32 ((wa ^ w5 ^ wf ^ wd), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd);
578     we = rotl32 ((wb ^ w6 ^ w0 ^ we), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we);
579     wf = rotl32 ((wc ^ w7 ^ w1 ^ wf), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf);
580     w0 = rotl32 ((wd ^ w8 ^ w2 ^ w0), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0);
581     w1 = rotl32 ((we ^ w9 ^ w3 ^ w1), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1);
582     w2 = rotl32 ((wf ^ wa ^ w4 ^ w2), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2);
583     w3 = rotl32 ((w0 ^ wb ^ w5 ^ w3), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3);
584     w4 = rotl32 ((w1 ^ wc ^ w6 ^ w4), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4);
585     w5 = rotl32 ((w2 ^ wd ^ w7 ^ w5), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5);
586     w6 = rotl32 ((w3 ^ we ^ w8 ^ w6), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6);
587     w7 = rotl32 ((w4 ^ wf ^ w9 ^ w7), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7);
588     w8 = rotl32 ((w5 ^ w0 ^ wa ^ w8), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8);
589     w9 = rotl32 ((w6 ^ w1 ^ wb ^ w9), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9);
590     wa = rotl32 ((w7 ^ w2 ^ wc ^ wa), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa);
591     wb = rotl32 ((w8 ^ w3 ^ wd ^ wb), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb);
592
593     #undef K
594     #define K SHA1C03
595
596     wc = rotl32 ((w9 ^ w4 ^ we ^ wc), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc);
597     wd = rotl32 ((wa ^ w5 ^ wf ^ wd), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd);
598     we = rotl32 ((wb ^ w6 ^ w0 ^ we), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we);
599     wf = rotl32 ((wc ^ w7 ^ w1 ^ wf), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf);
600     w0 = rotl32 ((wd ^ w8 ^ w2 ^ w0), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0);
601     w1 = rotl32 ((we ^ w9 ^ w3 ^ w1), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1);
602     w2 = rotl32 ((wf ^ wa ^ w4 ^ w2), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2);
603     w3 = rotl32 ((w0 ^ wb ^ w5 ^ w3), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3);
604     w4 = rotl32 ((w1 ^ wc ^ w6 ^ w4), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4);
605     w5 = rotl32 ((w2 ^ wd ^ w7 ^ w5), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5);
606     w6 = rotl32 ((w3 ^ we ^ w8 ^ w6), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6);
607     w7 = rotl32 ((w4 ^ wf ^ w9 ^ w7), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7);
608     w8 = rotl32 ((w5 ^ w0 ^ wa ^ w8), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8);
609     w9 = rotl32 ((w6 ^ w1 ^ wb ^ w9), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9);
610     wa = rotl32 ((w7 ^ w2 ^ wc ^ wa), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa);
611     wb = rotl32 ((w8 ^ w3 ^ wd ^ wb), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb);
612
613     if (MATCHES_NONE_VS (e, e_rev)) continue;
614
615     wc = rotl32 ((w9 ^ w4 ^ we ^ wc), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc);
616     wd = rotl32 ((wa ^ w5 ^ wf ^ wd), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd);
617     we = rotl32 ((wb ^ w6 ^ w0 ^ we), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we);
618     wf = rotl32 ((wc ^ w7 ^ w1 ^ wf), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf);
619
620     COMPARE_S_SIMD (d, e, c, b);
621   }
622 }
623
624 __kernel void m04900_m04 (__global pw_t *pws, __global kernel_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)
625 {
626   /**
627    * base
628    */
629
630   const u32 gid = get_global_id (0);
631
632   if (gid >= gid_max) return;
633
634   /**
635    * modifier
636    */
637
638   const u32 lid = get_local_id (0);
639
640   u32 w0[4];
641
642   w0[0] = pws[gid].i[ 0];
643   w0[1] = pws[gid].i[ 1];
644   w0[2] = pws[gid].i[ 2];
645   w0[3] = pws[gid].i[ 3];
646
647   u32 w1[4];
648
649   w1[0] = 0;
650   w1[1] = 0;
651   w1[2] = 0;
652   w1[3] = 0;
653
654   u32 w2[4];
655
656   w2[0] = 0;
657   w2[1] = 0;
658   w2[2] = 0;
659   w2[3] = 0;
660
661   u32 w3[4];
662
663   w3[0] = 0;
664   w3[1] = 0;
665   w3[2] = pws[gid].i[14];
666   w3[3] = 0;
667
668   const u32 pw_len = pws[gid].pw_len;
669
670   /**
671    * main
672    */
673
674   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);
675 }
676
677 __kernel void m04900_m08 (__global pw_t *pws, __global kernel_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)
678 {
679   /**
680    * base
681    */
682
683   const u32 gid = get_global_id (0);
684
685   if (gid >= gid_max) return;
686
687   /**
688    * modifier
689    */
690
691   const u32 lid = get_local_id (0);
692
693   u32 w0[4];
694
695   w0[0] = pws[gid].i[ 0];
696   w0[1] = pws[gid].i[ 1];
697   w0[2] = pws[gid].i[ 2];
698   w0[3] = pws[gid].i[ 3];
699
700   u32 w1[4];
701
702   w1[0] = pws[gid].i[ 4];
703   w1[1] = pws[gid].i[ 5];
704   w1[2] = pws[gid].i[ 6];
705   w1[3] = pws[gid].i[ 7];
706
707   u32 w2[4];
708
709   w2[0] = 0;
710   w2[1] = 0;
711   w2[2] = 0;
712   w2[3] = 0;
713
714   u32 w3[4];
715
716   w3[0] = 0;
717   w3[1] = 0;
718   w3[2] = pws[gid].i[14];
719   w3[3] = 0;
720
721   const u32 pw_len = pws[gid].pw_len;
722
723   /**
724    * main
725    */
726
727   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);
728 }
729
730 __kernel void m04900_m16 (__global pw_t *pws, __global kernel_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)
731 {
732   /**
733    * base
734    */
735
736   const u32 gid = get_global_id (0);
737
738   if (gid >= gid_max) return;
739
740   /**
741    * modifier
742    */
743
744   const u32 lid = get_local_id (0);
745
746   u32 w0[4];
747
748   w0[0] = pws[gid].i[ 0];
749   w0[1] = pws[gid].i[ 1];
750   w0[2] = pws[gid].i[ 2];
751   w0[3] = pws[gid].i[ 3];
752
753   u32 w1[4];
754
755   w1[0] = pws[gid].i[ 4];
756   w1[1] = pws[gid].i[ 5];
757   w1[2] = pws[gid].i[ 6];
758   w1[3] = pws[gid].i[ 7];
759
760   u32 w2[4];
761
762   w2[0] = pws[gid].i[ 8];
763   w2[1] = pws[gid].i[ 9];
764   w2[2] = pws[gid].i[10];
765   w2[3] = pws[gid].i[11];
766
767   u32 w3[4];
768
769   w3[0] = pws[gid].i[12];
770   w3[1] = pws[gid].i[13];
771   w3[2] = pws[gid].i[14];
772   w3[3] = pws[gid].i[15];
773
774   const u32 pw_len = pws[gid].pw_len;
775
776   /**
777    * main
778    */
779
780   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);
781 }
782
783 __kernel void m04900_s04 (__global pw_t *pws, __global kernel_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)
784 {
785   /**
786    * base
787    */
788
789   const u32 gid = get_global_id (0);
790
791   if (gid >= gid_max) return;
792
793   /**
794    * modifier
795    */
796
797   const u32 lid = get_local_id (0);
798
799   u32 w0[4];
800
801   w0[0] = pws[gid].i[ 0];
802   w0[1] = pws[gid].i[ 1];
803   w0[2] = pws[gid].i[ 2];
804   w0[3] = pws[gid].i[ 3];
805
806   u32 w1[4];
807
808   w1[0] = 0;
809   w1[1] = 0;
810   w1[2] = 0;
811   w1[3] = 0;
812
813   u32 w2[4];
814
815   w2[0] = 0;
816   w2[1] = 0;
817   w2[2] = 0;
818   w2[3] = 0;
819
820   u32 w3[4];
821
822   w3[0] = 0;
823   w3[1] = 0;
824   w3[2] = pws[gid].i[14];
825   w3[3] = 0;
826
827   const u32 pw_len = pws[gid].pw_len;
828
829   /**
830    * main
831    */
832
833   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);
834 }
835
836 __kernel void m04900_s08 (__global pw_t *pws, __global kernel_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)
837 {
838   /**
839    * base
840    */
841
842   const u32 gid = get_global_id (0);
843
844   if (gid >= gid_max) return;
845
846   /**
847    * modifier
848    */
849
850   const u32 lid = get_local_id (0);
851
852   u32 w0[4];
853
854   w0[0] = pws[gid].i[ 0];
855   w0[1] = pws[gid].i[ 1];
856   w0[2] = pws[gid].i[ 2];
857   w0[3] = pws[gid].i[ 3];
858
859   u32 w1[4];
860
861   w1[0] = pws[gid].i[ 4];
862   w1[1] = pws[gid].i[ 5];
863   w1[2] = pws[gid].i[ 6];
864   w1[3] = pws[gid].i[ 7];
865
866   u32 w2[4];
867
868   w2[0] = 0;
869   w2[1] = 0;
870   w2[2] = 0;
871   w2[3] = 0;
872
873   u32 w3[4];
874
875   w3[0] = 0;
876   w3[1] = 0;
877   w3[2] = pws[gid].i[14];
878   w3[3] = 0;
879
880   const u32 pw_len = pws[gid].pw_len;
881
882   /**
883    * main
884    */
885
886   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);
887 }
888
889 __kernel void m04900_s16 (__global pw_t *pws, __global kernel_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)
890 {
891   /**
892    * base
893    */
894
895   const u32 gid = get_global_id (0);
896
897   if (gid >= gid_max) return;
898
899   /**
900    * modifier
901    */
902
903   const u32 lid = get_local_id (0);
904
905   u32 w0[4];
906
907   w0[0] = pws[gid].i[ 0];
908   w0[1] = pws[gid].i[ 1];
909   w0[2] = pws[gid].i[ 2];
910   w0[3] = pws[gid].i[ 3];
911
912   u32 w1[4];
913
914   w1[0] = pws[gid].i[ 4];
915   w1[1] = pws[gid].i[ 5];
916   w1[2] = pws[gid].i[ 6];
917   w1[3] = pws[gid].i[ 7];
918
919   u32 w2[4];
920
921   w2[0] = pws[gid].i[ 8];
922   w2[1] = pws[gid].i[ 9];
923   w2[2] = pws[gid].i[10];
924   w2[3] = pws[gid].i[11];
925
926   u32 w3[4];
927
928   w3[0] = pws[gid].i[12];
929   w3[1] = pws[gid].i[13];
930   w3[2] = pws[gid].i[14];
931   w3[3] = pws[gid].i[15];
932
933   const u32 pw_len = pws[gid].pw_len;
934
935   /**
936    * main
937    */
938
939   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);
940 }