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"
25 #define uint_to_hex_lower8(i) l_bin2asc[(i)]
27 __kernel void m11100_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)
33 const u32 gid = get_global_id (0);
34 const u32 lid = get_local_id (0);
35 const u32 lsz = get_local_size (0);
41 __local u32 l_bin2asc[256];
43 for (u32 i = lid; i < 256; i += lsz)
45 const u32 i0 = (i >> 0) & 15;
46 const u32 i1 = (i >> 4) & 15;
48 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 8
49 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 0;
52 barrier (CLK_LOCAL_MEM_FENCE);
54 if (gid >= gid_max) return;
62 pw_buf0[0] = pws[gid].i[ 0];
63 pw_buf0[1] = pws[gid].i[ 1];
64 pw_buf0[2] = pws[gid].i[ 2];
65 pw_buf0[3] = pws[gid].i[ 3];
69 pw_buf1[0] = pws[gid].i[ 4];
70 pw_buf1[1] = pws[gid].i[ 5];
71 pw_buf1[2] = pws[gid].i[ 6];
72 pw_buf1[3] = pws[gid].i[ 7];
74 const u32 pw_len = pws[gid].pw_len;
82 challenge = salt_bufs[salt_pos].salt_buf[0];
90 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 1]; // not a bug
91 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 2];
92 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 3];
93 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 4];
97 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 5];
98 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 6];
99 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 7];
100 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 8];
102 const u32 salt_len = salt_bufs[salt_pos].salt_len - 4;
108 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
138 const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
142 w0_t[0] = salt_buf0[0];
143 w0_t[1] = salt_buf0[1];
144 w0_t[2] = salt_buf0[2];
145 w0_t[3] = salt_buf0[3];
149 w1_t[0] = salt_buf1[0];
150 w1_t[1] = salt_buf1[1];
151 w1_t[2] = salt_buf1[2];
152 w1_t[3] = salt_buf1[3];
172 switch_buffer_by_offset_le (w0_t, w1_t, w2_t, w3_t, pw_len);
174 const u32 pw_salt_len = out_len + salt_len;
193 w3_t[2] = pw_salt_len * 8;
205 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
206 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
207 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
208 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
209 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
210 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
211 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
212 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
213 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
214 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
215 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
216 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
217 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
218 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
219 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
220 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
222 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
223 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
224 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
225 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
226 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
227 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
228 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
229 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
230 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
231 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
232 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
233 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
234 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
235 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
236 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
237 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
239 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
240 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
241 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
242 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
243 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
244 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
245 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
246 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
247 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
248 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
249 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
250 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
251 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
252 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
253 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
254 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
256 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
257 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
258 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
259 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
260 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
261 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
262 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
263 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
264 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
265 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
266 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
267 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
268 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
269 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
270 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
271 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
278 w0_t[0] = uint_to_hex_lower8 ((a >> 0) & 255) << 0
279 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
280 w0_t[1] = uint_to_hex_lower8 ((a >> 16) & 255) << 0
281 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
282 w0_t[2] = uint_to_hex_lower8 ((b >> 0) & 255) << 0
283 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
284 w0_t[3] = uint_to_hex_lower8 ((b >> 16) & 255) << 0
285 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
286 w1_t[0] = uint_to_hex_lower8 ((c >> 0) & 255) << 0
287 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
288 w1_t[1] = uint_to_hex_lower8 ((c >> 16) & 255) << 0
289 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
290 w1_t[2] = uint_to_hex_lower8 ((d >> 0) & 255) << 0
291 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
292 w1_t[3] = uint_to_hex_lower8 ((d >> 16) & 255) << 0
293 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
295 // add the 4 byte challenge here
298 w2_t[1] = 0x00000080;
304 w3_t[2] = (32 + 4) * 8;
308 * md5 ($hash.$challenge)
316 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
317 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
318 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
319 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
320 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
321 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
322 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
323 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
324 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
325 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
326 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
327 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
328 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
329 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
330 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
331 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
333 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
334 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
335 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
336 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
337 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
338 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
339 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
340 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
341 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
342 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
343 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
344 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
345 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
346 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
347 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
348 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
350 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
351 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
352 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
353 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
354 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
355 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
356 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
357 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
358 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
359 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
360 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
361 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
362 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
363 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
364 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
365 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
367 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
368 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
369 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
370 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
371 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
372 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
373 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
374 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
375 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
376 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
377 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
378 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
379 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
380 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
381 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
382 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
393 __kernel void m11100_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)
397 __kernel void m11100_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)
401 __kernel void m11100_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)
407 const u32 gid = get_global_id (0);
408 const u32 lid = get_local_id (0);
409 const u32 lsz = get_local_size (0);
415 __local u32 l_bin2asc[256];
417 for (u32 i = lid; i < 256; i += lsz)
419 const u32 i0 = (i >> 0) & 15;
420 const u32 i1 = (i >> 4) & 15;
422 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 8
423 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 0;
426 barrier (CLK_LOCAL_MEM_FENCE);
428 if (gid >= gid_max) return;
436 pw_buf0[0] = pws[gid].i[ 0];
437 pw_buf0[1] = pws[gid].i[ 1];
438 pw_buf0[2] = pws[gid].i[ 2];
439 pw_buf0[3] = pws[gid].i[ 3];
443 pw_buf1[0] = pws[gid].i[ 4];
444 pw_buf1[1] = pws[gid].i[ 5];
445 pw_buf1[2] = pws[gid].i[ 6];
446 pw_buf1[3] = pws[gid].i[ 7];
448 const u32 pw_len = pws[gid].pw_len;
456 challenge = salt_bufs[salt_pos].salt_buf[0];
464 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 1]; // not a bug
465 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 2];
466 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 3];
467 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 4];
471 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 5];
472 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 6];
473 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 7];
474 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 8];
476 const u32 salt_len = salt_bufs[salt_pos].salt_len - 4;
482 const u32 search[4] =
484 digests_buf[digests_offset].digest_buf[DGST_R0],
485 digests_buf[digests_offset].digest_buf[DGST_R1],
486 digests_buf[digests_offset].digest_buf[DGST_R2],
487 digests_buf[digests_offset].digest_buf[DGST_R3]
494 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
524 const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
528 w0_t[0] = salt_buf0[0];
529 w0_t[1] = salt_buf0[1];
530 w0_t[2] = salt_buf0[2];
531 w0_t[3] = salt_buf0[3];
535 w1_t[0] = salt_buf1[0];
536 w1_t[1] = salt_buf1[1];
537 w1_t[2] = salt_buf1[2];
538 w1_t[3] = salt_buf1[3];
558 switch_buffer_by_offset_le (w0_t, w1_t, w2_t, w3_t, pw_len);
560 const u32 pw_salt_len = out_len + salt_len;
579 w3_t[2] = pw_salt_len * 8;
591 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
592 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
593 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
594 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
595 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
596 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
597 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
598 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
599 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
600 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
601 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
602 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
603 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
604 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
605 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
606 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
608 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
609 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
610 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
611 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
612 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
613 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
614 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
615 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
616 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
617 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
618 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
619 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
620 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
621 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
622 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
623 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
625 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
626 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
627 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
628 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
629 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
630 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
631 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
632 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
633 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
634 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
635 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
636 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
637 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
638 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
639 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
640 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
642 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
643 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
644 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
645 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
646 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
647 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
648 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
649 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
650 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
651 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
652 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
653 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
654 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
655 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
656 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
657 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
664 w0_t[0] = uint_to_hex_lower8 ((a >> 0) & 255) << 0
665 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
666 w0_t[1] = uint_to_hex_lower8 ((a >> 16) & 255) << 0
667 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
668 w0_t[2] = uint_to_hex_lower8 ((b >> 0) & 255) << 0
669 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
670 w0_t[3] = uint_to_hex_lower8 ((b >> 16) & 255) << 0
671 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
672 w1_t[0] = uint_to_hex_lower8 ((c >> 0) & 255) << 0
673 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
674 w1_t[1] = uint_to_hex_lower8 ((c >> 16) & 255) << 0
675 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
676 w1_t[2] = uint_to_hex_lower8 ((d >> 0) & 255) << 0
677 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
678 w1_t[3] = uint_to_hex_lower8 ((d >> 16) & 255) << 0
679 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
681 // add the 4 byte challenge here
684 w2_t[1] = 0x00000080;
690 w3_t[2] = (32 + 4) * 8;
694 * md5 ($hash.$challenge)
702 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
703 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
704 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
705 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
706 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
707 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
708 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
709 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
710 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
711 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
712 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
713 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
714 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
715 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
716 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
717 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
719 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
720 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
721 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
722 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
723 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
724 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
725 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
726 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
727 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
728 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
729 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
730 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
731 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
732 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
733 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
734 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
736 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
737 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
738 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
739 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
740 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
741 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
742 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
743 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
744 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
745 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
746 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
747 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
748 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
749 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
750 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
751 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
753 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
754 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
755 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
756 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
757 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
758 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
759 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
760 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
761 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
762 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
763 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
764 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
765 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
766 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
767 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
768 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
779 __kernel void m11100_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)
783 __kernel void m11100_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)