2 * Author......: Jens Steube <jens.steube@gmail.com>
8 #include "include/constants.h"
9 #include "include/kernel_vendor.h"
16 #include "include/kernel_functions.c"
17 #include "OpenCL/types_ocl.c"
18 #include "OpenCL/common.c"
19 #include "include/rp_kernel.h"
20 #include "OpenCL/rp.c"
22 #define COMPARE_S "OpenCL/check_single_comp4.c"
23 #define COMPARE_M "OpenCL/check_multi_comp4.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++)
154 const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
156 append_0x80_2x4 (w0, w1, out_len);
165 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
166 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
167 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
168 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
169 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
170 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
171 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
172 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
173 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
174 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
175 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
176 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
177 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
178 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
179 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
180 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
182 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
183 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
184 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
185 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
186 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
187 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
188 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
189 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
190 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
191 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
192 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
193 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
194 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
195 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
196 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
197 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
199 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
200 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
201 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
202 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
203 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
204 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
205 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
206 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
207 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
208 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
209 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
210 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
211 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
212 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
213 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
214 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
216 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
217 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
218 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
219 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
220 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
221 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
222 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
223 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
224 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
225 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
226 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
227 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
228 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
229 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
230 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
231 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
243 w0_t[0] = uint_to_hex_lower8 ((a >> 0) & 255) << 0
244 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
245 w0_t[1] = uint_to_hex_lower8 ((a >> 16) & 255) << 0
246 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
247 w0_t[2] = uint_to_hex_lower8 ((b >> 0) & 255) << 0
248 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
249 w0_t[3] = uint_to_hex_lower8 ((b >> 16) & 255) << 0
250 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
251 w1_t[0] = uint_to_hex_lower8 ((c >> 0) & 255) << 0
252 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
253 w1_t[1] = uint_to_hex_lower8 ((c >> 16) & 255) << 0
254 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
255 w1_t[2] = uint_to_hex_lower8 ((d >> 0) & 255) << 0
256 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
257 w1_t[3] = uint_to_hex_lower8 ((d >> 16) & 255) << 0
258 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
260 w2_t[0] = 0x00000080;
274 switch_buffer_by_offset_le (w0_t, w1_t, w2_t, w3_t, salt_len);
276 w3_t[2] = pw_salt_len * 8;
278 w0_t[0] |= salt_buf0[0];
279 w0_t[1] |= salt_buf0[1];
280 w0_t[2] |= salt_buf0[2];
281 w0_t[3] |= salt_buf0[3];
282 w1_t[0] |= salt_buf1[0];
283 w1_t[1] |= salt_buf1[1];
284 w1_t[2] |= salt_buf1[2];
285 w1_t[3] |= salt_buf1[3];
286 w2_t[0] |= salt_buf2[0];
287 w2_t[1] |= salt_buf2[1];
288 w2_t[2] |= salt_buf2[2];
289 w2_t[3] |= salt_buf2[3];
290 w3_t[0] |= salt_buf3[0];
291 w3_t[1] |= salt_buf3[1];
292 w3_t[2] |= salt_buf3[2];
293 w3_t[3] |= salt_buf3[3];
304 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
305 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
306 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
307 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
308 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
309 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
310 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
311 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
312 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
313 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
314 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
315 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
316 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
317 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
318 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
319 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
321 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
322 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
323 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
324 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
325 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
326 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
327 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
328 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
329 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
330 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
331 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
332 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
333 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
334 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
335 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
336 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
338 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
339 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
340 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
341 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
342 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
343 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
344 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
345 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
346 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
347 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
348 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
349 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
350 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
351 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
352 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
353 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
355 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
356 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
357 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
358 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
359 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
360 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
361 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
362 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
363 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
364 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
365 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
366 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
367 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
368 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
369 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
370 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
381 __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)
385 __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)
389 __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)
395 const u32 gid = get_global_id (0);
396 const u32 lid = get_local_id (0);
397 const u32 lsz = get_local_size (0);
403 __local u32 l_bin2asc[256];
405 for (u32 i = lid; i < 256; i += lsz)
407 const u32 i0 = (i >> 0) & 15;
408 const u32 i1 = (i >> 4) & 15;
410 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 8
411 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 0;
414 barrier (CLK_LOCAL_MEM_FENCE);
416 if (gid >= gid_max) return;
424 pw_buf0[0] = pws[gid].i[ 0];
425 pw_buf0[1] = pws[gid].i[ 1];
426 pw_buf0[2] = pws[gid].i[ 2];
427 pw_buf0[3] = pws[gid].i[ 3];
431 pw_buf1[0] = pws[gid].i[ 4];
432 pw_buf1[1] = pws[gid].i[ 5];
433 pw_buf1[2] = pws[gid].i[ 6];
434 pw_buf1[3] = pws[gid].i[ 7];
436 const u32 pw_len = pws[gid].pw_len;
444 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
445 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
446 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
447 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
451 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
452 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
453 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
454 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
470 const u32 salt_len = salt_bufs[salt_pos].salt_len;
472 const u32 pw_salt_len = 32 + salt_len;
478 const u32 search[4] =
480 digests_buf[digests_offset].digest_buf[DGST_R0],
481 digests_buf[digests_offset].digest_buf[DGST_R1],
482 digests_buf[digests_offset].digest_buf[DGST_R2],
483 digests_buf[digests_offset].digest_buf[DGST_R3]
490 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
520 const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
522 append_0x80_2x4 (w0, w1, out_len);
531 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
532 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
533 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
534 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
535 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
536 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
537 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
538 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
539 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
540 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
541 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
542 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
543 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
544 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
545 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
546 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
548 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
549 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
550 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
551 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
552 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
553 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
554 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
555 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
556 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
557 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
558 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
559 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
560 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
561 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
562 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
563 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
565 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
566 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
567 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
568 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
569 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
570 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
571 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
572 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
573 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
574 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
575 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
576 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
577 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
578 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
579 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
580 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
582 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
583 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
584 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
585 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
586 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
587 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
588 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
589 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
590 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
591 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
592 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
593 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
594 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
595 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
596 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
597 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
609 w0_t[0] = uint_to_hex_lower8 ((a >> 0) & 255) << 0
610 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
611 w0_t[1] = uint_to_hex_lower8 ((a >> 16) & 255) << 0
612 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
613 w0_t[2] = uint_to_hex_lower8 ((b >> 0) & 255) << 0
614 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
615 w0_t[3] = uint_to_hex_lower8 ((b >> 16) & 255) << 0
616 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
617 w1_t[0] = uint_to_hex_lower8 ((c >> 0) & 255) << 0
618 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
619 w1_t[1] = uint_to_hex_lower8 ((c >> 16) & 255) << 0
620 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
621 w1_t[2] = uint_to_hex_lower8 ((d >> 0) & 255) << 0
622 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
623 w1_t[3] = uint_to_hex_lower8 ((d >> 16) & 255) << 0
624 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
626 w2_t[0] = 0x00000080;
640 switch_buffer_by_offset_le (w0_t, w1_t, w2_t, w3_t, salt_len);
642 w3_t[2] = pw_salt_len * 8;
644 w0_t[0] |= salt_buf0[0];
645 w0_t[1] |= salt_buf0[1];
646 w0_t[2] |= salt_buf0[2];
647 w0_t[3] |= salt_buf0[3];
648 w1_t[0] |= salt_buf1[0];
649 w1_t[1] |= salt_buf1[1];
650 w1_t[2] |= salt_buf1[2];
651 w1_t[3] |= salt_buf1[3];
652 w2_t[0] |= salt_buf2[0];
653 w2_t[1] |= salt_buf2[1];
654 w2_t[2] |= salt_buf2[2];
655 w2_t[3] |= salt_buf2[3];
656 w3_t[0] |= salt_buf3[0];
657 w3_t[1] |= salt_buf3[1];
658 w3_t[2] |= salt_buf3[2];
659 w3_t[3] |= salt_buf3[3];
670 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
671 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
672 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
673 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
674 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
675 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
676 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
677 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
678 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
679 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
680 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
681 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
682 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
683 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
684 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
685 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
687 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
688 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
689 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
690 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
691 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
692 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
693 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
694 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
695 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
696 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
697 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
698 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
699 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
700 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
701 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
702 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
704 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
705 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
706 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
707 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
708 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
709 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
710 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
711 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
712 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
713 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
714 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
715 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
716 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
717 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
718 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
719 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
721 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
722 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
723 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
724 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
725 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
726 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
727 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
728 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
729 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
730 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
731 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
732 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
733 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
734 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
735 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
736 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
747 __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)
751 __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)