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