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