2 * Authors.....: Jens Steube <jens.steube@gmail.com>
3 * Gabriele Gristina <matrix@hashcat.net>
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"
23 #include "inc_simd.cl"
25 void md4_transform (const u32x w0[4], const u32x w1[4], const u32x w2[4], const u32x w3[4], u32x digest[4])
49 MD4_STEP (MD4_Fo, a, b, c, d, w0_t, MD4C00, MD4S00);
50 MD4_STEP (MD4_Fo, d, a, b, c, w1_t, MD4C00, MD4S01);
51 MD4_STEP (MD4_Fo, c, d, a, b, w2_t, MD4C00, MD4S02);
52 MD4_STEP (MD4_Fo, b, c, d, a, w3_t, MD4C00, MD4S03);
53 MD4_STEP (MD4_Fo, a, b, c, d, w4_t, MD4C00, MD4S00);
54 MD4_STEP (MD4_Fo, d, a, b, c, w5_t, MD4C00, MD4S01);
55 MD4_STEP (MD4_Fo, c, d, a, b, w6_t, MD4C00, MD4S02);
56 MD4_STEP (MD4_Fo, b, c, d, a, w7_t, MD4C00, MD4S03);
57 MD4_STEP (MD4_Fo, a, b, c, d, w8_t, MD4C00, MD4S00);
58 MD4_STEP (MD4_Fo, d, a, b, c, w9_t, MD4C00, MD4S01);
59 MD4_STEP (MD4_Fo, c, d, a, b, wa_t, MD4C00, MD4S02);
60 MD4_STEP (MD4_Fo, b, c, d, a, wb_t, MD4C00, MD4S03);
61 MD4_STEP (MD4_Fo, a, b, c, d, wc_t, MD4C00, MD4S00);
62 MD4_STEP (MD4_Fo, d, a, b, c, wd_t, MD4C00, MD4S01);
63 MD4_STEP (MD4_Fo, c, d, a, b, we_t, MD4C00, MD4S02);
64 MD4_STEP (MD4_Fo, b, c, d, a, wf_t, MD4C00, MD4S03);
66 MD4_STEP (MD4_Go, a, b, c, d, w0_t, MD4C01, MD4S10);
67 MD4_STEP (MD4_Go, d, a, b, c, w4_t, MD4C01, MD4S11);
68 MD4_STEP (MD4_Go, c, d, a, b, w8_t, MD4C01, MD4S12);
69 MD4_STEP (MD4_Go, b, c, d, a, wc_t, MD4C01, MD4S13);
70 MD4_STEP (MD4_Go, a, b, c, d, w1_t, MD4C01, MD4S10);
71 MD4_STEP (MD4_Go, d, a, b, c, w5_t, MD4C01, MD4S11);
72 MD4_STEP (MD4_Go, c, d, a, b, w9_t, MD4C01, MD4S12);
73 MD4_STEP (MD4_Go, b, c, d, a, wd_t, MD4C01, MD4S13);
74 MD4_STEP (MD4_Go, a, b, c, d, w2_t, MD4C01, MD4S10);
75 MD4_STEP (MD4_Go, d, a, b, c, w6_t, MD4C01, MD4S11);
76 MD4_STEP (MD4_Go, c, d, a, b, wa_t, MD4C01, MD4S12);
77 MD4_STEP (MD4_Go, b, c, d, a, we_t, MD4C01, MD4S13);
78 MD4_STEP (MD4_Go, a, b, c, d, w3_t, MD4C01, MD4S10);
79 MD4_STEP (MD4_Go, d, a, b, c, w7_t, MD4C01, MD4S11);
80 MD4_STEP (MD4_Go, c, d, a, b, wb_t, MD4C01, MD4S12);
81 MD4_STEP (MD4_Go, b, c, d, a, wf_t, MD4C01, MD4S13);
83 MD4_STEP (MD4_H , a, b, c, d, w0_t, MD4C02, MD4S20);
84 MD4_STEP (MD4_H , d, a, b, c, w8_t, MD4C02, MD4S21);
85 MD4_STEP (MD4_H , c, d, a, b, w4_t, MD4C02, MD4S22);
86 MD4_STEP (MD4_H , b, c, d, a, wc_t, MD4C02, MD4S23);
87 MD4_STEP (MD4_H , a, b, c, d, w2_t, MD4C02, MD4S20);
88 MD4_STEP (MD4_H , d, a, b, c, wa_t, MD4C02, MD4S21);
89 MD4_STEP (MD4_H , c, d, a, b, w6_t, MD4C02, MD4S22);
90 MD4_STEP (MD4_H , b, c, d, a, we_t, MD4C02, MD4S23);
91 MD4_STEP (MD4_H , a, b, c, d, w1_t, MD4C02, MD4S20);
92 MD4_STEP (MD4_H , d, a, b, c, w9_t, MD4C02, MD4S21);
93 MD4_STEP (MD4_H , c, d, a, b, w5_t, MD4C02, MD4S22);
94 MD4_STEP (MD4_H , b, c, d, a, wd_t, MD4C02, MD4S23);
95 MD4_STEP (MD4_H , a, b, c, d, w3_t, MD4C02, MD4S20);
96 MD4_STEP (MD4_H , d, a, b, c, wb_t, MD4C02, MD4S21);
97 MD4_STEP (MD4_H , c, d, a, b, w7_t, MD4C02, MD4S22);
98 MD4_STEP (MD4_H , b, c, d, a, wf_t, MD4C02, MD4S23);
106 void md5_transform (const u32x w0[4], const u32x w1[4], const u32x w2[4], const u32x w3[4], u32x digest[4])
130 MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
131 MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
132 MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
133 MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
134 MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
135 MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
136 MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
137 MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
138 MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
139 MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
140 MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
141 MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
142 MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
143 MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
144 MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
145 MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
147 MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
148 MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
149 MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
150 MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
151 MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
152 MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
153 MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
154 MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
155 MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
156 MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
157 MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
158 MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
159 MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
160 MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
161 MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
162 MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
164 MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
165 MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
166 MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
167 MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
168 MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
169 MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
170 MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
171 MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
172 MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
173 MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
174 MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
175 MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
176 MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
177 MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
178 MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
179 MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
181 MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
182 MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
183 MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
184 MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
185 MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
186 MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
187 MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
188 MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
189 MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
190 MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
191 MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
192 MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
193 MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
194 MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
195 MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
196 MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
204 void hmac_md5_pad (u32x w0[4], u32x w1[4], u32x w2[4], u32x w3[4], u32x ipad[4], u32x opad[4])
206 w0[0] = w0[0] ^ 0x36363636;
207 w0[1] = w0[1] ^ 0x36363636;
208 w0[2] = w0[2] ^ 0x36363636;
209 w0[3] = w0[3] ^ 0x36363636;
210 w1[0] = w1[0] ^ 0x36363636;
211 w1[1] = w1[1] ^ 0x36363636;
212 w1[2] = w1[2] ^ 0x36363636;
213 w1[3] = w1[3] ^ 0x36363636;
214 w2[0] = w2[0] ^ 0x36363636;
215 w2[1] = w2[1] ^ 0x36363636;
216 w2[2] = w2[2] ^ 0x36363636;
217 w2[3] = w2[3] ^ 0x36363636;
218 w3[0] = w3[0] ^ 0x36363636;
219 w3[1] = w3[1] ^ 0x36363636;
220 w3[2] = w3[2] ^ 0x36363636;
221 w3[3] = w3[3] ^ 0x36363636;
228 md5_transform (w0, w1, w2, w3, ipad);
230 w0[0] = w0[0] ^ 0x6a6a6a6a;
231 w0[1] = w0[1] ^ 0x6a6a6a6a;
232 w0[2] = w0[2] ^ 0x6a6a6a6a;
233 w0[3] = w0[3] ^ 0x6a6a6a6a;
234 w1[0] = w1[0] ^ 0x6a6a6a6a;
235 w1[1] = w1[1] ^ 0x6a6a6a6a;
236 w1[2] = w1[2] ^ 0x6a6a6a6a;
237 w1[3] = w1[3] ^ 0x6a6a6a6a;
238 w2[0] = w2[0] ^ 0x6a6a6a6a;
239 w2[1] = w2[1] ^ 0x6a6a6a6a;
240 w2[2] = w2[2] ^ 0x6a6a6a6a;
241 w2[3] = w2[3] ^ 0x6a6a6a6a;
242 w3[0] = w3[0] ^ 0x6a6a6a6a;
243 w3[1] = w3[1] ^ 0x6a6a6a6a;
244 w3[2] = w3[2] ^ 0x6a6a6a6a;
245 w3[3] = w3[3] ^ 0x6a6a6a6a;
252 md5_transform (w0, w1, w2, w3, opad);
255 void hmac_md5_run (u32x w0[4], u32x w1[4], u32x w2[4], u32x w3[4], u32x ipad[4], u32x opad[4], u32x digest[4])
262 md5_transform (w0, w1, w2, w3, digest);
278 w3[2] = (64 + 16) * 8;
286 md5_transform (w0, w1, w2, w3, digest);
289 void m05600m (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_len, __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 netntlm_t *netntlm_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, __local u32 *s_userdomain_buf, __local u32 *s_chall_buf)
295 const u32 gid = get_global_id (0);
296 const u32 lid = get_local_id (0);
302 const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
303 + netntlm_bufs[salt_pos].domain_len;
305 const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
306 + netntlm_bufs[salt_pos].clichall_len;
314 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
316 const u32x w0r = ix_create_bft (bfs_buf, il_pos);
318 const u32x w0lr = w0l | w0r;
353 md4_transform (w0_t, w1_t, w2_t, w3_t, digest);
380 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
385 for (left = userdomain_len, off = 0; left >= 56; left -= 64, off += 16)
387 w0_t[0] = s_userdomain_buf[off + 0];
388 w0_t[1] = s_userdomain_buf[off + 1];
389 w0_t[2] = s_userdomain_buf[off + 2];
390 w0_t[3] = s_userdomain_buf[off + 3];
391 w1_t[0] = s_userdomain_buf[off + 4];
392 w1_t[1] = s_userdomain_buf[off + 5];
393 w1_t[2] = s_userdomain_buf[off + 6];
394 w1_t[3] = s_userdomain_buf[off + 7];
395 w2_t[0] = s_userdomain_buf[off + 8];
396 w2_t[1] = s_userdomain_buf[off + 9];
397 w2_t[2] = s_userdomain_buf[off + 10];
398 w2_t[3] = s_userdomain_buf[off + 11];
399 w3_t[0] = s_userdomain_buf[off + 12];
400 w3_t[1] = s_userdomain_buf[off + 13];
401 w3_t[2] = s_userdomain_buf[off + 14];
402 w3_t[3] = s_userdomain_buf[off + 15];
404 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
407 w0_t[0] = s_userdomain_buf[off + 0];
408 w0_t[1] = s_userdomain_buf[off + 1];
409 w0_t[2] = s_userdomain_buf[off + 2];
410 w0_t[3] = s_userdomain_buf[off + 3];
411 w1_t[0] = s_userdomain_buf[off + 4];
412 w1_t[1] = s_userdomain_buf[off + 5];
413 w1_t[2] = s_userdomain_buf[off + 6];
414 w1_t[3] = s_userdomain_buf[off + 7];
415 w2_t[0] = s_userdomain_buf[off + 8];
416 w2_t[1] = s_userdomain_buf[off + 9];
417 w2_t[2] = s_userdomain_buf[off + 10];
418 w2_t[3] = s_userdomain_buf[off + 11];
419 w3_t[0] = s_userdomain_buf[off + 12];
420 w3_t[1] = s_userdomain_buf[off + 13];
421 w3_t[2] = (64 + userdomain_len) * 8;
424 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
448 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
450 for (left = chall_len, off = 0; left >= 56; left -= 64, off += 16)
452 w0_t[0] = s_chall_buf[off + 0];
453 w0_t[1] = s_chall_buf[off + 1];
454 w0_t[2] = s_chall_buf[off + 2];
455 w0_t[3] = s_chall_buf[off + 3];
456 w1_t[0] = s_chall_buf[off + 4];
457 w1_t[1] = s_chall_buf[off + 5];
458 w1_t[2] = s_chall_buf[off + 6];
459 w1_t[3] = s_chall_buf[off + 7];
460 w2_t[0] = s_chall_buf[off + 8];
461 w2_t[1] = s_chall_buf[off + 9];
462 w2_t[2] = s_chall_buf[off + 10];
463 w2_t[3] = s_chall_buf[off + 11];
464 w3_t[0] = s_chall_buf[off + 12];
465 w3_t[1] = s_chall_buf[off + 13];
466 w3_t[2] = s_chall_buf[off + 14];
467 w3_t[3] = s_chall_buf[off + 15];
469 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
472 w0_t[0] = s_chall_buf[off + 0];
473 w0_t[1] = s_chall_buf[off + 1];
474 w0_t[2] = s_chall_buf[off + 2];
475 w0_t[3] = s_chall_buf[off + 3];
476 w1_t[0] = s_chall_buf[off + 4];
477 w1_t[1] = s_chall_buf[off + 5];
478 w1_t[2] = s_chall_buf[off + 6];
479 w1_t[3] = s_chall_buf[off + 7];
480 w2_t[0] = s_chall_buf[off + 8];
481 w2_t[1] = s_chall_buf[off + 9];
482 w2_t[2] = s_chall_buf[off + 10];
483 w2_t[3] = s_chall_buf[off + 11];
484 w3_t[0] = s_chall_buf[off + 12];
485 w3_t[1] = s_chall_buf[off + 13];
486 w3_t[2] = (64 + chall_len) * 8;
489 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
491 COMPARE_M_SIMD (digest[0], digest[3], digest[2], digest[1]);
495 void m05600s (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_len, __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 netntlm_t *netntlm_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, __local u32 *s_userdomain_buf, __local u32 *s_chall_buf)
501 const u32 gid = get_global_id (0);
502 const u32 lid = get_local_id (0);
508 const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
509 + netntlm_bufs[salt_pos].domain_len;
511 const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
512 + netntlm_bufs[salt_pos].clichall_len;
518 const u32 search[4] =
520 digests_buf[digests_offset].digest_buf[DGST_R0],
521 digests_buf[digests_offset].digest_buf[DGST_R1],
522 digests_buf[digests_offset].digest_buf[DGST_R2],
523 digests_buf[digests_offset].digest_buf[DGST_R3]
532 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
534 const u32x w0r = ix_create_bft (bfs_buf, il_pos);
536 const u32x w0lr = w0l | w0r;
571 md4_transform (w0_t, w1_t, w2_t, w3_t, digest);
598 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
603 for (left = userdomain_len, off = 0; left >= 56; left -= 64, off += 16)
605 w0_t[0] = s_userdomain_buf[off + 0];
606 w0_t[1] = s_userdomain_buf[off + 1];
607 w0_t[2] = s_userdomain_buf[off + 2];
608 w0_t[3] = s_userdomain_buf[off + 3];
609 w1_t[0] = s_userdomain_buf[off + 4];
610 w1_t[1] = s_userdomain_buf[off + 5];
611 w1_t[2] = s_userdomain_buf[off + 6];
612 w1_t[3] = s_userdomain_buf[off + 7];
613 w2_t[0] = s_userdomain_buf[off + 8];
614 w2_t[1] = s_userdomain_buf[off + 9];
615 w2_t[2] = s_userdomain_buf[off + 10];
616 w2_t[3] = s_userdomain_buf[off + 11];
617 w3_t[0] = s_userdomain_buf[off + 12];
618 w3_t[1] = s_userdomain_buf[off + 13];
619 w3_t[2] = s_userdomain_buf[off + 14];
620 w3_t[3] = s_userdomain_buf[off + 15];
622 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
625 w0_t[0] = s_userdomain_buf[off + 0];
626 w0_t[1] = s_userdomain_buf[off + 1];
627 w0_t[2] = s_userdomain_buf[off + 2];
628 w0_t[3] = s_userdomain_buf[off + 3];
629 w1_t[0] = s_userdomain_buf[off + 4];
630 w1_t[1] = s_userdomain_buf[off + 5];
631 w1_t[2] = s_userdomain_buf[off + 6];
632 w1_t[3] = s_userdomain_buf[off + 7];
633 w2_t[0] = s_userdomain_buf[off + 8];
634 w2_t[1] = s_userdomain_buf[off + 9];
635 w2_t[2] = s_userdomain_buf[off + 10];
636 w2_t[3] = s_userdomain_buf[off + 11];
637 w3_t[0] = s_userdomain_buf[off + 12];
638 w3_t[1] = s_userdomain_buf[off + 13];
639 w3_t[2] = (64 + userdomain_len) * 8;
642 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
666 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
668 for (left = chall_len, off = 0; left >= 56; left -= 64, off += 16)
670 w0_t[0] = s_chall_buf[off + 0];
671 w0_t[1] = s_chall_buf[off + 1];
672 w0_t[2] = s_chall_buf[off + 2];
673 w0_t[3] = s_chall_buf[off + 3];
674 w1_t[0] = s_chall_buf[off + 4];
675 w1_t[1] = s_chall_buf[off + 5];
676 w1_t[2] = s_chall_buf[off + 6];
677 w1_t[3] = s_chall_buf[off + 7];
678 w2_t[0] = s_chall_buf[off + 8];
679 w2_t[1] = s_chall_buf[off + 9];
680 w2_t[2] = s_chall_buf[off + 10];
681 w2_t[3] = s_chall_buf[off + 11];
682 w3_t[0] = s_chall_buf[off + 12];
683 w3_t[1] = s_chall_buf[off + 13];
684 w3_t[2] = s_chall_buf[off + 14];
685 w3_t[3] = s_chall_buf[off + 15];
687 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
690 w0_t[0] = s_chall_buf[off + 0];
691 w0_t[1] = s_chall_buf[off + 1];
692 w0_t[2] = s_chall_buf[off + 2];
693 w0_t[3] = s_chall_buf[off + 3];
694 w1_t[0] = s_chall_buf[off + 4];
695 w1_t[1] = s_chall_buf[off + 5];
696 w1_t[2] = s_chall_buf[off + 6];
697 w1_t[3] = s_chall_buf[off + 7];
698 w2_t[0] = s_chall_buf[off + 8];
699 w2_t[1] = s_chall_buf[off + 9];
700 w2_t[2] = s_chall_buf[off + 10];
701 w2_t[3] = s_chall_buf[off + 11];
702 w3_t[0] = s_chall_buf[off + 12];
703 w3_t[1] = s_chall_buf[off + 13];
704 w3_t[2] = (64 + chall_len) * 8;
707 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
709 COMPARE_S_SIMD (digest[0], digest[3], digest[2], digest[1]);
713 __kernel void m05600_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 netntlm_t *netntlm_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)
719 const u32 gid = get_global_id (0);
720 const u32 lid = get_local_id (0);
721 const u32 lsz = get_local_size (0);
727 __local u32 s_userdomain_buf[64];
729 for (u32 i = lid; i < 64; i += lsz)
731 s_userdomain_buf[i] = netntlm_bufs[salt_pos].userdomain_buf[i];
734 __local u32 s_chall_buf[256];
736 for (u32 i = lid; i < 256; i += lsz)
738 s_chall_buf[i] = netntlm_bufs[salt_pos].chall_buf[i];
741 barrier (CLK_LOCAL_MEM_FENCE);
743 if (gid >= gid_max) return;
745 const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
746 + netntlm_bufs[salt_pos].domain_len;
748 const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
749 + netntlm_bufs[salt_pos].clichall_len;
757 w0[0] = pws[gid].i[ 0];
758 w0[1] = pws[gid].i[ 1];
759 w0[2] = pws[gid].i[ 2];
760 w0[3] = pws[gid].i[ 3];
780 w3[2] = pws[gid].i[14];
783 const u32 pw_len = pws[gid].pw_len;
789 m05600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, netntlm_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, s_userdomain_buf, s_chall_buf);
792 __kernel void m05600_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 netntlm_t *netntlm_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)
798 const u32 gid = get_global_id (0);
799 const u32 lid = get_local_id (0);
800 const u32 lsz = get_local_size (0);
806 __local u32 s_userdomain_buf[64];
808 for (u32 i = lid; i < 64; i += lsz)
810 s_userdomain_buf[i] = netntlm_bufs[salt_pos].userdomain_buf[i];
813 __local u32 s_chall_buf[256];
815 for (u32 i = lid; i < 256; i += lsz)
817 s_chall_buf[i] = netntlm_bufs[salt_pos].chall_buf[i];
820 barrier (CLK_LOCAL_MEM_FENCE);
822 if (gid >= gid_max) return;
824 const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
825 + netntlm_bufs[salt_pos].domain_len;
827 const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
828 + netntlm_bufs[salt_pos].clichall_len;
836 w0[0] = pws[gid].i[ 0];
837 w0[1] = pws[gid].i[ 1];
838 w0[2] = pws[gid].i[ 2];
839 w0[3] = pws[gid].i[ 3];
843 w1[0] = pws[gid].i[ 4];
844 w1[1] = pws[gid].i[ 5];
845 w1[2] = pws[gid].i[ 6];
846 w1[3] = pws[gid].i[ 7];
859 w3[2] = pws[gid].i[14];
862 const u32 pw_len = pws[gid].pw_len;
868 m05600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, netntlm_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, s_userdomain_buf, s_chall_buf);
871 __kernel void m05600_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 netntlm_t *netntlm_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)
875 __kernel void m05600_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 netntlm_t *netntlm_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)
881 const u32 gid = get_global_id (0);
882 const u32 lid = get_local_id (0);
883 const u32 lsz = get_local_size (0);
889 __local u32 s_userdomain_buf[64];
891 for (u32 i = lid; i < 64; i += lsz)
893 s_userdomain_buf[i] = netntlm_bufs[salt_pos].userdomain_buf[i];
896 __local u32 s_chall_buf[256];
898 for (u32 i = lid; i < 256; i += lsz)
900 s_chall_buf[i] = netntlm_bufs[salt_pos].chall_buf[i];
903 barrier (CLK_LOCAL_MEM_FENCE);
905 if (gid >= gid_max) return;
907 const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
908 + netntlm_bufs[salt_pos].domain_len;
910 const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
911 + netntlm_bufs[salt_pos].clichall_len;
919 w0[0] = pws[gid].i[ 0];
920 w0[1] = pws[gid].i[ 1];
921 w0[2] = pws[gid].i[ 2];
922 w0[3] = pws[gid].i[ 3];
942 w3[2] = pws[gid].i[14];
945 const u32 pw_len = pws[gid].pw_len;
951 m05600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, netntlm_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, s_userdomain_buf, s_chall_buf);
954 __kernel void m05600_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 netntlm_t *netntlm_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)
960 const u32 gid = get_global_id (0);
961 const u32 lid = get_local_id (0);
962 const u32 lsz = get_local_size (0);
968 __local u32 s_userdomain_buf[64];
970 for (u32 i = lid; i < 64; i += lsz)
972 s_userdomain_buf[i] = netntlm_bufs[salt_pos].userdomain_buf[i];
975 __local u32 s_chall_buf[256];
977 for (u32 i = lid; i < 256; i += lsz)
979 s_chall_buf[i] = netntlm_bufs[salt_pos].chall_buf[i];
982 barrier (CLK_LOCAL_MEM_FENCE);
984 if (gid >= gid_max) return;
986 const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
987 + netntlm_bufs[salt_pos].domain_len;
989 const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
990 + netntlm_bufs[salt_pos].clichall_len;
998 w0[0] = pws[gid].i[ 0];
999 w0[1] = pws[gid].i[ 1];
1000 w0[2] = pws[gid].i[ 2];
1001 w0[3] = pws[gid].i[ 3];
1005 w1[0] = pws[gid].i[ 4];
1006 w1[1] = pws[gid].i[ 5];
1007 w1[2] = pws[gid].i[ 6];
1008 w1[3] = pws[gid].i[ 7];
1021 w3[2] = pws[gid].i[14];
1024 const u32 pw_len = pws[gid].pw_len;
1030 m05600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, netntlm_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, s_userdomain_buf, s_chall_buf);
1033 __kernel void m05600_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 netntlm_t *netntlm_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)