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