2 * Authors......: Jens Steube <jens.steube@gmail.com>
3 * Fist0urs <eddy.maaalou@gmail.com>
4 * Gabriele Gristina <matrix@hashcat.net>
11 //too much register pressure
12 //#define NEW_SIMD_CODE
14 #include "inc_hash_constants.h"
15 #include "inc_vendor.cl"
22 #include "inc_hash_functions.cl"
23 #include "inc_types.cl"
24 #include "inc_common.cl"
27 #include "inc_simd.cl"
37 void swap (__local RC4_KEY *rc4_key, const u8 i, const u8 j)
42 rc4_key->S[i] = rc4_key->S[j];
46 void rc4_init_16 (__local RC4_KEY *rc4_key, const u32 data[4])
51 __local u32 *ptr = (__local u32 *) rc4_key->S;
56 for (u32 i = 0; i < 64; i++)
63 for (u32 i = 0; i < 16; i++)
71 j += rc4_key->S[idx] + (v >> 0); swap (rc4_key, idx, j); idx++;
72 j += rc4_key->S[idx] + (v >> 8); swap (rc4_key, idx, j); idx++;
73 j += rc4_key->S[idx] + (v >> 16); swap (rc4_key, idx, j); idx++;
74 j += rc4_key->S[idx] + (v >> 24); swap (rc4_key, idx, j); idx++;
78 j += rc4_key->S[idx] + (v >> 0); swap (rc4_key, idx, j); idx++;
79 j += rc4_key->S[idx] + (v >> 8); swap (rc4_key, idx, j); idx++;
80 j += rc4_key->S[idx] + (v >> 16); swap (rc4_key, idx, j); idx++;
81 j += rc4_key->S[idx] + (v >> 24); swap (rc4_key, idx, j); idx++;
85 j += rc4_key->S[idx] + (v >> 0); swap (rc4_key, idx, j); idx++;
86 j += rc4_key->S[idx] + (v >> 8); swap (rc4_key, idx, j); idx++;
87 j += rc4_key->S[idx] + (v >> 16); swap (rc4_key, idx, j); idx++;
88 j += rc4_key->S[idx] + (v >> 24); swap (rc4_key, idx, j); idx++;
92 j += rc4_key->S[idx] + (v >> 0); swap (rc4_key, idx, j); idx++;
93 j += rc4_key->S[idx] + (v >> 8); swap (rc4_key, idx, j); idx++;
94 j += rc4_key->S[idx] + (v >> 16); swap (rc4_key, idx, j); idx++;
95 j += rc4_key->S[idx] + (v >> 24); swap (rc4_key, idx, j); idx++;
99 u8 rc4_next_16 (__local RC4_KEY *rc4_key, u8 i, u8 j, __global u32 *in, u32 out[4])
104 for (u32 k = 0; k < 4; k++)
113 swap (rc4_key, i, j);
115 idx = rc4_key->S[i] + rc4_key->S[j];
117 xor4 |= rc4_key->S[idx] << 0;
122 swap (rc4_key, i, j);
124 idx = rc4_key->S[i] + rc4_key->S[j];
126 xor4 |= rc4_key->S[idx] << 8;
131 swap (rc4_key, i, j);
133 idx = rc4_key->S[i] + rc4_key->S[j];
135 xor4 |= rc4_key->S[idx] << 16;
140 swap (rc4_key, i, j);
142 idx = rc4_key->S[i] + rc4_key->S[j];
144 xor4 |= rc4_key->S[idx] << 24;
146 out[k] = in[k] ^ xor4;
152 void md4_transform (const u32 w0[4], const u32 w1[4], const u32 w2[4], const u32 w3[4], u32 digest[4])
159 MD4_STEP (MD4_Fo, a, b, c, d, w0[0], MD4C00, MD4S00);
160 MD4_STEP (MD4_Fo, d, a, b, c, w0[1], MD4C00, MD4S01);
161 MD4_STEP (MD4_Fo, c, d, a, b, w0[2], MD4C00, MD4S02);
162 MD4_STEP (MD4_Fo, b, c, d, a, w0[3], MD4C00, MD4S03);
163 MD4_STEP (MD4_Fo, a, b, c, d, w1[0], MD4C00, MD4S00);
164 MD4_STEP (MD4_Fo, d, a, b, c, w1[1], MD4C00, MD4S01);
165 MD4_STEP (MD4_Fo, c, d, a, b, w1[2], MD4C00, MD4S02);
166 MD4_STEP (MD4_Fo, b, c, d, a, w1[3], MD4C00, MD4S03);
167 MD4_STEP (MD4_Fo, a, b, c, d, w2[0], MD4C00, MD4S00);
168 MD4_STEP (MD4_Fo, d, a, b, c, w2[1], MD4C00, MD4S01);
169 MD4_STEP (MD4_Fo, c, d, a, b, w2[2], MD4C00, MD4S02);
170 MD4_STEP (MD4_Fo, b, c, d, a, w2[3], MD4C00, MD4S03);
171 MD4_STEP (MD4_Fo, a, b, c, d, w3[0], MD4C00, MD4S00);
172 MD4_STEP (MD4_Fo, d, a, b, c, w3[1], MD4C00, MD4S01);
173 MD4_STEP (MD4_Fo, c, d, a, b, w3[2], MD4C00, MD4S02);
174 MD4_STEP (MD4_Fo, b, c, d, a, w3[3], MD4C00, MD4S03);
176 MD4_STEP (MD4_Go, a, b, c, d, w0[0], MD4C01, MD4S10);
177 MD4_STEP (MD4_Go, d, a, b, c, w1[0], MD4C01, MD4S11);
178 MD4_STEP (MD4_Go, c, d, a, b, w2[0], MD4C01, MD4S12);
179 MD4_STEP (MD4_Go, b, c, d, a, w3[0], MD4C01, MD4S13);
180 MD4_STEP (MD4_Go, a, b, c, d, w0[1], MD4C01, MD4S10);
181 MD4_STEP (MD4_Go, d, a, b, c, w1[1], MD4C01, MD4S11);
182 MD4_STEP (MD4_Go, c, d, a, b, w2[1], MD4C01, MD4S12);
183 MD4_STEP (MD4_Go, b, c, d, a, w3[1], MD4C01, MD4S13);
184 MD4_STEP (MD4_Go, a, b, c, d, w0[2], MD4C01, MD4S10);
185 MD4_STEP (MD4_Go, d, a, b, c, w1[2], MD4C01, MD4S11);
186 MD4_STEP (MD4_Go, c, d, a, b, w2[2], MD4C01, MD4S12);
187 MD4_STEP (MD4_Go, b, c, d, a, w3[2], MD4C01, MD4S13);
188 MD4_STEP (MD4_Go, a, b, c, d, w0[3], MD4C01, MD4S10);
189 MD4_STEP (MD4_Go, d, a, b, c, w1[3], MD4C01, MD4S11);
190 MD4_STEP (MD4_Go, c, d, a, b, w2[3], MD4C01, MD4S12);
191 MD4_STEP (MD4_Go, b, c, d, a, w3[3], MD4C01, MD4S13);
193 MD4_STEP (MD4_H , a, b, c, d, w0[0], MD4C02, MD4S20);
194 MD4_STEP (MD4_H , d, a, b, c, w2[0], MD4C02, MD4S21);
195 MD4_STEP (MD4_H , c, d, a, b, w1[0], MD4C02, MD4S22);
196 MD4_STEP (MD4_H , b, c, d, a, w3[0], MD4C02, MD4S23);
197 MD4_STEP (MD4_H , a, b, c, d, w0[2], MD4C02, MD4S20);
198 MD4_STEP (MD4_H , d, a, b, c, w2[2], MD4C02, MD4S21);
199 MD4_STEP (MD4_H , c, d, a, b, w1[2], MD4C02, MD4S22);
200 MD4_STEP (MD4_H , b, c, d, a, w3[2], MD4C02, MD4S23);
201 MD4_STEP (MD4_H , a, b, c, d, w0[1], MD4C02, MD4S20);
202 MD4_STEP (MD4_H , d, a, b, c, w2[1], MD4C02, MD4S21);
203 MD4_STEP (MD4_H , c, d, a, b, w1[1], MD4C02, MD4S22);
204 MD4_STEP (MD4_H , b, c, d, a, w3[1], MD4C02, MD4S23);
205 MD4_STEP (MD4_H , a, b, c, d, w0[3], MD4C02, MD4S20);
206 MD4_STEP (MD4_H , d, a, b, c, w2[3], MD4C02, MD4S21);
207 MD4_STEP (MD4_H , c, d, a, b, w1[3], MD4C02, MD4S22);
208 MD4_STEP (MD4_H , b, c, d, a, w3[3], MD4C02, MD4S23);
216 void md5_transform (const u32 w0[4], const u32 w1[4], const u32 w2[4], const u32 w3[4], u32 digest[4])
240 MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
241 MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
242 MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
243 MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
244 MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
245 MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
246 MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
247 MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
248 MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
249 MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
250 MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
251 MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
252 MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
253 MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
254 MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
255 MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
257 MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
258 MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
259 MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
260 MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
261 MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
262 MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
263 MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
264 MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
265 MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
266 MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
267 MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
268 MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
269 MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
270 MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
271 MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
272 MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
274 MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
275 MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
276 MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
277 MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
278 MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
279 MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
280 MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
281 MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
282 MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
283 MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
284 MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
285 MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
286 MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
287 MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
288 MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
289 MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
291 MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
292 MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
293 MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
294 MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
295 MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
296 MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
297 MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
298 MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
299 MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
300 MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
301 MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
302 MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
303 MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
304 MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
305 MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
306 MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
314 void hmac_md5_pad (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], u32 ipad[4], u32 opad[4])
316 w0[0] = w0[0] ^ 0x36363636;
317 w0[1] = w0[1] ^ 0x36363636;
318 w0[2] = w0[2] ^ 0x36363636;
319 w0[3] = w0[3] ^ 0x36363636;
320 w1[0] = w1[0] ^ 0x36363636;
321 w1[1] = w1[1] ^ 0x36363636;
322 w1[2] = w1[2] ^ 0x36363636;
323 w1[3] = w1[3] ^ 0x36363636;
324 w2[0] = w2[0] ^ 0x36363636;
325 w2[1] = w2[1] ^ 0x36363636;
326 w2[2] = w2[2] ^ 0x36363636;
327 w2[3] = w2[3] ^ 0x36363636;
328 w3[0] = w3[0] ^ 0x36363636;
329 w3[1] = w3[1] ^ 0x36363636;
330 w3[2] = w3[2] ^ 0x36363636;
331 w3[3] = w3[3] ^ 0x36363636;
338 md5_transform (w0, w1, w2, w3, ipad);
340 w0[0] = w0[0] ^ 0x6a6a6a6a;
341 w0[1] = w0[1] ^ 0x6a6a6a6a;
342 w0[2] = w0[2] ^ 0x6a6a6a6a;
343 w0[3] = w0[3] ^ 0x6a6a6a6a;
344 w1[0] = w1[0] ^ 0x6a6a6a6a;
345 w1[1] = w1[1] ^ 0x6a6a6a6a;
346 w1[2] = w1[2] ^ 0x6a6a6a6a;
347 w1[3] = w1[3] ^ 0x6a6a6a6a;
348 w2[0] = w2[0] ^ 0x6a6a6a6a;
349 w2[1] = w2[1] ^ 0x6a6a6a6a;
350 w2[2] = w2[2] ^ 0x6a6a6a6a;
351 w2[3] = w2[3] ^ 0x6a6a6a6a;
352 w3[0] = w3[0] ^ 0x6a6a6a6a;
353 w3[1] = w3[1] ^ 0x6a6a6a6a;
354 w3[2] = w3[2] ^ 0x6a6a6a6a;
355 w3[3] = w3[3] ^ 0x6a6a6a6a;
362 md5_transform (w0, w1, w2, w3, opad);
365 void hmac_md5_run (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], u32 ipad[4], u32 opad[4], u32 digest[4])
372 md5_transform (w0, w1, w2, w3, digest);
388 w3[2] = (64 + 16) * 8;
396 md5_transform (w0, w1, w2, w3, digest);
399 int decrypt_and_check (__local RC4_KEY *rc4_key, u32 data[4], __global u32 *edata2, const u32 edata2_len, const u32 K2[4], const u32 checksum[4])
401 rc4_init_16 (rc4_key, data);
410 8 first bytes are nonce, then ASN1 structs (DER encoding: type-length-data)
412 if length >= 128 bytes:
413 length is on 2 bytes and type is \x63\x82 (encode_krb5_enc_tkt_part) and data is an ASN1 sequence \x30\x82
415 length is on 1 byte and type is \x63\x81 and data is an ASN1 sequence \x30\x81
417 next headers follow the same ASN1 "type-length-data" scheme
420 j = rc4_next_16 (rc4_key, i, j, edata2 + 0, out0); i += 16;
422 if (((out0[2] & 0xff00ffff) != 0x30008163) && ((out0[2] & 0x0000ffff) != 0x00008263)) return 0;
424 j = rc4_next_16 (rc4_key, i, j, edata2 + 4, out1); i += 16;
426 if (((out1[0] & 0x00ffffff) != 0x00000503) && (out1[0] != 0x050307A0)) return 0;
428 rc4_init_16 (rc4_key, data);
460 hmac_md5_pad (w0, w1, w2, w3, ipad, opad);
464 for (edata2_left = edata2_len; edata2_left >= 64; edata2_left -= 64)
466 j = rc4_next_16 (rc4_key, i, j, edata2, w0); i += 16; edata2 += 4;
467 j = rc4_next_16 (rc4_key, i, j, edata2, w1); i += 16; edata2 += 4;
468 j = rc4_next_16 (rc4_key, i, j, edata2, w2); i += 16; edata2 += 4;
469 j = rc4_next_16 (rc4_key, i, j, edata2, w3); i += 16; edata2 += 4;
471 md5_transform (w0, w1, w2, w3, ipad);
491 if (edata2_left < 16)
493 j = rc4_next_16 (rc4_key, i, j, edata2, w0); i += 16; edata2 += 4;
495 truncate_block (w0, edata2_left & 0xf);
496 append_0x80_1x4 (w0, edata2_left & 0xf);
498 w3[2] = (64 + edata2_len) * 8;
501 md5_transform (w0, w1, w2, w3, ipad);
503 else if (edata2_left < 32)
505 j = rc4_next_16 (rc4_key, i, j, edata2, w0); i += 16; edata2 += 4;
506 j = rc4_next_16 (rc4_key, i, j, edata2, w1); i += 16; edata2 += 4;
508 truncate_block (w1, edata2_left & 0xf);
509 append_0x80_1x4 (w1, edata2_left & 0xf);
511 w3[2] = (64 + edata2_len) * 8;
514 md5_transform (w0, w1, w2, w3, ipad);
516 else if (edata2_left < 48)
518 j = rc4_next_16 (rc4_key, i, j, edata2, w0); i += 16; edata2 += 4;
519 j = rc4_next_16 (rc4_key, i, j, edata2, w1); i += 16; edata2 += 4;
520 j = rc4_next_16 (rc4_key, i, j, edata2, w2); i += 16; edata2 += 4;
522 truncate_block (w2, edata2_left & 0xf);
523 append_0x80_1x4 (w2, edata2_left & 0xf);
525 w3[2] = (64 + edata2_len) * 8;
528 md5_transform (w0, w1, w2, w3, ipad);
532 j = rc4_next_16 (rc4_key, i, j, edata2, w0); i += 16; edata2 += 4;
533 j = rc4_next_16 (rc4_key, i, j, edata2, w1); i += 16; edata2 += 4;
534 j = rc4_next_16 (rc4_key, i, j, edata2, w2); i += 16; edata2 += 4;
535 j = rc4_next_16 (rc4_key, i, j, edata2, w3); i += 16; edata2 += 4;
537 truncate_block (w3, edata2_left & 0xf);
538 append_0x80_1x4 (w3, edata2_left & 0xf);
540 if (edata2_left < 56)
542 w3[2] = (64 + edata2_len) * 8;
545 md5_transform (w0, w1, w2, w3, ipad);
549 md5_transform (w0, w1, w2, w3, ipad);
565 w3[2] = (64 + edata2_len) * 8;
568 md5_transform (w0, w1, w2, w3, ipad);
586 w3[2] = (64 + 16) * 8;
589 md5_transform (w0, w1, w2, w3, opad);
591 if (checksum[0] != opad[0]) return 0;
592 if (checksum[1] != opad[1]) return 0;
593 if (checksum[2] != opad[2]) return 0;
594 if (checksum[3] != opad[3]) return 0;
599 void kerb_prepare (const u32 w0[4], const u32 w1[4], const u32 pw_len, const u32 checksum[4], u32 digest[4], u32 K2[4])
627 // K=MD4(Little_indian(UNICODE(pwd))
629 append_0x80_2x4 (w0_t, w1_t, pw_len);
631 make_unicode (w1_t, w2_t, w3_t);
632 make_unicode (w0_t, w0_t, w1_t);
634 w3_t[2] = pw_len * 8 * 2;
642 md4_transform (w0_t, w1_t, w2_t, w3_t, digest);
644 // K1=MD5_HMAC(K,1); with 2 encoded as little indian on 4 bytes (02000000 in hexa);
666 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
682 w3_t[2] = (64 + 4) * 8;
685 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
694 // K3=MD5_HMAC(K1,checksum);
713 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
715 w0_t[0] = checksum[0];
716 w0_t[1] = checksum[1];
717 w0_t[2] = checksum[2];
718 w0_t[3] = checksum[3];
729 w3_t[2] = (64 + 16) * 8;
732 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
735 void m13100 (__local RC4_KEY *rc4_keys, 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 krb5tgs_t *krb5tgs_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)
741 const u32 gid = get_global_id (0);
742 const u32 lid = get_local_id (0);
750 checksum[0] = krb5tgs_bufs[salt_pos].checksum[0];
751 checksum[1] = krb5tgs_bufs[salt_pos].checksum[1];
752 checksum[2] = krb5tgs_bufs[salt_pos].checksum[2];
753 checksum[3] = krb5tgs_bufs[salt_pos].checksum[3];
761 for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
763 const u32 w0r = bfs_buf[il_pos].i;
771 kerb_prepare (w0, w1, pw_len, checksum, digest, K2);
780 if (decrypt_and_check (&rc4_keys[lid], tmp, krb5tgs_bufs[salt_pos].edata2, krb5tgs_bufs[salt_pos].edata2_len, K2, checksum) == 1)
782 mark_hash (plains_buf, d_return_buf, salt_pos, 0, digests_offset + 0, gid, il_pos);
787 __kernel void m13100_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 krb5tgs_t *krb5tgs_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)
793 const u32 lid = get_local_id (0);
794 const u32 gid = get_global_id (0);
796 if (gid >= gid_max) return;
804 pw_buf0[0] = pws[gid].i[ 0];
805 pw_buf0[1] = pws[gid].i[ 1];
806 pw_buf0[2] = pws[gid].i[ 2];
807 pw_buf0[3] = pws[gid].i[ 3];
811 pw_buf1[0] = pws[gid].i[ 4];
812 pw_buf1[1] = pws[gid].i[ 5];
813 pw_buf1[2] = pws[gid].i[ 6];
814 pw_buf1[3] = pws[gid].i[ 7];
816 const u32 pw_len = pws[gid].pw_len;
822 __local RC4_KEY rc4_keys[64];
830 checksum[0] = krb5tgs_bufs[salt_pos].checksum[0];
831 checksum[1] = krb5tgs_bufs[salt_pos].checksum[1];
832 checksum[2] = krb5tgs_bufs[salt_pos].checksum[2];
833 checksum[3] = krb5tgs_bufs[salt_pos].checksum[3];
839 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
846 const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
856 kerb_prepare (w0, w1, out_len, checksum, digest, K2);
865 if (decrypt_and_check (&rc4_keys[lid], tmp, krb5tgs_bufs[salt_pos].edata2, krb5tgs_bufs[salt_pos].edata2_len, K2, checksum) == 1)
867 mark_hash (plains_buf, d_return_buf, salt_pos, 0, digests_offset + 0, gid, il_pos);
872 __kernel void m13100_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 krb5tgs_t *krb5tgs_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)
876 __kernel void m13100_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 krb5tgs_t *krb5tgs_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)
880 __kernel void m13100_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 krb5tgs_t *krb5tgs_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)
886 const u32 lid = get_local_id (0);
887 const u32 gid = get_global_id (0);
889 if (gid >= gid_max) return;
897 pw_buf0[0] = pws[gid].i[ 0];
898 pw_buf0[1] = pws[gid].i[ 1];
899 pw_buf0[2] = pws[gid].i[ 2];
900 pw_buf0[3] = pws[gid].i[ 3];
904 pw_buf1[0] = pws[gid].i[ 4];
905 pw_buf1[1] = pws[gid].i[ 5];
906 pw_buf1[2] = pws[gid].i[ 6];
907 pw_buf1[3] = pws[gid].i[ 7];
909 const u32 pw_len = pws[gid].pw_len;
915 __local RC4_KEY rc4_keys[64];
923 checksum[0] = krb5tgs_bufs[salt_pos].checksum[0];
924 checksum[1] = krb5tgs_bufs[salt_pos].checksum[1];
925 checksum[2] = krb5tgs_bufs[salt_pos].checksum[2];
926 checksum[3] = krb5tgs_bufs[salt_pos].checksum[3];
932 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
939 const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
949 kerb_prepare (w0, w1, out_len, checksum, digest, K2);
958 if (decrypt_and_check (&rc4_keys[lid], tmp, krb5tgs_bufs[salt_pos].edata2, krb5tgs_bufs[salt_pos].edata2_len, K2, checksum) == 1)
960 mark_hash (plains_buf, d_return_buf, salt_pos, 0, digests_offset + 0, gid, il_pos);
965 __kernel void m13100_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 krb5tgs_t *krb5tgs_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)
969 __kernel void m13100_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 krb5tgs_t *krb5tgs_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)