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