2 * Author......: Jens Steube <jens.steube@gmail.com>
10 #include "include/constants.h"
11 #include "include/kernel_vendor.h"
18 #include "include/kernel_functions.c"
19 #include "OpenCL/types_ocl.c"
20 #include "OpenCL/common.c"
21 #include "include/rp_kernel.h"
22 #include "OpenCL/rp.c"
23 #include "OpenCL/simd.c"
26 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i)])
28 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1])
30 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1], l_bin2asc[(i).s2], l_bin2asc[(i).s3])
32 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1], l_bin2asc[(i).s2], l_bin2asc[(i).s3], l_bin2asc[(i).s4], l_bin2asc[(i).s5], l_bin2asc[(i).s6], l_bin2asc[(i).s7])
35 __kernel void m03710_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 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
41 const u32 gid = get_global_id (0);
42 const u32 lid = get_local_id (0);
43 const u32 lsz = get_local_size (0);
49 __local u32 l_bin2asc[256];
51 for (u32 i = lid; i < 256; i += lsz)
53 const u32 i0 = (i >> 0) & 15;
54 const u32 i1 = (i >> 4) & 15;
56 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 8
57 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 0;
60 barrier (CLK_LOCAL_MEM_FENCE);
62 if (gid >= gid_max) return;
70 pw_buf0[0] = pws[gid].i[ 0];
71 pw_buf0[1] = pws[gid].i[ 1];
72 pw_buf0[2] = pws[gid].i[ 2];
73 pw_buf0[3] = pws[gid].i[ 3];
77 pw_buf1[0] = pws[gid].i[ 4];
78 pw_buf1[1] = pws[gid].i[ 5];
79 pw_buf1[2] = pws[gid].i[ 6];
80 pw_buf1[3] = pws[gid].i[ 7];
82 const u32 pw_len = pws[gid].pw_len;
90 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
91 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
92 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
93 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
97 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
98 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
99 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
100 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
116 const u32 salt_len = salt_bufs[salt_pos].salt_len;
118 const u32 pw_salt_len = 32 + salt_len;
124 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos += VECT_SIZE)
131 const u32 out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
133 append_0x80_2x4 (w0, w1, out_len);
142 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
143 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
144 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
145 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
146 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
147 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
148 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
149 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
150 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
151 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
152 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
153 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
154 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
155 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
156 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
157 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
159 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
160 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
161 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
162 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
163 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
164 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
165 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
166 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
167 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
168 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
169 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
170 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
171 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
172 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
173 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
174 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
176 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
177 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
178 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
179 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
180 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
181 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
182 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
183 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
184 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
185 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
186 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
187 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
188 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
189 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
190 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
191 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
193 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
194 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
195 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
196 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
197 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
198 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
199 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
200 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
201 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
202 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
203 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
204 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
205 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
206 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
207 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
208 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
220 w0_t[0] = uint_to_hex_lower8 ((a >> 0) & 255) << 0
221 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
222 w0_t[1] = uint_to_hex_lower8 ((a >> 16) & 255) << 0
223 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
224 w0_t[2] = uint_to_hex_lower8 ((b >> 0) & 255) << 0
225 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
226 w0_t[3] = uint_to_hex_lower8 ((b >> 16) & 255) << 0
227 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
228 w1_t[0] = uint_to_hex_lower8 ((c >> 0) & 255) << 0
229 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
230 w1_t[1] = uint_to_hex_lower8 ((c >> 16) & 255) << 0
231 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
232 w1_t[2] = uint_to_hex_lower8 ((d >> 0) & 255) << 0
233 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
234 w1_t[3] = uint_to_hex_lower8 ((d >> 16) & 255) << 0
235 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
237 w2_t[0] = 0x00000080;
251 switch_buffer_by_offset_le (w0_t, w1_t, w2_t, w3_t, salt_len);
253 w3_t[2] = pw_salt_len * 8;
255 w0_t[0] |= salt_buf0[0];
256 w0_t[1] |= salt_buf0[1];
257 w0_t[2] |= salt_buf0[2];
258 w0_t[3] |= salt_buf0[3];
259 w1_t[0] |= salt_buf1[0];
260 w1_t[1] |= salt_buf1[1];
261 w1_t[2] |= salt_buf1[2];
262 w1_t[3] |= salt_buf1[3];
263 w2_t[0] |= salt_buf2[0];
264 w2_t[1] |= salt_buf2[1];
265 w2_t[2] |= salt_buf2[2];
266 w2_t[3] |= salt_buf2[3];
267 w3_t[0] |= salt_buf3[0];
268 w3_t[1] |= salt_buf3[1];
269 w3_t[2] |= salt_buf3[2];
270 w3_t[3] |= salt_buf3[3];
281 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
282 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
283 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
284 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
285 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
286 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
287 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
288 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
289 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
290 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
291 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
292 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
293 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
294 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
295 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
296 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
298 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
299 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
300 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
301 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
302 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
303 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
304 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
305 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
306 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
307 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
308 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
309 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
310 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
311 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
312 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
313 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
315 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
316 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
317 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
318 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
319 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
320 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
321 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
322 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
323 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
324 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
325 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
326 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
327 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
328 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
329 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
330 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
332 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
333 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
334 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
335 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
336 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
337 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
338 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
339 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
340 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
341 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
342 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
343 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
344 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
345 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
346 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
347 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
349 COMPARE_M_SIMD (a, d, c, b);
353 __kernel void m03710_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
357 __kernel void m03710_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
361 __kernel void m03710_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 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
367 const u32 gid = get_global_id (0);
368 const u32 lid = get_local_id (0);
369 const u32 lsz = get_local_size (0);
375 __local u32 l_bin2asc[256];
377 for (u32 i = lid; i < 256; i += lsz)
379 const u32 i0 = (i >> 0) & 15;
380 const u32 i1 = (i >> 4) & 15;
382 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 8
383 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 0;
386 barrier (CLK_LOCAL_MEM_FENCE);
388 if (gid >= gid_max) return;
396 pw_buf0[0] = pws[gid].i[ 0];
397 pw_buf0[1] = pws[gid].i[ 1];
398 pw_buf0[2] = pws[gid].i[ 2];
399 pw_buf0[3] = pws[gid].i[ 3];
403 pw_buf1[0] = pws[gid].i[ 4];
404 pw_buf1[1] = pws[gid].i[ 5];
405 pw_buf1[2] = pws[gid].i[ 6];
406 pw_buf1[3] = pws[gid].i[ 7];
408 const u32 pw_len = pws[gid].pw_len;
416 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
417 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
418 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
419 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
423 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
424 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
425 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
426 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
442 const u32 salt_len = salt_bufs[salt_pos].salt_len;
444 const u32 pw_salt_len = 32 + salt_len;
450 const u32 search[4] =
452 digests_buf[digests_offset].digest_buf[DGST_R0],
453 digests_buf[digests_offset].digest_buf[DGST_R1],
454 digests_buf[digests_offset].digest_buf[DGST_R2],
455 digests_buf[digests_offset].digest_buf[DGST_R3]
462 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos += VECT_SIZE)
469 const u32 out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
471 append_0x80_2x4 (w0, w1, out_len);
480 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
481 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
482 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
483 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
484 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
485 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
486 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
487 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
488 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
489 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
490 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
491 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
492 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
493 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
494 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
495 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
497 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
498 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
499 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
500 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
501 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
502 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
503 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
504 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
505 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
506 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
507 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
508 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
509 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
510 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
511 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
512 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
514 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
515 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
516 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
517 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
518 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
519 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
520 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
521 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
522 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
523 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
524 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
525 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
526 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
527 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
528 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
529 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
531 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
532 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
533 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
534 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
535 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
536 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
537 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
538 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
539 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
540 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
541 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
542 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
543 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
544 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
545 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
546 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
558 w0_t[0] = uint_to_hex_lower8 ((a >> 0) & 255) << 0
559 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
560 w0_t[1] = uint_to_hex_lower8 ((a >> 16) & 255) << 0
561 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
562 w0_t[2] = uint_to_hex_lower8 ((b >> 0) & 255) << 0
563 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
564 w0_t[3] = uint_to_hex_lower8 ((b >> 16) & 255) << 0
565 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
566 w1_t[0] = uint_to_hex_lower8 ((c >> 0) & 255) << 0
567 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
568 w1_t[1] = uint_to_hex_lower8 ((c >> 16) & 255) << 0
569 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
570 w1_t[2] = uint_to_hex_lower8 ((d >> 0) & 255) << 0
571 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
572 w1_t[3] = uint_to_hex_lower8 ((d >> 16) & 255) << 0
573 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
575 w2_t[0] = 0x00000080;
589 switch_buffer_by_offset_le (w0_t, w1_t, w2_t, w3_t, salt_len);
591 w3_t[2] = pw_salt_len * 8;
593 w0_t[0] |= salt_buf0[0];
594 w0_t[1] |= salt_buf0[1];
595 w0_t[2] |= salt_buf0[2];
596 w0_t[3] |= salt_buf0[3];
597 w1_t[0] |= salt_buf1[0];
598 w1_t[1] |= salt_buf1[1];
599 w1_t[2] |= salt_buf1[2];
600 w1_t[3] |= salt_buf1[3];
601 w2_t[0] |= salt_buf2[0];
602 w2_t[1] |= salt_buf2[1];
603 w2_t[2] |= salt_buf2[2];
604 w2_t[3] |= salt_buf2[3];
605 w3_t[0] |= salt_buf3[0];
606 w3_t[1] |= salt_buf3[1];
607 w3_t[2] |= salt_buf3[2];
608 w3_t[3] |= salt_buf3[3];
619 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
620 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
621 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
622 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
623 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
624 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
625 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
626 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
627 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
628 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
629 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
630 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
631 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
632 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
633 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
634 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
636 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
637 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
638 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
639 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
640 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
641 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
642 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
643 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
644 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
645 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
646 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
647 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
648 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
649 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
650 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
651 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
653 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
654 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
655 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
656 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
657 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
658 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
659 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
660 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
661 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
662 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
663 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
664 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
665 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
666 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
667 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
668 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
670 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
671 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
672 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
673 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
674 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
675 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
676 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
677 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
678 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
679 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
680 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
681 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
682 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
683 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
684 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
685 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
687 COMPARE_S_SIMD (a, d, c, b);
691 __kernel void m03710_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
695 __kernel void m03710_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)