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