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