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