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 "types_ocl.c"
20 #define COMPARE_S "check_single_comp4.c"
21 #define COMPARE_M "check_multi_comp4.c"
23 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m11000_m04 (__global pw_t *pws, __global gpu_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)
29 const u32 lid = get_local_id (0);
35 const u32 gid = get_global_id (0);
37 if (gid >= gid_max) return;
41 wordl0[0] = pws[gid].i[ 0];
42 wordl0[1] = pws[gid].i[ 1];
43 wordl0[2] = pws[gid].i[ 2];
44 wordl0[3] = pws[gid].i[ 3];
48 wordl1[0] = pws[gid].i[ 4];
49 wordl1[1] = pws[gid].i[ 5];
50 wordl1[2] = pws[gid].i[ 6];
51 wordl1[3] = pws[gid].i[ 7];
67 const u32 pw_l_len = pws[gid].pw_len;
69 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
71 switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
80 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
81 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
82 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
83 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
87 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
88 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
89 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
90 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
94 salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
95 salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
96 salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
97 salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
101 salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
102 salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
104 const u32 salt_len = salt_bufs[salt_pos].salt_len;
110 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
112 const u32 pw_r_len = combs_buf[il_pos].pw_len;
114 const u32 pw_len = pw_l_len + pw_r_len;
121 wordr0[0] = combs_buf[il_pos].i[0];
122 wordr0[1] = combs_buf[il_pos].i[1];
123 wordr0[2] = combs_buf[il_pos].i[2];
124 wordr0[3] = combs_buf[il_pos].i[3];
125 wordr1[0] = combs_buf[il_pos].i[4];
126 wordr1[1] = combs_buf[il_pos].i[5];
127 wordr1[2] = combs_buf[il_pos].i[6];
128 wordr1[3] = combs_buf[il_pos].i[7];
138 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
140 switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
148 w0[0] = wordl0[0] | wordr0[0];
149 w0[1] = wordl0[1] | wordr0[1];
150 w0[2] = wordl0[2] | wordr0[2];
151 w0[3] = wordl0[3] | wordr0[3];
152 w1[0] = wordl1[0] | wordr1[0];
153 w1[1] = wordl1[1] | wordr1[1];
154 w1[2] = wordl1[2] | wordr1[2];
155 w1[3] = wordl1[3] | wordr1[3];
156 w2[0] = wordl2[0] | wordr2[0];
157 w2[1] = wordl2[1] | wordr2[1];
158 w2[2] = wordl2[2] | wordr2[2];
159 w2[3] = wordl2[3] | wordr2[3];
160 w3[0] = wordl3[0] | wordr3[0];
161 w3[1] = wordl3[1] | wordr3[1];
162 w3[2] = wordl3[2] | wordr3[2];
163 w3[3] = wordl3[3] | wordr3[3];
165 append_0x80_4 (w0, w1, w2, w3, pw_len);
167 const u32 pw_salt_len = pw_len + salt_len;
173 // first step fixed 56 bytes of salt
180 w0_t[0] = salt_buf0[0];
181 w0_t[1] = salt_buf0[1];
182 w0_t[2] = salt_buf0[2];
183 w0_t[3] = salt_buf0[3];
184 w1_t[0] = salt_buf1[0];
185 w1_t[1] = salt_buf1[1];
186 w1_t[2] = salt_buf1[2];
187 w1_t[3] = salt_buf1[3];
188 w2_t[0] = salt_buf2[0];
189 w2_t[1] = salt_buf2[1];
190 w2_t[2] = salt_buf2[2];
191 w2_t[3] = salt_buf2[3];
192 w3_t[0] = salt_buf3[0];
193 w3_t[1] = salt_buf3[1];
195 // after 56 byte salt, we have beginning of the password
211 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
212 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
213 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
214 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
215 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
216 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
217 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
218 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
219 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
220 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
221 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
222 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
223 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
224 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
225 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
226 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
228 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
229 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
230 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
231 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
232 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
233 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
234 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
235 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
236 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
237 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
238 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
239 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
240 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
241 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
242 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
243 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
245 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
246 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
247 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
248 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
249 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
250 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
251 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
252 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
253 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
254 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
255 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
256 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
257 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
258 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
259 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
260 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
262 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
263 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
264 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
265 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
266 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
267 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
268 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
269 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
270 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
271 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
272 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
273 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
274 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
275 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
276 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
277 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
305 w3_t[2] = pw_salt_len * 8;
308 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
309 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
310 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
311 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
312 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
313 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
314 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
315 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
316 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
317 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
318 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
319 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
320 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
321 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
322 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
323 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
325 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
326 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
327 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
328 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
329 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
330 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
331 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
332 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
333 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
334 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
335 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
336 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
337 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
338 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
339 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
340 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
342 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
343 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
344 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
345 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
346 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
347 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
348 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
349 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
350 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
351 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
352 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
353 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
354 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
355 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
356 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
357 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
359 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
360 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
361 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
362 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
363 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
364 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
365 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
366 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
367 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
368 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
369 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
370 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
371 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
372 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
373 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
374 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
390 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m11000_m08 (__global pw_t *pws, __global gpu_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)
394 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m11000_m16 (__global pw_t *pws, __global gpu_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)
398 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m11000_s04 (__global pw_t *pws, __global gpu_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)
404 const u32 lid = get_local_id (0);
410 const u32 gid = get_global_id (0);
412 if (gid >= gid_max) return;
416 wordl0[0] = pws[gid].i[ 0];
417 wordl0[1] = pws[gid].i[ 1];
418 wordl0[2] = pws[gid].i[ 2];
419 wordl0[3] = pws[gid].i[ 3];
423 wordl1[0] = pws[gid].i[ 4];
424 wordl1[1] = pws[gid].i[ 5];
425 wordl1[2] = pws[gid].i[ 6];
426 wordl1[3] = pws[gid].i[ 7];
442 const u32 pw_l_len = pws[gid].pw_len;
444 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
446 switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
455 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
456 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
457 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
458 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
462 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
463 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
464 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
465 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
469 salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
470 salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
471 salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
472 salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
476 salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
477 salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
479 const u32 salt_len = salt_bufs[salt_pos].salt_len;
485 const u32 search[4] =
487 digests_buf[digests_offset].digest_buf[DGST_R0],
488 digests_buf[digests_offset].digest_buf[DGST_R1],
489 digests_buf[digests_offset].digest_buf[DGST_R2],
490 digests_buf[digests_offset].digest_buf[DGST_R3]
497 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
499 const u32 pw_r_len = combs_buf[il_pos].pw_len;
501 const u32 pw_len = pw_l_len + pw_r_len;
508 wordr0[0] = combs_buf[il_pos].i[0];
509 wordr0[1] = combs_buf[il_pos].i[1];
510 wordr0[2] = combs_buf[il_pos].i[2];
511 wordr0[3] = combs_buf[il_pos].i[3];
512 wordr1[0] = combs_buf[il_pos].i[4];
513 wordr1[1] = combs_buf[il_pos].i[5];
514 wordr1[2] = combs_buf[il_pos].i[6];
515 wordr1[3] = combs_buf[il_pos].i[7];
525 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
527 switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
535 w0[0] = wordl0[0] | wordr0[0];
536 w0[1] = wordl0[1] | wordr0[1];
537 w0[2] = wordl0[2] | wordr0[2];
538 w0[3] = wordl0[3] | wordr0[3];
539 w1[0] = wordl1[0] | wordr1[0];
540 w1[1] = wordl1[1] | wordr1[1];
541 w1[2] = wordl1[2] | wordr1[2];
542 w1[3] = wordl1[3] | wordr1[3];
543 w2[0] = wordl2[0] | wordr2[0];
544 w2[1] = wordl2[1] | wordr2[1];
545 w2[2] = wordl2[2] | wordr2[2];
546 w2[3] = wordl2[3] | wordr2[3];
547 w3[0] = wordl3[0] | wordr3[0];
548 w3[1] = wordl3[1] | wordr3[1];
549 w3[2] = wordl3[2] | wordr3[2];
550 w3[3] = wordl3[3] | wordr3[3];
552 append_0x80_4 (w0, w1, w2, w3, pw_len);
554 const u32 pw_salt_len = pw_len + salt_len;
560 // first step fixed 56 bytes of salt
567 w0_t[0] = salt_buf0[0];
568 w0_t[1] = salt_buf0[1];
569 w0_t[2] = salt_buf0[2];
570 w0_t[3] = salt_buf0[3];
571 w1_t[0] = salt_buf1[0];
572 w1_t[1] = salt_buf1[1];
573 w1_t[2] = salt_buf1[2];
574 w1_t[3] = salt_buf1[3];
575 w2_t[0] = salt_buf2[0];
576 w2_t[1] = salt_buf2[1];
577 w2_t[2] = salt_buf2[2];
578 w2_t[3] = salt_buf2[3];
579 w3_t[0] = salt_buf3[0];
580 w3_t[1] = salt_buf3[1];
582 // after 56 byte salt, we have beginning of the password
598 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
599 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
600 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
601 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
602 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
603 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
604 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
605 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
606 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
607 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
608 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
609 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
610 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
611 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
612 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
613 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
615 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
616 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
617 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
618 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
619 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
620 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
621 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
622 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
623 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
624 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
625 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
626 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
627 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
628 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
629 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
630 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
632 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
633 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
634 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
635 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
636 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
637 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
638 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
639 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
640 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
641 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
642 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
643 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
644 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
645 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
646 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
647 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
649 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
650 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
651 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
652 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
653 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
654 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
655 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
656 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
657 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
658 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
659 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
660 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
661 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
662 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
663 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
664 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
692 w3_t[2] = pw_salt_len * 8;
695 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
696 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
697 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
698 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
699 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
700 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
701 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
702 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
703 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
704 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
705 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
706 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
707 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
708 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
709 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
710 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
712 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
713 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
714 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
715 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
716 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
717 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
718 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
719 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
720 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
721 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
722 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
723 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
724 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
725 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
726 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
727 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
729 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
730 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
731 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
732 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
733 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
734 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
735 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
736 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
737 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
738 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
739 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
740 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
741 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
742 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
743 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
744 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
746 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
747 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
748 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
749 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
750 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
751 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
752 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
753 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
754 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
755 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
756 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
757 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
758 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
759 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
760 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
761 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
777 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m11000_s08 (__global pw_t *pws, __global gpu_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)
781 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m11000_s16 (__global pw_t *pws, __global gpu_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)