2 * Author......: Jens Steube <jens.steube@gmail.com>
8 #include "include/constants.h"
9 #include "include/kernel_vendor.h"
24 #include "include/kernel_functions.c"
26 #include "common_nv.c"
29 #define VECT_COMPARE_S "check_single_vect1_comp4.c"
30 #define VECT_COMPARE_M "check_multi_vect1_comp4.c"
34 #define VECT_COMPARE_S "check_single_vect2_comp4.c"
35 #define VECT_COMPARE_M "check_multi_vect2_comp4.c"
39 #define VECT_COMPARE_S "check_single_vect4_comp4.c"
40 #define VECT_COMPARE_M "check_multi_vect4_comp4.c"
44 #define uint_to_hex_lower8(i) l_bin2asc[(i)]
48 #define uint_to_hex_lower8(i) u32x (l_bin2asc[(i).x], l_bin2asc[(i).y])
52 #define uint_to_hex_lower8(i) u32x (l_bin2asc[(i).x], l_bin2asc[(i).y], l_bin2asc[(i).z], l_bin2asc[(i).w])
55 __device__ __constant__ char c_bin2asc[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
57 __device__ __shared__ short l_bin2asc[256];
59 __device__ __constant__ comb_t c_combs[1024];
61 extern "C" __global__ void __launch_bounds__ (256, 1) m11100_m04 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, 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)
67 const u32 lid = threadIdx.x;
73 const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
77 wordl0[0] = pws[gid].i[ 0];
78 wordl0[1] = pws[gid].i[ 1];
79 wordl0[2] = pws[gid].i[ 2];
80 wordl0[3] = pws[gid].i[ 3];
84 wordl1[0] = pws[gid].i[ 4];
85 wordl1[1] = pws[gid].i[ 5];
86 wordl1[2] = pws[gid].i[ 6];
87 wordl1[3] = pws[gid].i[ 7];
103 const u32 pw_l_len = pws[gid].pw_len;
105 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
107 switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, c_combs[0].pw_len);
116 challenge = salt_bufs[salt_pos].salt_buf[0];
124 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 1]; // not a bug
125 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 2];
126 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 3];
127 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 4];
131 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 5];
132 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 6];
133 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 7];
134 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 8];
136 const u32 salt_len = salt_bufs[salt_pos].salt_len - 4;
142 l_bin2asc[lid] = c_bin2asc[(lid >> 0) & 15] << 8
143 | c_bin2asc[(lid >> 4) & 15] << 0;
147 if (gid >= gid_max) return;
153 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
155 const u32 pw_r_len = c_combs[il_pos].pw_len;
157 const u32 pw_len = pw_l_len + pw_r_len;
161 wordr0[0] = c_combs[il_pos].i[0];
162 wordr0[1] = c_combs[il_pos].i[1];
163 wordr0[2] = c_combs[il_pos].i[2];
164 wordr0[3] = c_combs[il_pos].i[3];
168 wordr1[0] = c_combs[il_pos].i[4];
169 wordr1[1] = c_combs[il_pos].i[5];
170 wordr1[2] = c_combs[il_pos].i[6];
171 wordr1[3] = c_combs[il_pos].i[7];
187 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
189 switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
194 w0_t[0] = salt_buf0[0];
195 w0_t[1] = salt_buf0[1];
196 w0_t[2] = salt_buf0[2];
197 w0_t[3] = salt_buf0[3];
201 w1_t[0] = salt_buf1[0];
202 w1_t[1] = salt_buf1[1];
203 w1_t[2] = salt_buf1[2];
204 w1_t[3] = salt_buf1[3];
224 switch_buffer_by_offset (w0_t, w1_t, w2_t, w3_t, pw_len);
226 const u32 pw_salt_len = pw_len + salt_len;
228 w0_t[0] |= wordl0[0] | wordr0[0];
229 w0_t[1] |= wordl0[1] | wordr0[1];
230 w0_t[2] |= wordl0[2] | wordr0[2];
231 w0_t[3] |= wordl0[3] | wordr0[3];
233 w1_t[0] |= wordl1[0] | wordr1[0];
234 w1_t[1] |= wordl1[1] | wordr1[1];
235 w1_t[2] |= wordl1[2] | wordr1[2];
236 w1_t[3] |= wordl1[3] | wordr1[3];
238 w2_t[0] |= wordl2[0] | wordr2[0];
239 w2_t[1] |= wordl2[1] | wordr2[1];
240 w2_t[2] |= wordl2[2] | wordr2[2];
241 w2_t[3] |= wordl2[3] | wordr2[3];
243 w3_t[0] |= wordl3[0] | wordr3[0];
244 w3_t[1] |= wordl3[0] | wordr3[0];
245 w3_t[2] = pw_salt_len * 8;
257 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
258 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
259 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
260 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
261 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
262 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
263 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
264 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
265 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
266 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
267 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
268 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
269 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
270 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
271 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
272 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
274 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
275 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
276 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
277 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
278 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
279 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
280 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
281 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
282 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
283 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
284 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
285 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
286 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
287 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
288 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
289 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
291 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
292 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
293 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
294 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
295 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
296 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
297 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
298 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
299 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
300 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
301 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
302 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
303 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
304 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
305 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
306 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
308 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
309 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
310 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
311 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
312 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
313 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
314 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
315 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
316 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
317 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
318 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
319 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
320 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
321 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
322 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
323 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
330 w0_t[0] = uint_to_hex_lower8 ((a >> 0) & 255) << 0
331 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
332 w0_t[1] = uint_to_hex_lower8 ((a >> 16) & 255) << 0
333 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
334 w0_t[2] = uint_to_hex_lower8 ((b >> 0) & 255) << 0
335 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
336 w0_t[3] = uint_to_hex_lower8 ((b >> 16) & 255) << 0
337 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
338 w1_t[0] = uint_to_hex_lower8 ((c >> 0) & 255) << 0
339 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
340 w1_t[1] = uint_to_hex_lower8 ((c >> 16) & 255) << 0
341 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
342 w1_t[2] = uint_to_hex_lower8 ((d >> 0) & 255) << 0
343 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
344 w1_t[3] = uint_to_hex_lower8 ((d >> 16) & 255) << 0
345 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
347 // add the 4 byte challenge here
350 w2_t[1] = 0x00000080;
356 w3_t[2] = (32 + 4) * 8;
360 * md5 ($hash.$challenge)
368 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
369 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
370 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
371 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
372 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
373 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
374 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
375 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
376 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
377 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
378 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
379 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
380 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
381 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
382 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
383 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
385 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
386 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
387 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
388 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
389 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
390 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
391 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
392 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
393 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
394 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
395 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
396 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
397 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
398 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
399 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
400 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
402 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
403 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
404 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
405 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
406 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
407 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
408 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
409 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
410 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
411 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
412 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
413 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
414 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
415 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
416 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
417 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
419 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
420 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
421 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
422 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
423 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
424 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
425 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
426 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
427 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
428 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
429 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
430 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
431 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
432 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
433 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
434 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
441 #include VECT_COMPARE_M
445 extern "C" __global__ void __launch_bounds__ (256, 1) m11100_m08 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, 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)
449 extern "C" __global__ void __launch_bounds__ (256, 1) m11100_m16 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, 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)
453 extern "C" __global__ void __launch_bounds__ (256, 1) m11100_s04 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, 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)
459 const u32 lid = threadIdx.x;
465 const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
469 wordl0[0] = pws[gid].i[ 0];
470 wordl0[1] = pws[gid].i[ 1];
471 wordl0[2] = pws[gid].i[ 2];
472 wordl0[3] = pws[gid].i[ 3];
476 wordl1[0] = pws[gid].i[ 4];
477 wordl1[1] = pws[gid].i[ 5];
478 wordl1[2] = pws[gid].i[ 6];
479 wordl1[3] = pws[gid].i[ 7];
495 const u32 pw_l_len = pws[gid].pw_len;
497 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
499 switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, c_combs[0].pw_len);
508 challenge = salt_bufs[salt_pos].salt_buf[0];
516 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 1]; // not a bug
517 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 2];
518 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 3];
519 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 4];
523 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 5];
524 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 6];
525 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 7];
526 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 8];
528 const u32 salt_len = salt_bufs[salt_pos].salt_len - 4;
534 const u32 search[4] =
536 digests_buf[digests_offset].digest_buf[DGST_R0],
537 digests_buf[digests_offset].digest_buf[DGST_R1],
538 digests_buf[digests_offset].digest_buf[DGST_R2],
539 digests_buf[digests_offset].digest_buf[DGST_R3]
546 l_bin2asc[lid] = c_bin2asc[(lid >> 0) & 15] << 8
547 | c_bin2asc[(lid >> 4) & 15] << 0;
551 if (gid >= gid_max) return;
557 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
559 const u32 pw_r_len = c_combs[il_pos].pw_len;
561 const u32 pw_len = pw_l_len + pw_r_len;
565 wordr0[0] = c_combs[il_pos].i[0];
566 wordr0[1] = c_combs[il_pos].i[1];
567 wordr0[2] = c_combs[il_pos].i[2];
568 wordr0[3] = c_combs[il_pos].i[3];
572 wordr1[0] = c_combs[il_pos].i[4];
573 wordr1[1] = c_combs[il_pos].i[5];
574 wordr1[2] = c_combs[il_pos].i[6];
575 wordr1[3] = c_combs[il_pos].i[7];
591 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
593 switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
598 w0_t[0] = salt_buf0[0];
599 w0_t[1] = salt_buf0[1];
600 w0_t[2] = salt_buf0[2];
601 w0_t[3] = salt_buf0[3];
605 w1_t[0] = salt_buf1[0];
606 w1_t[1] = salt_buf1[1];
607 w1_t[2] = salt_buf1[2];
608 w1_t[3] = salt_buf1[3];
628 switch_buffer_by_offset (w0_t, w1_t, w2_t, w3_t, pw_len);
630 const u32 pw_salt_len = pw_len + salt_len;
632 w0_t[0] |= wordl0[0] | wordr0[0];
633 w0_t[1] |= wordl0[1] | wordr0[1];
634 w0_t[2] |= wordl0[2] | wordr0[2];
635 w0_t[3] |= wordl0[3] | wordr0[3];
637 w1_t[0] |= wordl1[0] | wordr1[0];
638 w1_t[1] |= wordl1[1] | wordr1[1];
639 w1_t[2] |= wordl1[2] | wordr1[2];
640 w1_t[3] |= wordl1[3] | wordr1[3];
642 w2_t[0] |= wordl2[0] | wordr2[0];
643 w2_t[1] |= wordl2[1] | wordr2[1];
644 w2_t[2] |= wordl2[2] | wordr2[2];
645 w2_t[3] |= wordl2[3] | wordr2[3];
647 w3_t[0] |= wordl3[0] | wordr3[0];
648 w3_t[1] |= wordl3[0] | wordr3[0];
649 w3_t[2] = pw_salt_len * 8;
661 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
662 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
663 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
664 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
665 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
666 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
667 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
668 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
669 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
670 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
671 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
672 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
673 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
674 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
675 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
676 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
678 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
679 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
680 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
681 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
682 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
683 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
684 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
685 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
686 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
687 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
688 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
689 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
690 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
691 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
692 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
693 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
695 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
696 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
697 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
698 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
699 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
700 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
701 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
702 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
703 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
704 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
705 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
706 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
707 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
708 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
709 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
710 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
712 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
713 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
714 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
715 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
716 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
717 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
718 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
719 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
720 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
721 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
722 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
723 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
724 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
725 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
726 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
727 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
734 w0_t[0] = uint_to_hex_lower8 ((a >> 0) & 255) << 0
735 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
736 w0_t[1] = uint_to_hex_lower8 ((a >> 16) & 255) << 0
737 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
738 w0_t[2] = uint_to_hex_lower8 ((b >> 0) & 255) << 0
739 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
740 w0_t[3] = uint_to_hex_lower8 ((b >> 16) & 255) << 0
741 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
742 w1_t[0] = uint_to_hex_lower8 ((c >> 0) & 255) << 0
743 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
744 w1_t[1] = uint_to_hex_lower8 ((c >> 16) & 255) << 0
745 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
746 w1_t[2] = uint_to_hex_lower8 ((d >> 0) & 255) << 0
747 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
748 w1_t[3] = uint_to_hex_lower8 ((d >> 16) & 255) << 0
749 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
751 // add the 4 byte challenge here
754 w2_t[1] = 0x00000080;
760 w3_t[2] = (32 + 4) * 8;
764 * md5 ($hash.$challenge)
772 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
773 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
774 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
775 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
776 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
777 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
778 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
779 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
780 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
781 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
782 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
783 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
784 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
785 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
786 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
787 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
789 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
790 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
791 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
792 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
793 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
794 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
795 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
796 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
797 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
798 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
799 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
800 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
801 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
802 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
803 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
804 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
806 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
807 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
808 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
809 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
810 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
811 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
812 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
813 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
814 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
815 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
816 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
817 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
818 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
819 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
820 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
821 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
823 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
824 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
825 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
826 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
827 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
828 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
829 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
830 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
831 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
832 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
833 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
834 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
835 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
836 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
837 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
838 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
845 #include VECT_COMPARE_S
849 extern "C" __global__ void __launch_bounds__ (256, 1) m11100_s08 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, 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)
853 extern "C" __global__ void __launch_bounds__ (256, 1) m11100_s16 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, 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)