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