2 * Authors.....: Jens Steube <jens.steube@gmail.com>
3 * Gabriele Gristina <matrix@hashcat.net>
12 #include "inc_vendor.cl"
13 #include "inc_hash_constants.h"
14 #include "inc_hash_functions.cl"
15 #include "inc_types.cl"
16 #include "inc_common.cl"
17 #include "inc_simd.cl"
19 void md4_transform (const u32x w0[4], const u32x w1[4], const u32x w2[4], const u32x w3[4], u32x digest[4])
43 MD4_STEP (MD4_Fo, a, b, c, d, w0_t, MD4C00, MD4S00);
44 MD4_STEP (MD4_Fo, d, a, b, c, w1_t, MD4C00, MD4S01);
45 MD4_STEP (MD4_Fo, c, d, a, b, w2_t, MD4C00, MD4S02);
46 MD4_STEP (MD4_Fo, b, c, d, a, w3_t, MD4C00, MD4S03);
47 MD4_STEP (MD4_Fo, a, b, c, d, w4_t, MD4C00, MD4S00);
48 MD4_STEP (MD4_Fo, d, a, b, c, w5_t, MD4C00, MD4S01);
49 MD4_STEP (MD4_Fo, c, d, a, b, w6_t, MD4C00, MD4S02);
50 MD4_STEP (MD4_Fo, b, c, d, a, w7_t, MD4C00, MD4S03);
51 MD4_STEP (MD4_Fo, a, b, c, d, w8_t, MD4C00, MD4S00);
52 MD4_STEP (MD4_Fo, d, a, b, c, w9_t, MD4C00, MD4S01);
53 MD4_STEP (MD4_Fo, c, d, a, b, wa_t, MD4C00, MD4S02);
54 MD4_STEP (MD4_Fo, b, c, d, a, wb_t, MD4C00, MD4S03);
55 MD4_STEP (MD4_Fo, a, b, c, d, wc_t, MD4C00, MD4S00);
56 MD4_STEP (MD4_Fo, d, a, b, c, wd_t, MD4C00, MD4S01);
57 MD4_STEP (MD4_Fo, c, d, a, b, we_t, MD4C00, MD4S02);
58 MD4_STEP (MD4_Fo, b, c, d, a, wf_t, MD4C00, MD4S03);
60 MD4_STEP (MD4_Go, a, b, c, d, w0_t, MD4C01, MD4S10);
61 MD4_STEP (MD4_Go, d, a, b, c, w4_t, MD4C01, MD4S11);
62 MD4_STEP (MD4_Go, c, d, a, b, w8_t, MD4C01, MD4S12);
63 MD4_STEP (MD4_Go, b, c, d, a, wc_t, MD4C01, MD4S13);
64 MD4_STEP (MD4_Go, a, b, c, d, w1_t, MD4C01, MD4S10);
65 MD4_STEP (MD4_Go, d, a, b, c, w5_t, MD4C01, MD4S11);
66 MD4_STEP (MD4_Go, c, d, a, b, w9_t, MD4C01, MD4S12);
67 MD4_STEP (MD4_Go, b, c, d, a, wd_t, MD4C01, MD4S13);
68 MD4_STEP (MD4_Go, a, b, c, d, w2_t, MD4C01, MD4S10);
69 MD4_STEP (MD4_Go, d, a, b, c, w6_t, MD4C01, MD4S11);
70 MD4_STEP (MD4_Go, c, d, a, b, wa_t, MD4C01, MD4S12);
71 MD4_STEP (MD4_Go, b, c, d, a, we_t, MD4C01, MD4S13);
72 MD4_STEP (MD4_Go, a, b, c, d, w3_t, MD4C01, MD4S10);
73 MD4_STEP (MD4_Go, d, a, b, c, w7_t, MD4C01, MD4S11);
74 MD4_STEP (MD4_Go, c, d, a, b, wb_t, MD4C01, MD4S12);
75 MD4_STEP (MD4_Go, b, c, d, a, wf_t, MD4C01, MD4S13);
77 MD4_STEP (MD4_H , a, b, c, d, w0_t, MD4C02, MD4S20);
78 MD4_STEP (MD4_H , d, a, b, c, w8_t, MD4C02, MD4S21);
79 MD4_STEP (MD4_H , c, d, a, b, w4_t, MD4C02, MD4S22);
80 MD4_STEP (MD4_H , b, c, d, a, wc_t, MD4C02, MD4S23);
81 MD4_STEP (MD4_H , a, b, c, d, w2_t, MD4C02, MD4S20);
82 MD4_STEP (MD4_H , d, a, b, c, wa_t, MD4C02, MD4S21);
83 MD4_STEP (MD4_H , c, d, a, b, w6_t, MD4C02, MD4S22);
84 MD4_STEP (MD4_H , b, c, d, a, we_t, MD4C02, MD4S23);
85 MD4_STEP (MD4_H , a, b, c, d, w1_t, MD4C02, MD4S20);
86 MD4_STEP (MD4_H , d, a, b, c, w9_t, MD4C02, MD4S21);
87 MD4_STEP (MD4_H , c, d, a, b, w5_t, MD4C02, MD4S22);
88 MD4_STEP (MD4_H , b, c, d, a, wd_t, MD4C02, MD4S23);
89 MD4_STEP (MD4_H , a, b, c, d, w3_t, MD4C02, MD4S20);
90 MD4_STEP (MD4_H , d, a, b, c, wb_t, MD4C02, MD4S21);
91 MD4_STEP (MD4_H , c, d, a, b, w7_t, MD4C02, MD4S22);
92 MD4_STEP (MD4_H , b, c, d, a, wf_t, MD4C02, MD4S23);
100 void md5_transform (const u32x w0[4], const u32x w1[4], const u32x w2[4], const u32x w3[4], u32x digest[4])
124 MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
125 MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
126 MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
127 MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
128 MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
129 MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
130 MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
131 MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
132 MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
133 MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
134 MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
135 MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
136 MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
137 MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
138 MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
139 MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
141 MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
142 MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
143 MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
144 MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
145 MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
146 MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
147 MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
148 MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
149 MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
150 MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
151 MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
152 MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
153 MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
154 MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
155 MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
156 MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
158 MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
159 MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
160 MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
161 MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
162 MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
163 MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
164 MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
165 MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
166 MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
167 MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
168 MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
169 MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
170 MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
171 MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
172 MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
173 MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
175 MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
176 MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
177 MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
178 MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
179 MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
180 MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
181 MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
182 MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
183 MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
184 MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
185 MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
186 MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
187 MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
188 MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
189 MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
190 MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
198 void hmac_md5_pad (u32x w0[4], u32x w1[4], u32x w2[4], u32x w3[4], u32x ipad[4], u32x opad[4])
200 w0[0] = w0[0] ^ 0x36363636;
201 w0[1] = w0[1] ^ 0x36363636;
202 w0[2] = w0[2] ^ 0x36363636;
203 w0[3] = w0[3] ^ 0x36363636;
204 w1[0] = w1[0] ^ 0x36363636;
205 w1[1] = w1[1] ^ 0x36363636;
206 w1[2] = w1[2] ^ 0x36363636;
207 w1[3] = w1[3] ^ 0x36363636;
208 w2[0] = w2[0] ^ 0x36363636;
209 w2[1] = w2[1] ^ 0x36363636;
210 w2[2] = w2[2] ^ 0x36363636;
211 w2[3] = w2[3] ^ 0x36363636;
212 w3[0] = w3[0] ^ 0x36363636;
213 w3[1] = w3[1] ^ 0x36363636;
214 w3[2] = w3[2] ^ 0x36363636;
215 w3[3] = w3[3] ^ 0x36363636;
222 md5_transform (w0, w1, w2, w3, ipad);
224 w0[0] = w0[0] ^ 0x6a6a6a6a;
225 w0[1] = w0[1] ^ 0x6a6a6a6a;
226 w0[2] = w0[2] ^ 0x6a6a6a6a;
227 w0[3] = w0[3] ^ 0x6a6a6a6a;
228 w1[0] = w1[0] ^ 0x6a6a6a6a;
229 w1[1] = w1[1] ^ 0x6a6a6a6a;
230 w1[2] = w1[2] ^ 0x6a6a6a6a;
231 w1[3] = w1[3] ^ 0x6a6a6a6a;
232 w2[0] = w2[0] ^ 0x6a6a6a6a;
233 w2[1] = w2[1] ^ 0x6a6a6a6a;
234 w2[2] = w2[2] ^ 0x6a6a6a6a;
235 w2[3] = w2[3] ^ 0x6a6a6a6a;
236 w3[0] = w3[0] ^ 0x6a6a6a6a;
237 w3[1] = w3[1] ^ 0x6a6a6a6a;
238 w3[2] = w3[2] ^ 0x6a6a6a6a;
239 w3[3] = w3[3] ^ 0x6a6a6a6a;
246 md5_transform (w0, w1, w2, w3, opad);
249 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])
256 md5_transform (w0, w1, w2, w3, digest);
272 w3[2] = (64 + 16) * 8;
280 md5_transform (w0, w1, w2, w3, digest);
283 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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
289 const u32 gid = get_global_id (0);
290 const u32 lid = get_local_id (0);
296 const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
297 + netntlm_bufs[salt_pos].domain_len;
299 const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
300 + netntlm_bufs[salt_pos].clichall_len;
308 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
310 const u32x w0r = ix_create_bft (bfs_buf, il_pos);
312 const u32x w0lr = w0l | w0r;
347 md4_transform (w0_t, w1_t, w2_t, w3_t, digest);
374 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
379 for (left = userdomain_len, off = 0; left >= 56; left -= 64, off += 16)
381 w0_t[0] = s_userdomain_buf[off + 0];
382 w0_t[1] = s_userdomain_buf[off + 1];
383 w0_t[2] = s_userdomain_buf[off + 2];
384 w0_t[3] = s_userdomain_buf[off + 3];
385 w1_t[0] = s_userdomain_buf[off + 4];
386 w1_t[1] = s_userdomain_buf[off + 5];
387 w1_t[2] = s_userdomain_buf[off + 6];
388 w1_t[3] = s_userdomain_buf[off + 7];
389 w2_t[0] = s_userdomain_buf[off + 8];
390 w2_t[1] = s_userdomain_buf[off + 9];
391 w2_t[2] = s_userdomain_buf[off + 10];
392 w2_t[3] = s_userdomain_buf[off + 11];
393 w3_t[0] = s_userdomain_buf[off + 12];
394 w3_t[1] = s_userdomain_buf[off + 13];
395 w3_t[2] = s_userdomain_buf[off + 14];
396 w3_t[3] = s_userdomain_buf[off + 15];
398 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
401 w0_t[0] = s_userdomain_buf[off + 0];
402 w0_t[1] = s_userdomain_buf[off + 1];
403 w0_t[2] = s_userdomain_buf[off + 2];
404 w0_t[3] = s_userdomain_buf[off + 3];
405 w1_t[0] = s_userdomain_buf[off + 4];
406 w1_t[1] = s_userdomain_buf[off + 5];
407 w1_t[2] = s_userdomain_buf[off + 6];
408 w1_t[3] = s_userdomain_buf[off + 7];
409 w2_t[0] = s_userdomain_buf[off + 8];
410 w2_t[1] = s_userdomain_buf[off + 9];
411 w2_t[2] = s_userdomain_buf[off + 10];
412 w2_t[3] = s_userdomain_buf[off + 11];
413 w3_t[0] = s_userdomain_buf[off + 12];
414 w3_t[1] = s_userdomain_buf[off + 13];
415 w3_t[2] = (64 + userdomain_len) * 8;
418 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
442 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
444 for (left = chall_len, off = 0; left >= 56; left -= 64, off += 16)
446 w0_t[0] = s_chall_buf[off + 0];
447 w0_t[1] = s_chall_buf[off + 1];
448 w0_t[2] = s_chall_buf[off + 2];
449 w0_t[3] = s_chall_buf[off + 3];
450 w1_t[0] = s_chall_buf[off + 4];
451 w1_t[1] = s_chall_buf[off + 5];
452 w1_t[2] = s_chall_buf[off + 6];
453 w1_t[3] = s_chall_buf[off + 7];
454 w2_t[0] = s_chall_buf[off + 8];
455 w2_t[1] = s_chall_buf[off + 9];
456 w2_t[2] = s_chall_buf[off + 10];
457 w2_t[3] = s_chall_buf[off + 11];
458 w3_t[0] = s_chall_buf[off + 12];
459 w3_t[1] = s_chall_buf[off + 13];
460 w3_t[2] = s_chall_buf[off + 14];
461 w3_t[3] = s_chall_buf[off + 15];
463 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
466 w0_t[0] = s_chall_buf[off + 0];
467 w0_t[1] = s_chall_buf[off + 1];
468 w0_t[2] = s_chall_buf[off + 2];
469 w0_t[3] = s_chall_buf[off + 3];
470 w1_t[0] = s_chall_buf[off + 4];
471 w1_t[1] = s_chall_buf[off + 5];
472 w1_t[2] = s_chall_buf[off + 6];
473 w1_t[3] = s_chall_buf[off + 7];
474 w2_t[0] = s_chall_buf[off + 8];
475 w2_t[1] = s_chall_buf[off + 9];
476 w2_t[2] = s_chall_buf[off + 10];
477 w2_t[3] = s_chall_buf[off + 11];
478 w3_t[0] = s_chall_buf[off + 12];
479 w3_t[1] = s_chall_buf[off + 13];
480 w3_t[2] = (64 + chall_len) * 8;
483 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
485 COMPARE_M_SIMD (digest[0], digest[3], digest[2], digest[1]);
489 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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
495 const u32 gid = get_global_id (0);
496 const u32 lid = get_local_id (0);
502 const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
503 + netntlm_bufs[salt_pos].domain_len;
505 const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
506 + netntlm_bufs[salt_pos].clichall_len;
512 const u32 search[4] =
514 digests_buf[digests_offset].digest_buf[DGST_R0],
515 digests_buf[digests_offset].digest_buf[DGST_R1],
516 digests_buf[digests_offset].digest_buf[DGST_R2],
517 digests_buf[digests_offset].digest_buf[DGST_R3]
526 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
528 const u32x w0r = ix_create_bft (bfs_buf, il_pos);
530 const u32x w0lr = w0l | w0r;
565 md4_transform (w0_t, w1_t, w2_t, w3_t, digest);
592 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
597 for (left = userdomain_len, off = 0; left >= 56; left -= 64, off += 16)
599 w0_t[0] = s_userdomain_buf[off + 0];
600 w0_t[1] = s_userdomain_buf[off + 1];
601 w0_t[2] = s_userdomain_buf[off + 2];
602 w0_t[3] = s_userdomain_buf[off + 3];
603 w1_t[0] = s_userdomain_buf[off + 4];
604 w1_t[1] = s_userdomain_buf[off + 5];
605 w1_t[2] = s_userdomain_buf[off + 6];
606 w1_t[3] = s_userdomain_buf[off + 7];
607 w2_t[0] = s_userdomain_buf[off + 8];
608 w2_t[1] = s_userdomain_buf[off + 9];
609 w2_t[2] = s_userdomain_buf[off + 10];
610 w2_t[3] = s_userdomain_buf[off + 11];
611 w3_t[0] = s_userdomain_buf[off + 12];
612 w3_t[1] = s_userdomain_buf[off + 13];
613 w3_t[2] = s_userdomain_buf[off + 14];
614 w3_t[3] = s_userdomain_buf[off + 15];
616 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
619 w0_t[0] = s_userdomain_buf[off + 0];
620 w0_t[1] = s_userdomain_buf[off + 1];
621 w0_t[2] = s_userdomain_buf[off + 2];
622 w0_t[3] = s_userdomain_buf[off + 3];
623 w1_t[0] = s_userdomain_buf[off + 4];
624 w1_t[1] = s_userdomain_buf[off + 5];
625 w1_t[2] = s_userdomain_buf[off + 6];
626 w1_t[3] = s_userdomain_buf[off + 7];
627 w2_t[0] = s_userdomain_buf[off + 8];
628 w2_t[1] = s_userdomain_buf[off + 9];
629 w2_t[2] = s_userdomain_buf[off + 10];
630 w2_t[3] = s_userdomain_buf[off + 11];
631 w3_t[0] = s_userdomain_buf[off + 12];
632 w3_t[1] = s_userdomain_buf[off + 13];
633 w3_t[2] = (64 + userdomain_len) * 8;
636 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
660 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
662 for (left = chall_len, off = 0; left >= 56; left -= 64, off += 16)
664 w0_t[0] = s_chall_buf[off + 0];
665 w0_t[1] = s_chall_buf[off + 1];
666 w0_t[2] = s_chall_buf[off + 2];
667 w0_t[3] = s_chall_buf[off + 3];
668 w1_t[0] = s_chall_buf[off + 4];
669 w1_t[1] = s_chall_buf[off + 5];
670 w1_t[2] = s_chall_buf[off + 6];
671 w1_t[3] = s_chall_buf[off + 7];
672 w2_t[0] = s_chall_buf[off + 8];
673 w2_t[1] = s_chall_buf[off + 9];
674 w2_t[2] = s_chall_buf[off + 10];
675 w2_t[3] = s_chall_buf[off + 11];
676 w3_t[0] = s_chall_buf[off + 12];
677 w3_t[1] = s_chall_buf[off + 13];
678 w3_t[2] = s_chall_buf[off + 14];
679 w3_t[3] = s_chall_buf[off + 15];
681 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
684 w0_t[0] = s_chall_buf[off + 0];
685 w0_t[1] = s_chall_buf[off + 1];
686 w0_t[2] = s_chall_buf[off + 2];
687 w0_t[3] = s_chall_buf[off + 3];
688 w1_t[0] = s_chall_buf[off + 4];
689 w1_t[1] = s_chall_buf[off + 5];
690 w1_t[2] = s_chall_buf[off + 6];
691 w1_t[3] = s_chall_buf[off + 7];
692 w2_t[0] = s_chall_buf[off + 8];
693 w2_t[1] = s_chall_buf[off + 9];
694 w2_t[2] = s_chall_buf[off + 10];
695 w2_t[3] = s_chall_buf[off + 11];
696 w3_t[0] = s_chall_buf[off + 12];
697 w3_t[1] = s_chall_buf[off + 13];
698 w3_t[2] = (64 + chall_len) * 8;
701 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
703 COMPARE_S_SIMD (digest[0], digest[3], digest[2], digest[1]);
707 __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
713 const u32 gid = get_global_id (0);
714 const u32 lid = get_local_id (0);
715 const u32 lsz = get_local_size (0);
721 __local u32 s_userdomain_buf[64];
723 for (u32 i = lid; i < 64; i += lsz)
725 s_userdomain_buf[i] = netntlm_bufs[salt_pos].userdomain_buf[i];
728 __local u32 s_chall_buf[256];
730 for (u32 i = lid; i < 256; i += lsz)
732 s_chall_buf[i] = netntlm_bufs[salt_pos].chall_buf[i];
735 barrier (CLK_LOCAL_MEM_FENCE);
737 if (gid >= gid_max) return;
739 const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
740 + netntlm_bufs[salt_pos].domain_len;
742 const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
743 + netntlm_bufs[salt_pos].clichall_len;
751 w0[0] = pws[gid].i[ 0];
752 w0[1] = pws[gid].i[ 1];
753 w0[2] = pws[gid].i[ 2];
754 w0[3] = pws[gid].i[ 3];
774 w3[2] = pws[gid].i[14];
777 const u32 pw_len = pws[gid].pw_len;
783 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_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_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);
786 __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
792 const u32 gid = get_global_id (0);
793 const u32 lid = get_local_id (0);
794 const u32 lsz = get_local_size (0);
800 __local u32 s_userdomain_buf[64];
802 for (u32 i = lid; i < 64; i += lsz)
804 s_userdomain_buf[i] = netntlm_bufs[salt_pos].userdomain_buf[i];
807 __local u32 s_chall_buf[256];
809 for (u32 i = lid; i < 256; i += lsz)
811 s_chall_buf[i] = netntlm_bufs[salt_pos].chall_buf[i];
814 barrier (CLK_LOCAL_MEM_FENCE);
816 if (gid >= gid_max) return;
818 const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
819 + netntlm_bufs[salt_pos].domain_len;
821 const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
822 + netntlm_bufs[salt_pos].clichall_len;
830 w0[0] = pws[gid].i[ 0];
831 w0[1] = pws[gid].i[ 1];
832 w0[2] = pws[gid].i[ 2];
833 w0[3] = pws[gid].i[ 3];
837 w1[0] = pws[gid].i[ 4];
838 w1[1] = pws[gid].i[ 5];
839 w1[2] = pws[gid].i[ 6];
840 w1[3] = pws[gid].i[ 7];
853 w3[2] = pws[gid].i[14];
856 const u32 pw_len = pws[gid].pw_len;
862 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_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_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);
865 __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
869 __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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 const u32 gid = get_global_id (0);
876 const u32 lid = get_local_id (0);
877 const u32 lsz = get_local_size (0);
883 __local u32 s_userdomain_buf[64];
885 for (u32 i = lid; i < 64; i += lsz)
887 s_userdomain_buf[i] = netntlm_bufs[salt_pos].userdomain_buf[i];
890 __local u32 s_chall_buf[256];
892 for (u32 i = lid; i < 256; i += lsz)
894 s_chall_buf[i] = netntlm_bufs[salt_pos].chall_buf[i];
897 barrier (CLK_LOCAL_MEM_FENCE);
899 if (gid >= gid_max) return;
901 const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
902 + netntlm_bufs[salt_pos].domain_len;
904 const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
905 + netntlm_bufs[salt_pos].clichall_len;
913 w0[0] = pws[gid].i[ 0];
914 w0[1] = pws[gid].i[ 1];
915 w0[2] = pws[gid].i[ 2];
916 w0[3] = pws[gid].i[ 3];
936 w3[2] = pws[gid].i[14];
939 const u32 pw_len = pws[gid].pw_len;
945 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_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_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);
948 __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
954 const u32 gid = get_global_id (0);
955 const u32 lid = get_local_id (0);
956 const u32 lsz = get_local_size (0);
962 __local u32 s_userdomain_buf[64];
964 for (u32 i = lid; i < 64; i += lsz)
966 s_userdomain_buf[i] = netntlm_bufs[salt_pos].userdomain_buf[i];
969 __local u32 s_chall_buf[256];
971 for (u32 i = lid; i < 256; i += lsz)
973 s_chall_buf[i] = netntlm_bufs[salt_pos].chall_buf[i];
976 barrier (CLK_LOCAL_MEM_FENCE);
978 if (gid >= gid_max) return;
980 const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
981 + netntlm_bufs[salt_pos].domain_len;
983 const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
984 + netntlm_bufs[salt_pos].clichall_len;
992 w0[0] = pws[gid].i[ 0];
993 w0[1] = pws[gid].i[ 1];
994 w0[2] = pws[gid].i[ 2];
995 w0[3] = pws[gid].i[ 3];
999 w1[0] = pws[gid].i[ 4];
1000 w1[1] = pws[gid].i[ 5];
1001 w1[2] = pws[gid].i[ 6];
1002 w1[3] = pws[gid].i[ 7];
1015 w3[2] = pws[gid].i[14];
1018 const u32 pw_len = pws[gid].pw_len;
1024 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_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_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);
1027 __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)