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