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