2 * Authors.....: Jens Steube <jens.steube@gmail.com>
3 * magnum <john.magnum@hushmail.com>
12 #include "inc_hash_constants.h"
13 #include "inc_vendor.cl"
20 #include "inc_hash_functions.cl"
21 #include "inc_types.cl"
22 #include "inc_common.cl"
25 #include "inc_simd.cl"
28 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i)])
30 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1])
32 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1], l_bin2asc[(i).s2], l_bin2asc[(i).s3])
34 #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])
36 #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], l_bin2asc[(i).s8], l_bin2asc[(i).s9], l_bin2asc[(i).sa], l_bin2asc[(i).sb], l_bin2asc[(i).sc], l_bin2asc[(i).sd], l_bin2asc[(i).se], l_bin2asc[(i).sf])
39 __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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
45 const u32 gid = get_global_id (0);
46 const u32 lid = get_local_id (0);
47 const u32 lsz = get_local_size (0);
53 __local u32 l_bin2asc[256];
55 for (u32 i = lid; i < 256; i += lsz)
57 const u32 i0 = (i >> 0) & 15;
58 const u32 i1 = (i >> 4) & 15;
60 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 8
61 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 0;
64 barrier (CLK_LOCAL_MEM_FENCE);
66 if (gid >= gid_max) return;
75 pw_buf0[0] = pws[gid].i[ 0];
76 pw_buf0[1] = pws[gid].i[ 1];
77 pw_buf0[2] = pws[gid].i[ 2];
78 pw_buf0[3] = pws[gid].i[ 3];
79 pw_buf1[0] = pws[gid].i[ 4];
80 pw_buf1[1] = pws[gid].i[ 5];
81 pw_buf1[2] = pws[gid].i[ 6];
82 pw_buf1[3] = pws[gid].i[ 7];
84 const u32 pw_len = pws[gid].pw_len;
92 challenge = salt_bufs[salt_pos].salt_buf[0];
101 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 1]; // not a bug, see challenge
102 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 2];
103 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 3];
104 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 4];
105 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 5];
106 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 6];
107 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 7];
108 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 8];
110 const u32 salt_len = salt_bufs[salt_pos].salt_len - 4;
116 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
123 const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
134 s0[0] = salt_buf0[0];
135 s0[1] = salt_buf0[1];
136 s0[2] = salt_buf0[2];
137 s0[3] = salt_buf0[3];
138 s1[0] = salt_buf1[0];
139 s1[1] = salt_buf1[1];
140 s1[2] = salt_buf1[2];
141 s1[3] = salt_buf1[3];
151 switch_buffer_by_offset_le_VV (s0, s1, s2, s3, out_len);
153 const u32x pw_salt_len = out_len + salt_len;
169 w3[2] = pw_salt_len * 8;
181 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
182 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
183 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
184 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
185 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
186 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
187 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
188 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
189 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
190 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
191 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
192 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
193 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
194 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
195 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
196 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
198 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
199 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
200 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
201 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
202 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
203 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
204 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
205 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
206 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
207 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
208 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
209 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
210 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
211 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
212 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
213 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
215 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
216 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
217 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
218 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
219 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
220 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
221 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
222 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
223 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
224 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
225 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
226 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
227 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
228 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
229 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
230 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
232 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
233 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
234 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
235 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
236 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
237 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
238 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
239 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
240 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
241 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
242 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
243 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
244 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
245 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
246 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
247 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
254 w0[0] = uint_to_hex_lower8 ((a >> 0) & 255) << 0
255 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
256 w0[1] = uint_to_hex_lower8 ((a >> 16) & 255) << 0
257 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
258 w0[2] = uint_to_hex_lower8 ((b >> 0) & 255) << 0
259 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
260 w0[3] = uint_to_hex_lower8 ((b >> 16) & 255) << 0
261 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
262 w1[0] = uint_to_hex_lower8 ((c >> 0) & 255) << 0
263 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
264 w1[1] = uint_to_hex_lower8 ((c >> 16) & 255) << 0
265 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
266 w1[2] = uint_to_hex_lower8 ((d >> 0) & 255) << 0
267 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
268 w1[3] = uint_to_hex_lower8 ((d >> 16) & 255) << 0
269 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
271 // add the 4 byte challenge here
279 w3[2] = (32 + 4) * 8;
283 * md5 ($hash.$challenge)
291 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
292 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
293 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
294 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
295 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
296 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
297 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
298 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
299 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
300 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
301 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
302 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
303 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
304 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
305 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
306 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
308 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
309 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
310 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
311 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
312 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
313 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
314 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
315 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
316 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
317 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
318 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
319 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
320 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
321 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
322 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
323 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
325 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
326 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
327 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
328 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
329 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
330 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
331 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
332 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
333 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
334 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
335 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
336 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
337 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
338 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
339 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
340 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
342 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
343 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
344 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
345 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
346 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
347 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
348 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
349 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
350 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
351 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
352 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
353 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
354 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
355 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
356 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
357 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
359 COMPARE_M_SIMD (a, d, c, b);
363 __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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
367 __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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
371 __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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
377 const u32 gid = get_global_id (0);
378 const u32 lid = get_local_id (0);
379 const u32 lsz = get_local_size (0);
385 __local u32 l_bin2asc[256];
387 for (u32 i = lid; i < 256; i += lsz)
389 const u32 i0 = (i >> 0) & 15;
390 const u32 i1 = (i >> 4) & 15;
392 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 8
393 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 0;
396 barrier (CLK_LOCAL_MEM_FENCE);
398 if (gid >= gid_max) return;
407 pw_buf0[0] = pws[gid].i[ 0];
408 pw_buf0[1] = pws[gid].i[ 1];
409 pw_buf0[2] = pws[gid].i[ 2];
410 pw_buf0[3] = pws[gid].i[ 3];
411 pw_buf1[0] = pws[gid].i[ 4];
412 pw_buf1[1] = pws[gid].i[ 5];
413 pw_buf1[2] = pws[gid].i[ 6];
414 pw_buf1[3] = pws[gid].i[ 7];
416 const u32 pw_len = pws[gid].pw_len;
424 challenge = salt_bufs[salt_pos].salt_buf[0];
433 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 1]; // not a bug, see challenge
434 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 2];
435 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 3];
436 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 4];
437 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 5];
438 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 6];
439 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 7];
440 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 8];
442 const u32 salt_len = salt_bufs[salt_pos].salt_len - 4;
448 const u32 search[4] =
450 digests_buf[digests_offset].digest_buf[DGST_R0],
451 digests_buf[digests_offset].digest_buf[DGST_R1],
452 digests_buf[digests_offset].digest_buf[DGST_R2],
453 digests_buf[digests_offset].digest_buf[DGST_R3]
460 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
467 const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
478 s0[0] = salt_buf0[0];
479 s0[1] = salt_buf0[1];
480 s0[2] = salt_buf0[2];
481 s0[3] = salt_buf0[3];
482 s1[0] = salt_buf1[0];
483 s1[1] = salt_buf1[1];
484 s1[2] = salt_buf1[2];
485 s1[3] = salt_buf1[3];
495 switch_buffer_by_offset_le_VV (s0, s1, s2, s3, out_len);
497 const u32x pw_salt_len = out_len + salt_len;
513 w3[2] = pw_salt_len * 8;
525 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
526 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
527 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
528 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
529 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
530 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
531 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
532 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
533 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
534 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
535 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
536 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
537 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
538 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
539 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
540 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
542 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
543 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
544 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
545 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
546 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
547 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
548 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
549 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
550 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
551 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
552 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
553 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
554 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
555 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
556 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
557 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
559 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
560 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
561 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
562 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
563 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
564 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
565 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
566 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
567 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
568 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
569 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
570 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
571 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
572 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
573 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
574 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
576 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
577 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
578 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
579 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
580 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
581 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
582 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
583 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
584 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
585 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
586 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
587 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
588 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
589 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
590 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
591 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
598 w0[0] = uint_to_hex_lower8 ((a >> 0) & 255) << 0
599 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
600 w0[1] = uint_to_hex_lower8 ((a >> 16) & 255) << 0
601 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
602 w0[2] = uint_to_hex_lower8 ((b >> 0) & 255) << 0
603 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
604 w0[3] = uint_to_hex_lower8 ((b >> 16) & 255) << 0
605 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
606 w1[0] = uint_to_hex_lower8 ((c >> 0) & 255) << 0
607 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
608 w1[1] = uint_to_hex_lower8 ((c >> 16) & 255) << 0
609 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
610 w1[2] = uint_to_hex_lower8 ((d >> 0) & 255) << 0
611 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
612 w1[3] = uint_to_hex_lower8 ((d >> 16) & 255) << 0
613 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
615 // add the 4 byte challenge here
623 w3[2] = (32 + 4) * 8;
627 * md5 ($hash.$challenge)
635 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
636 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
637 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
638 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
639 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
640 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
641 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
642 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
643 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
644 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
645 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
646 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
647 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
648 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
649 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
650 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
652 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
653 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
654 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
655 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
656 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
657 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
658 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
659 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
660 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
661 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
662 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
663 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
664 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
665 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
666 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
667 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
669 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
670 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
671 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
672 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
673 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
674 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
675 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
676 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
677 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
678 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
679 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
680 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
681 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
682 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
683 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
684 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
686 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
687 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
688 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
689 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
690 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
691 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
692 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
693 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
694 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
695 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
696 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
697 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
698 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
700 if (MATCHES_NONE_VS (a, search[0])) continue;
702 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
703 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
704 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
706 COMPARE_S_SIMD (a, d, c, b);
710 __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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
714 __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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)