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