Fix m 60 a 0 by making modified variable non-const
[hashcat.git] / OpenCL / m02710_a3.cl
1 /**
2  * Authors.....: Jens Steube <jens.steube@gmail.com>
3  *               Gabriele Gristina <matrix@hashcat.net>
4  *               magnum <john.magnum@hushmail.com>
5  *
6  * License.....: MIT
7  */
8
9 #define _MD5_
10
11 #define NEW_SIMD_CODE
12
13 #include "inc_vendor.cl"
14 #include "inc_hash_constants.h"
15 #include "inc_hash_functions.cl"
16 #include "inc_types.cl"
17 #include "inc_common.cl"
18 #include "inc_simd.cl"
19
20 #if   VECT_SIZE == 1
21 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i)])
22 #elif VECT_SIZE == 2
23 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1])
24 #elif VECT_SIZE == 4
25 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1], l_bin2asc[(i).s2], l_bin2asc[(i).s3])
26 #elif VECT_SIZE == 8
27 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1], l_bin2asc[(i).s2], l_bin2asc[(i).s3], l_bin2asc[(i).s4], l_bin2asc[(i).s5], l_bin2asc[(i).s6], l_bin2asc[(i).s7])
28 #elif VECT_SIZE == 16
29 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1], l_bin2asc[(i).s2], l_bin2asc[(i).s3], l_bin2asc[(i).s4], l_bin2asc[(i).s5], l_bin2asc[(i).s6], l_bin2asc[(i).s7], l_bin2asc[(i).s8], l_bin2asc[(i).s9], l_bin2asc[(i).sa], l_bin2asc[(i).sb], l_bin2asc[(i).sc], l_bin2asc[(i).sd], l_bin2asc[(i).se], l_bin2asc[(i).sf])
30 #endif
31
32 void m02710m (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, __local u32 *l_bin2asc)
33 {
34   /**
35    * modifier
36    */
37
38   const u32 gid = get_global_id (0);
39   const u32 lid = get_local_id (0);
40
41   /**
42    * salt
43    */
44
45   u32 salt_buf0[4];
46   u32 salt_buf1[4];
47   u32 salt_buf2[4];
48   u32 salt_buf3[4];
49
50   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[0];
51   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[1];
52   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[2];
53   salt_buf0[3] = salt_bufs[salt_pos].salt_buf[3];
54   salt_buf1[0] = salt_bufs[salt_pos].salt_buf[4];
55   salt_buf1[1] = salt_bufs[salt_pos].salt_buf[5];
56   salt_buf1[2] = salt_bufs[salt_pos].salt_buf[6];
57   salt_buf1[3] = salt_bufs[salt_pos].salt_buf[7];
58   salt_buf2[0] = 0;
59   salt_buf2[1] = 0;
60   salt_buf2[2] = 0;
61   salt_buf2[3] = 0;
62   salt_buf3[0] = 0;
63   salt_buf3[1] = 0;
64   salt_buf3[2] = 0;
65   salt_buf3[3] = 0;
66
67   const u32 salt_len = salt_bufs[salt_pos].salt_len;
68
69   /**
70    * loop
71    */
72
73   u32 w0l = w0[0];
74
75   for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
76   {
77     const u32x w0r = ix_create_bft (bfs_buf, il_pos);
78
79     const u32x w0lr = w0l | w0r;
80
81     u32x w0_t[4];
82     u32x w1_t[4];
83     u32x w2_t[4];
84     u32x w3_t[4];
85
86     w0_t[0] = w0lr;
87     w0_t[1] = w0[1];
88     w0_t[2] = w0[2];
89     w0_t[3] = w0[3];
90     w1_t[0] = w1[0];
91     w1_t[1] = w1[1];
92     w1_t[2] = w1[2];
93     w1_t[3] = w1[3];
94     w2_t[0] = w2[0];
95     w2_t[1] = w2[1];
96     w2_t[2] = w2[2];
97     w2_t[3] = w2[3];
98     w3_t[0] = w3[0];
99     w3_t[1] = w3[1];
100     w3_t[2] = w3[2];
101     w3_t[3] = w3[3];
102
103     /**
104      * md5
105      */
106
107     u32x a = MD5M_A;
108     u32x b = MD5M_B;
109     u32x c = MD5M_C;
110     u32x d = MD5M_D;
111
112     MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
113     MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
114     MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
115     MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
116     MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
117     MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
118     MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
119     MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
120     MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
121     MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
122     MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
123     MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
124     MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
125     MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
126     MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
127     MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
128
129     MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
130     MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
131     MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
132     MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
133     MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
134     MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
135     MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
136     MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
137     MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
138     MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
139     MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
140     MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
141     MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
142     MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
143     MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
144     MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
145
146     MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
147     MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
148     MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
149     MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
150     MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
151     MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
152     MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
153     MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
154     MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
155     MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
156     MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
157     MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
158     MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
159     MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
160     MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
161     MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
162
163     MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
164     MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
165     MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
166     MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
167     MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
168     MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
169     MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
170     MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
171     MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
172     MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
173     MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
174     MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
175     MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
176     MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
177     MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
178     MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
179
180     a += MD5M_A;
181     b += MD5M_B;
182     c += MD5M_C;
183     d += MD5M_D;
184
185     w0_t[0] = uint_to_hex_lower8 ((a >>  0) & 255) <<  0
186             | uint_to_hex_lower8 ((a >>  8) & 255) << 16;
187     w0_t[1] = uint_to_hex_lower8 ((a >> 16) & 255) <<  0
188             | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
189     w0_t[2] = uint_to_hex_lower8 ((b >>  0) & 255) <<  0
190             | uint_to_hex_lower8 ((b >>  8) & 255) << 16;
191     w0_t[3] = uint_to_hex_lower8 ((b >> 16) & 255) <<  0
192             | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
193     w1_t[0] = uint_to_hex_lower8 ((c >>  0) & 255) <<  0
194             | uint_to_hex_lower8 ((c >>  8) & 255) << 16;
195     w1_t[1] = uint_to_hex_lower8 ((c >> 16) & 255) <<  0
196             | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
197     w1_t[2] = uint_to_hex_lower8 ((d >>  0) & 255) <<  0
198             | uint_to_hex_lower8 ((d >>  8) & 255) << 16;
199     w1_t[3] = uint_to_hex_lower8 ((d >> 16) & 255) <<  0
200             | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
201
202     w2_t[0] = salt_buf0[0];
203     w2_t[1] = salt_buf0[1];
204     w2_t[2] = salt_buf0[2];
205     w2_t[3] = salt_buf0[3];
206     w3_t[0] = salt_buf1[0];
207     w3_t[1] = salt_buf1[1];
208     w3_t[2] = salt_buf1[2];
209     w3_t[3] = salt_buf1[3];
210
211     a = MD5M_A;
212     b = MD5M_B;
213     c = MD5M_C;
214     d = MD5M_D;
215
216     MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
217     MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
218     MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
219     MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
220     MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
221     MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
222     MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
223     MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
224     MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
225     MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
226     MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
227     MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
228     MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
229     MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
230     MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
231     MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
232
233     MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
234     MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
235     MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
236     MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
237     MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
238     MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
239     MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
240     MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
241     MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
242     MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
243     MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
244     MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
245     MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
246     MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
247     MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
248     MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
249
250     MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
251     MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
252     MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
253     MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
254     MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
255     MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
256     MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
257     MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
258     MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
259     MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
260     MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
261     MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
262     MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
263     MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
264     MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
265     MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
266
267     MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
268     MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
269     MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
270     MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
271     MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
272     MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
273     MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
274     MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
275     MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
276     MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
277     MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
278     MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
279     MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
280     MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
281     MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
282     MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
283
284     const u32x r_a = a + MD5M_A;
285     const u32x r_b = b + MD5M_B;
286     const u32x r_c = c + MD5M_C;
287     const u32x r_d = d + MD5M_D;
288
289     const u32x r_14 = (32 + salt_len) * 8;
290
291     a = r_a;
292     b = r_b;
293     c = r_c;
294     d = r_d;
295
296     MD5_STEP0(MD5_Fo, a, b, c, d,       MD5C00, MD5S00);
297     MD5_STEP0(MD5_Fo, d, a, b, c,       MD5C01, MD5S01);
298     MD5_STEP0(MD5_Fo, c, d, a, b,       MD5C02, MD5S02);
299     MD5_STEP0(MD5_Fo, b, c, d, a,       MD5C03, MD5S03);
300     MD5_STEP0(MD5_Fo, a, b, c, d,       MD5C04, MD5S00);
301     MD5_STEP0(MD5_Fo, d, a, b, c,       MD5C05, MD5S01);
302     MD5_STEP0(MD5_Fo, c, d, a, b,       MD5C06, MD5S02);
303     MD5_STEP0(MD5_Fo, b, c, d, a,       MD5C07, MD5S03);
304     MD5_STEP0(MD5_Fo, a, b, c, d,       MD5C08, MD5S00);
305     MD5_STEP0(MD5_Fo, d, a, b, c,       MD5C09, MD5S01);
306     MD5_STEP0(MD5_Fo, c, d, a, b,       MD5C0a, MD5S02);
307     MD5_STEP0(MD5_Fo, b, c, d, a,       MD5C0b, MD5S03);
308     MD5_STEP0(MD5_Fo, a, b, c, d,       MD5C0c, MD5S00);
309     MD5_STEP0(MD5_Fo, d, a, b, c,       MD5C0d, MD5S01);
310     MD5_STEP (MD5_Fo, c, d, a, b, r_14, MD5C0e, MD5S02);
311     MD5_STEP0(MD5_Fo, b, c, d, a,       MD5C0f, MD5S03);
312
313     MD5_STEP0(MD5_Go, a, b, c, d,       MD5C10, MD5S10);
314     MD5_STEP0(MD5_Go, d, a, b, c,       MD5C11, MD5S11);
315     MD5_STEP0(MD5_Go, c, d, a, b,       MD5C12, MD5S12);
316     MD5_STEP0(MD5_Go, b, c, d, a,       MD5C13, MD5S13);
317     MD5_STEP0(MD5_Go, a, b, c, d,       MD5C14, MD5S10);
318     MD5_STEP0(MD5_Go, d, a, b, c,       MD5C15, MD5S11);
319     MD5_STEP0(MD5_Go, c, d, a, b,       MD5C16, MD5S12);
320     MD5_STEP0(MD5_Go, b, c, d, a,       MD5C17, MD5S13);
321     MD5_STEP0(MD5_Go, a, b, c, d,       MD5C18, MD5S10);
322     MD5_STEP (MD5_Go, d, a, b, c, r_14, MD5C19, MD5S11);
323     MD5_STEP0(MD5_Go, c, d, a, b,       MD5C1a, MD5S12);
324     MD5_STEP0(MD5_Go, b, c, d, a,       MD5C1b, MD5S13);
325     MD5_STEP0(MD5_Go, a, b, c, d,       MD5C1c, MD5S10);
326     MD5_STEP0(MD5_Go, d, a, b, c,       MD5C1d, MD5S11);
327     MD5_STEP0(MD5_Go, c, d, a, b,       MD5C1e, MD5S12);
328     MD5_STEP0(MD5_Go, b, c, d, a,       MD5C1f, MD5S13);
329
330     MD5_STEP0(MD5_H , a, b, c, d,       MD5C20, MD5S20);
331     MD5_STEP0(MD5_H , d, a, b, c,       MD5C21, MD5S21);
332     MD5_STEP0(MD5_H , c, d, a, b,       MD5C22, MD5S22);
333     MD5_STEP (MD5_H , b, c, d, a, r_14, MD5C23, MD5S23);
334     MD5_STEP0(MD5_H , a, b, c, d,       MD5C24, MD5S20);
335     MD5_STEP0(MD5_H , d, a, b, c,       MD5C25, MD5S21);
336     MD5_STEP0(MD5_H , c, d, a, b,       MD5C26, MD5S22);
337     MD5_STEP0(MD5_H , b, c, d, a,       MD5C27, MD5S23);
338     MD5_STEP0(MD5_H , a, b, c, d,       MD5C28, MD5S20);
339     MD5_STEP0(MD5_H , d, a, b, c,       MD5C29, MD5S21);
340     MD5_STEP0(MD5_H , c, d, a, b,       MD5C2a, MD5S22);
341     MD5_STEP0(MD5_H , b, c, d, a,       MD5C2b, MD5S23);
342     MD5_STEP0(MD5_H , a, b, c, d,       MD5C2c, MD5S20);
343     MD5_STEP0(MD5_H , d, a, b, c,       MD5C2d, MD5S21);
344     MD5_STEP0(MD5_H , c, d, a, b,       MD5C2e, MD5S22);
345     MD5_STEP0(MD5_H , b, c, d, a,       MD5C2f, MD5S23);
346
347     MD5_STEP0(MD5_I , a, b, c, d,       MD5C30, MD5S30);
348     MD5_STEP0(MD5_I , d, a, b, c,       MD5C31, MD5S31);
349     MD5_STEP (MD5_I , c, d, a, b, r_14, MD5C32, MD5S32);
350     MD5_STEP0(MD5_I , b, c, d, a,       MD5C33, MD5S33);
351     MD5_STEP0(MD5_I , a, b, c, d,       MD5C34, MD5S30);
352     MD5_STEP0(MD5_I , d, a, b, c,       MD5C35, MD5S31);
353     MD5_STEP0(MD5_I , c, d, a, b,       MD5C36, MD5S32);
354     MD5_STEP0(MD5_I , b, c, d, a,       MD5C37, MD5S33);
355     MD5_STEP0(MD5_I , a, b, c, d,       MD5C38, MD5S30);
356     MD5_STEP0(MD5_I , d, a, b, c,       MD5C39, MD5S31);
357     MD5_STEP0(MD5_I , c, d, a, b,       MD5C3a, MD5S32);
358     MD5_STEP0(MD5_I , b, c, d, a,       MD5C3b, MD5S33);
359     MD5_STEP0(MD5_I , a, b, c, d,       MD5C3c, MD5S30);
360     MD5_STEP0(MD5_I , d, a, b, c,       MD5C3d, MD5S31);
361     MD5_STEP0(MD5_I , c, d, a, b,       MD5C3e, MD5S32);
362     MD5_STEP0(MD5_I , b, c, d, a,       MD5C3f, MD5S33);
363
364     a += r_a;
365     b += r_b;
366     c += r_c;
367     d += r_d;
368
369     COMPARE_M_SIMD (a, d, c, b);
370   }
371 }
372
373 void m02710s (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, __local u32 *l_bin2asc)
374 {
375   /**
376    * modifier
377    */
378
379   const u32 gid = get_global_id (0);
380   const u32 lid = get_local_id (0);
381
382   /**
383    * salt
384    */
385
386   u32 salt_buf0[4];
387   u32 salt_buf1[4];
388   u32 salt_buf2[4];
389   u32 salt_buf3[4];
390
391   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[0];
392   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[1];
393   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[2];
394   salt_buf0[3] = salt_bufs[salt_pos].salt_buf[3];
395   salt_buf1[0] = salt_bufs[salt_pos].salt_buf[4];
396   salt_buf1[1] = salt_bufs[salt_pos].salt_buf[5];
397   salt_buf1[2] = salt_bufs[salt_pos].salt_buf[6];
398   salt_buf1[3] = salt_bufs[salt_pos].salt_buf[7];
399   salt_buf2[0] = 0;
400   salt_buf2[1] = 0;
401   salt_buf2[2] = 0;
402   salt_buf2[3] = 0;
403   salt_buf3[0] = 0;
404   salt_buf3[1] = 0;
405   salt_buf3[2] = 0;
406   salt_buf3[3] = 0;
407
408   const u32 salt_len = salt_bufs[salt_pos].salt_len;
409
410   /**
411    * digest
412    */
413
414   const u32 search[4] =
415   {
416     digests_buf[digests_offset].digest_buf[DGST_R0],
417     digests_buf[digests_offset].digest_buf[DGST_R1],
418     digests_buf[digests_offset].digest_buf[DGST_R2],
419     digests_buf[digests_offset].digest_buf[DGST_R3]
420   };
421
422   /**
423    * loop
424    */
425
426   u32 w0l = w0[0];
427
428   for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
429   {
430     const u32x w0r = ix_create_bft (bfs_buf, il_pos);
431
432     const u32x w0lr = w0l | w0r;
433
434     u32x w0_t[4];
435     u32x w1_t[4];
436     u32x w2_t[4];
437     u32x w3_t[4];
438
439     w0_t[0] = w0lr;
440     w0_t[1] = w0[1];
441     w0_t[2] = w0[2];
442     w0_t[3] = w0[3];
443     w1_t[0] = w1[0];
444     w1_t[1] = w1[1];
445     w1_t[2] = w1[2];
446     w1_t[3] = w1[3];
447     w2_t[0] = w2[0];
448     w2_t[1] = w2[1];
449     w2_t[2] = w2[2];
450     w2_t[3] = w2[3];
451     w3_t[0] = w3[0];
452     w3_t[1] = w3[1];
453     w3_t[2] = w3[2];
454     w3_t[3] = w3[3];
455
456     /**
457      * md5
458      */
459
460     u32x a = MD5M_A;
461     u32x b = MD5M_B;
462     u32x c = MD5M_C;
463     u32x d = MD5M_D;
464
465     MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
466     MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
467     MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
468     MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
469     MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
470     MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
471     MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
472     MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
473     MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
474     MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
475     MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
476     MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
477     MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
478     MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
479     MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
480     MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
481
482     MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
483     MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
484     MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
485     MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
486     MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
487     MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
488     MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
489     MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
490     MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
491     MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
492     MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
493     MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
494     MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
495     MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
496     MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
497     MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
498
499     MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
500     MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
501     MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
502     MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
503     MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
504     MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
505     MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
506     MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
507     MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
508     MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
509     MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
510     MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
511     MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
512     MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
513     MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
514     MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
515
516     MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
517     MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
518     MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
519     MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
520     MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
521     MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
522     MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
523     MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
524     MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
525     MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
526     MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
527     MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
528     MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
529     MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
530     MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
531     MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
532
533     a += MD5M_A;
534     b += MD5M_B;
535     c += MD5M_C;
536     d += MD5M_D;
537
538     w0_t[0] = uint_to_hex_lower8 ((a >>  0) & 255) <<  0
539             | uint_to_hex_lower8 ((a >>  8) & 255) << 16;
540     w0_t[1] = uint_to_hex_lower8 ((a >> 16) & 255) <<  0
541             | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
542     w0_t[2] = uint_to_hex_lower8 ((b >>  0) & 255) <<  0
543             | uint_to_hex_lower8 ((b >>  8) & 255) << 16;
544     w0_t[3] = uint_to_hex_lower8 ((b >> 16) & 255) <<  0
545             | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
546     w1_t[0] = uint_to_hex_lower8 ((c >>  0) & 255) <<  0
547             | uint_to_hex_lower8 ((c >>  8) & 255) << 16;
548     w1_t[1] = uint_to_hex_lower8 ((c >> 16) & 255) <<  0
549             | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
550     w1_t[2] = uint_to_hex_lower8 ((d >>  0) & 255) <<  0
551             | uint_to_hex_lower8 ((d >>  8) & 255) << 16;
552     w1_t[3] = uint_to_hex_lower8 ((d >> 16) & 255) <<  0
553             | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
554
555     w2_t[0] = salt_buf0[0];
556     w2_t[1] = salt_buf0[1];
557     w2_t[2] = salt_buf0[2];
558     w2_t[3] = salt_buf0[3];
559     w3_t[0] = salt_buf1[0];
560     w3_t[1] = salt_buf1[1];
561     w3_t[2] = salt_buf1[2];
562     w3_t[3] = salt_buf1[3];
563
564     a = MD5M_A;
565     b = MD5M_B;
566     c = MD5M_C;
567     d = MD5M_D;
568
569     MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
570     MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
571     MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
572     MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
573     MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
574     MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
575     MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
576     MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
577     MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
578     MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
579     MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
580     MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
581     MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
582     MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
583     MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
584     MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
585
586     MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
587     MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
588     MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
589     MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
590     MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
591     MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
592     MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
593     MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
594     MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
595     MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
596     MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
597     MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
598     MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
599     MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
600     MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
601     MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
602
603     MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
604     MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
605     MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
606     MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
607     MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
608     MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
609     MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
610     MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
611     MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
612     MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
613     MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
614     MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
615     MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
616     MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
617     MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
618     MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
619
620     MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
621     MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
622     MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
623     MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
624     MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
625     MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
626     MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
627     MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
628     MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
629     MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
630     MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
631     MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
632     MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
633     MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
634     MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
635     MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
636
637     const u32x r_a = a + MD5M_A;
638     const u32x r_b = b + MD5M_B;
639     const u32x r_c = c + MD5M_C;
640     const u32x r_d = d + MD5M_D;
641
642     const u32x r_14 = (32 + salt_len) * 8;
643
644     a = r_a;
645     b = r_b;
646     c = r_c;
647     d = r_d;
648
649     MD5_STEP0(MD5_Fo, a, b, c, d,       MD5C00, MD5S00);
650     MD5_STEP0(MD5_Fo, d, a, b, c,       MD5C01, MD5S01);
651     MD5_STEP0(MD5_Fo, c, d, a, b,       MD5C02, MD5S02);
652     MD5_STEP0(MD5_Fo, b, c, d, a,       MD5C03, MD5S03);
653     MD5_STEP0(MD5_Fo, a, b, c, d,       MD5C04, MD5S00);
654     MD5_STEP0(MD5_Fo, d, a, b, c,       MD5C05, MD5S01);
655     MD5_STEP0(MD5_Fo, c, d, a, b,       MD5C06, MD5S02);
656     MD5_STEP0(MD5_Fo, b, c, d, a,       MD5C07, MD5S03);
657     MD5_STEP0(MD5_Fo, a, b, c, d,       MD5C08, MD5S00);
658     MD5_STEP0(MD5_Fo, d, a, b, c,       MD5C09, MD5S01);
659     MD5_STEP0(MD5_Fo, c, d, a, b,       MD5C0a, MD5S02);
660     MD5_STEP0(MD5_Fo, b, c, d, a,       MD5C0b, MD5S03);
661     MD5_STEP0(MD5_Fo, a, b, c, d,       MD5C0c, MD5S00);
662     MD5_STEP0(MD5_Fo, d, a, b, c,       MD5C0d, MD5S01);
663     MD5_STEP (MD5_Fo, c, d, a, b, r_14, MD5C0e, MD5S02);
664     MD5_STEP0(MD5_Fo, b, c, d, a,       MD5C0f, MD5S03);
665
666     MD5_STEP0(MD5_Go, a, b, c, d,       MD5C10, MD5S10);
667     MD5_STEP0(MD5_Go, d, a, b, c,       MD5C11, MD5S11);
668     MD5_STEP0(MD5_Go, c, d, a, b,       MD5C12, MD5S12);
669     MD5_STEP0(MD5_Go, b, c, d, a,       MD5C13, MD5S13);
670     MD5_STEP0(MD5_Go, a, b, c, d,       MD5C14, MD5S10);
671     MD5_STEP0(MD5_Go, d, a, b, c,       MD5C15, MD5S11);
672     MD5_STEP0(MD5_Go, c, d, a, b,       MD5C16, MD5S12);
673     MD5_STEP0(MD5_Go, b, c, d, a,       MD5C17, MD5S13);
674     MD5_STEP0(MD5_Go, a, b, c, d,       MD5C18, MD5S10);
675     MD5_STEP (MD5_Go, d, a, b, c, r_14, MD5C19, MD5S11);
676     MD5_STEP0(MD5_Go, c, d, a, b,       MD5C1a, MD5S12);
677     MD5_STEP0(MD5_Go, b, c, d, a,       MD5C1b, MD5S13);
678     MD5_STEP0(MD5_Go, a, b, c, d,       MD5C1c, MD5S10);
679     MD5_STEP0(MD5_Go, d, a, b, c,       MD5C1d, MD5S11);
680     MD5_STEP0(MD5_Go, c, d, a, b,       MD5C1e, MD5S12);
681     MD5_STEP0(MD5_Go, b, c, d, a,       MD5C1f, MD5S13);
682
683     MD5_STEP0(MD5_H , a, b, c, d,       MD5C20, MD5S20);
684     MD5_STEP0(MD5_H , d, a, b, c,       MD5C21, MD5S21);
685     MD5_STEP0(MD5_H , c, d, a, b,       MD5C22, MD5S22);
686     MD5_STEP (MD5_H , b, c, d, a, r_14, MD5C23, MD5S23);
687     MD5_STEP0(MD5_H , a, b, c, d,       MD5C24, MD5S20);
688     MD5_STEP0(MD5_H , d, a, b, c,       MD5C25, MD5S21);
689     MD5_STEP0(MD5_H , c, d, a, b,       MD5C26, MD5S22);
690     MD5_STEP0(MD5_H , b, c, d, a,       MD5C27, MD5S23);
691     MD5_STEP0(MD5_H , a, b, c, d,       MD5C28, MD5S20);
692     MD5_STEP0(MD5_H , d, a, b, c,       MD5C29, MD5S21);
693     MD5_STEP0(MD5_H , c, d, a, b,       MD5C2a, MD5S22);
694     MD5_STEP0(MD5_H , b, c, d, a,       MD5C2b, MD5S23);
695     MD5_STEP0(MD5_H , a, b, c, d,       MD5C2c, MD5S20);
696     MD5_STEP0(MD5_H , d, a, b, c,       MD5C2d, MD5S21);
697     MD5_STEP0(MD5_H , c, d, a, b,       MD5C2e, MD5S22);
698     MD5_STEP0(MD5_H , b, c, d, a,       MD5C2f, MD5S23);
699
700     MD5_STEP0(MD5_I , a, b, c, d,       MD5C30, MD5S30);
701     MD5_STEP0(MD5_I , d, a, b, c,       MD5C31, MD5S31);
702     MD5_STEP (MD5_I , c, d, a, b, r_14, MD5C32, MD5S32);
703     MD5_STEP0(MD5_I , b, c, d, a,       MD5C33, MD5S33);
704     MD5_STEP0(MD5_I , a, b, c, d,       MD5C34, MD5S30);
705     MD5_STEP0(MD5_I , d, a, b, c,       MD5C35, MD5S31);
706     MD5_STEP0(MD5_I , c, d, a, b,       MD5C36, MD5S32);
707     MD5_STEP0(MD5_I , b, c, d, a,       MD5C37, MD5S33);
708     MD5_STEP0(MD5_I , a, b, c, d,       MD5C38, MD5S30);
709     MD5_STEP0(MD5_I , d, a, b, c,       MD5C39, MD5S31);
710     MD5_STEP0(MD5_I , c, d, a, b,       MD5C3a, MD5S32);
711     MD5_STEP0(MD5_I , b, c, d, a,       MD5C3b, MD5S33);
712     MD5_STEP0(MD5_I , a, b, c, d,       MD5C3c, MD5S30);
713
714     if (MATCHES_NONE_VS ((a + r_a), search[0])) continue;
715
716     MD5_STEP0(MD5_I , d, a, b, c,       MD5C3d, MD5S31);
717     MD5_STEP0(MD5_I , c, d, a, b,       MD5C3e, MD5S32);
718     MD5_STEP0(MD5_I , b, c, d, a,       MD5C3f, MD5S33);
719
720     a += r_a;
721     b += r_b;
722     c += r_c;
723     d += r_d;
724
725     COMPARE_S_SIMD (a, d, c, b);
726   }
727 }
728
729 __kernel void m02710_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)
730 {
731   /**
732    * base
733    */
734
735   const u32 gid = get_global_id (0);
736   const u32 lid = get_local_id (0);
737   const u32 lsz = get_local_size (0);
738
739   /**
740    * modifier
741    */
742
743   u32 w0[4];
744
745   w0[0] = pws[gid].i[ 0];
746   w0[1] = pws[gid].i[ 1];
747   w0[2] = pws[gid].i[ 2];
748   w0[3] = pws[gid].i[ 3];
749
750   u32 w1[4];
751
752   w1[0] = 0;
753   w1[1] = 0;
754   w1[2] = 0;
755   w1[3] = 0;
756
757   u32 w2[4];
758
759   w2[0] = 0;
760   w2[1] = 0;
761   w2[2] = 0;
762   w2[3] = 0;
763
764   u32 w3[4];
765
766   w3[0] = 0;
767   w3[1] = 0;
768   w3[2] = pws[gid].i[14];
769   w3[3] = 0;
770
771   const u32 pw_len = pws[gid].pw_len;
772
773   /**
774    * bin2asc table
775    */
776
777   __local u32 l_bin2asc[256];
778
779   for (u32 i = lid; i < 256; i += lsz)
780   {
781     const u32 i0 = (i >> 0) & 15;
782     const u32 i1 = (i >> 4) & 15;
783
784     l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 8
785                  | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 0;
786   }
787
788   barrier (CLK_LOCAL_MEM_FENCE);
789
790   if (gid >= gid_max) return;
791
792   /**
793    * main
794    */
795
796   m02710m (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, l_bin2asc);
797 }
798
799 __kernel void m02710_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)
800 {
801   /**
802    * base
803    */
804
805   const u32 gid = get_global_id (0);
806   const u32 lid = get_local_id (0);
807   const u32 lsz = get_local_size (0);
808
809   /**
810    * modifier
811    */
812
813   u32 w0[4];
814
815   w0[0] = pws[gid].i[ 0];
816   w0[1] = pws[gid].i[ 1];
817   w0[2] = pws[gid].i[ 2];
818   w0[3] = pws[gid].i[ 3];
819
820   u32 w1[4];
821
822   w1[0] = pws[gid].i[ 4];
823   w1[1] = pws[gid].i[ 5];
824   w1[2] = pws[gid].i[ 6];
825   w1[3] = pws[gid].i[ 7];
826
827   u32 w2[4];
828
829   w2[0] = 0;
830   w2[1] = 0;
831   w2[2] = 0;
832   w2[3] = 0;
833
834   u32 w3[4];
835
836   w3[0] = 0;
837   w3[1] = 0;
838   w3[2] = pws[gid].i[14];
839   w3[3] = 0;
840
841   const u32 pw_len = pws[gid].pw_len;
842
843   /**
844    * bin2asc table
845    */
846
847   __local u32 l_bin2asc[256];
848
849   for (u32 i = lid; i < 256; i += lsz)
850   {
851     const u32 i0 = (i >> 0) & 15;
852     const u32 i1 = (i >> 4) & 15;
853
854     l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 8
855                  | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 0;
856   }
857
858   barrier (CLK_LOCAL_MEM_FENCE);
859
860   if (gid >= gid_max) return;
861
862   /**
863    * main
864    */
865
866   m02710m (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, l_bin2asc);
867 }
868
869 __kernel void m02710_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)
870 {
871   /**
872    * base
873    */
874
875   const u32 gid = get_global_id (0);
876   const u32 lid = get_local_id (0);
877   const u32 lsz = get_local_size (0);
878
879   /**
880    * modifier
881    */
882
883   u32 w0[4];
884
885   w0[0] = pws[gid].i[ 0];
886   w0[1] = pws[gid].i[ 1];
887   w0[2] = pws[gid].i[ 2];
888   w0[3] = pws[gid].i[ 3];
889
890   u32 w1[4];
891
892   w1[0] = pws[gid].i[ 4];
893   w1[1] = pws[gid].i[ 5];
894   w1[2] = pws[gid].i[ 6];
895   w1[3] = pws[gid].i[ 7];
896
897   u32 w2[4];
898
899   w2[0] = pws[gid].i[ 8];
900   w2[1] = pws[gid].i[ 9];
901   w2[2] = pws[gid].i[10];
902   w2[3] = pws[gid].i[11];
903
904   u32 w3[4];
905
906   w3[0] = pws[gid].i[12];
907   w3[1] = pws[gid].i[13];
908   w3[2] = pws[gid].i[14];
909   w3[3] = pws[gid].i[15];
910
911   const u32 pw_len = pws[gid].pw_len;
912
913   /**
914    * bin2asc table
915    */
916
917   __local u32 l_bin2asc[256];
918
919   for (u32 i = lid; i < 256; i += lsz)
920   {
921     const u32 i0 = (i >> 0) & 15;
922     const u32 i1 = (i >> 4) & 15;
923
924     l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 8
925                  | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 0;
926   }
927
928   barrier (CLK_LOCAL_MEM_FENCE);
929
930   if (gid >= gid_max) return;
931
932   /**
933    * main
934    */
935
936   m02710m (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, l_bin2asc);
937 }
938
939 __kernel void m02710_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)
940 {
941   /**
942    * base
943    */
944
945   const u32 gid = get_global_id (0);
946   const u32 lid = get_local_id (0);
947   const u32 lsz = get_local_size (0);
948
949   /**
950    * modifier
951    */
952
953   u32 w0[4];
954
955   w0[0] = pws[gid].i[ 0];
956   w0[1] = pws[gid].i[ 1];
957   w0[2] = pws[gid].i[ 2];
958   w0[3] = pws[gid].i[ 3];
959
960   u32 w1[4];
961
962   w1[0] = 0;
963   w1[1] = 0;
964   w1[2] = 0;
965   w1[3] = 0;
966
967   u32 w2[4];
968
969   w2[0] = 0;
970   w2[1] = 0;
971   w2[2] = 0;
972   w2[3] = 0;
973
974   u32 w3[4];
975
976   w3[0] = 0;
977   w3[1] = 0;
978   w3[2] = pws[gid].i[14];
979   w3[3] = 0;
980
981   const u32 pw_len = pws[gid].pw_len;
982
983   /**
984    * bin2asc table
985    */
986
987   __local u32 l_bin2asc[256];
988
989   for (u32 i = lid; i < 256; i += lsz)
990   {
991     const u32 i0 = (i >> 0) & 15;
992     const u32 i1 = (i >> 4) & 15;
993
994     l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 8
995                  | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 0;
996   }
997
998   barrier (CLK_LOCAL_MEM_FENCE);
999
1000   if (gid >= gid_max) return;
1001
1002   /**
1003    * main
1004    */
1005
1006   m02710s (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, l_bin2asc);
1007 }
1008
1009 __kernel void m02710_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)
1010 {
1011   /**
1012    * base
1013    */
1014
1015   const u32 gid = get_global_id (0);
1016   const u32 lid = get_local_id (0);
1017   const u32 lsz = get_local_size (0);
1018
1019   /**
1020    * modifier
1021    */
1022
1023   u32 w0[4];
1024
1025   w0[0] = pws[gid].i[ 0];
1026   w0[1] = pws[gid].i[ 1];
1027   w0[2] = pws[gid].i[ 2];
1028   w0[3] = pws[gid].i[ 3];
1029
1030   u32 w1[4];
1031
1032   w1[0] = pws[gid].i[ 4];
1033   w1[1] = pws[gid].i[ 5];
1034   w1[2] = pws[gid].i[ 6];
1035   w1[3] = pws[gid].i[ 7];
1036
1037   u32 w2[4];
1038
1039   w2[0] = 0;
1040   w2[1] = 0;
1041   w2[2] = 0;
1042   w2[3] = 0;
1043
1044   u32 w3[4];
1045
1046   w3[0] = 0;
1047   w3[1] = 0;
1048   w3[2] = pws[gid].i[14];
1049   w3[3] = 0;
1050
1051   const u32 pw_len = pws[gid].pw_len;
1052
1053   /**
1054    * bin2asc table
1055    */
1056
1057   __local u32 l_bin2asc[256];
1058
1059   for (u32 i = lid; i < 256; i += lsz)
1060   {
1061     const u32 i0 = (i >> 0) & 15;
1062     const u32 i1 = (i >> 4) & 15;
1063
1064     l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 8
1065                  | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 0;
1066   }
1067
1068   barrier (CLK_LOCAL_MEM_FENCE);
1069
1070   if (gid >= gid_max) return;
1071
1072   /**
1073    * main
1074    */
1075
1076   m02710s (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, l_bin2asc);
1077 }
1078
1079 __kernel void m02710_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)
1080 {
1081   /**
1082    * base
1083    */
1084
1085   const u32 gid = get_global_id (0);
1086   const u32 lid = get_local_id (0);
1087   const u32 lsz = get_local_size (0);
1088
1089   /**
1090    * modifier
1091    */
1092
1093   u32 w0[4];
1094
1095   w0[0] = pws[gid].i[ 0];
1096   w0[1] = pws[gid].i[ 1];
1097   w0[2] = pws[gid].i[ 2];
1098   w0[3] = pws[gid].i[ 3];
1099
1100   u32 w1[4];
1101
1102   w1[0] = pws[gid].i[ 4];
1103   w1[1] = pws[gid].i[ 5];
1104   w1[2] = pws[gid].i[ 6];
1105   w1[3] = pws[gid].i[ 7];
1106
1107   u32 w2[4];
1108
1109   w2[0] = pws[gid].i[ 8];
1110   w2[1] = pws[gid].i[ 9];
1111   w2[2] = pws[gid].i[10];
1112   w2[3] = pws[gid].i[11];
1113
1114   u32 w3[4];
1115
1116   w3[0] = pws[gid].i[12];
1117   w3[1] = pws[gid].i[13];
1118   w3[2] = pws[gid].i[14];
1119   w3[3] = pws[gid].i[15];
1120
1121   const u32 pw_len = pws[gid].pw_len;
1122
1123   /**
1124    * bin2asc table
1125    */
1126
1127   __local u32 l_bin2asc[256];
1128
1129   for (u32 i = lid; i < 256; i += lsz)
1130   {
1131     const u32 i0 = (i >> 0) & 15;
1132     const u32 i1 = (i >> 4) & 15;
1133
1134     l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 8
1135                  | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 0;
1136   }
1137
1138   barrier (CLK_LOCAL_MEM_FENCE);
1139
1140   if (gid >= gid_max) return;
1141
1142   /**
1143    * main
1144    */
1145
1146   m02710s (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, l_bin2asc);
1147 }