Initial commit
[hashcat.git] / nv / m09710_a0.cu
1 /**
2  * Author......: Jens Steube <jens.steube@gmail.com>
3  * License.....: MIT
4  */
5
6 #define _OLDOFFICE01_
7
8 #include "include/constants.h"
9 #include "include/kernel_vendor.h"
10
11 #ifdef  VLIW1
12 #define VECT_SIZE1
13 #endif
14
15 #ifdef  VLIW2
16 #define VECT_SIZE1
17 #endif
18
19 #define DGST_R0 0
20 #define DGST_R1 1
21 #define DGST_R2 2
22 #define DGST_R3 3
23
24 #include "include/kernel_functions.c"
25 #include "types_nv.c"
26 #include "common_nv.c"
27 #include "include/rp_gpu.h"
28 #include "rp_nv.c"
29
30 #ifdef  VECT_SIZE1
31 #define VECT_COMPARE_S "check_single_vect1_comp4.c"
32 #define VECT_COMPARE_M "check_multi_vect1_comp4.c"
33 #endif
34
35 #ifdef  VECT_SIZE2
36 #define VECT_COMPARE_S "check_single_vect2_comp4.c"
37 #define VECT_COMPARE_M "check_multi_vect2_comp4.c"
38 #endif
39
40 #ifdef  VECT_SIZE4
41 #define VECT_COMPARE_S "check_single_vect4_comp4.c"
42 #define VECT_COMPARE_M "check_multi_vect4_comp4.c"
43 #endif
44
45 typedef struct
46 {
47   u8 S[256];
48
49   u32 wtf_its_faster;
50
51 } RC4_KEY;
52
53 __device__ static void swap (RC4_KEY *rc4_key, const u8 i, const u8 j)
54 {
55   u8 tmp;
56
57   tmp           = rc4_key->S[i];
58   rc4_key->S[i] = rc4_key->S[j];
59   rc4_key->S[j] = tmp;
60 }
61
62 __device__ static void rc4_init_16 (RC4_KEY *rc4_key, const u32 data[4])
63 {
64   u32 v = 0x03020100;
65   u32 a = 0x04040404;
66
67   u32 *ptr = (u32 *) rc4_key->S;
68
69   #pragma unroll 64
70   for (u32 i = 0; i < 64; i++)
71   {
72     *ptr++ = v; v += a;
73   }
74
75   u32 j = 0;
76
77   for (u32 i = 0; i < 16; i++)
78   {
79     u32 idx = i * 16;
80
81     u32 v;
82
83     v = data[0];
84
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++;
89
90     v = data[1];
91
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++;
96
97     v = data[2];
98
99     j += rc4_key->S[idx] + (v >>  0); swap (rc4_key, idx, j); idx++;
100     j += rc4_key->S[idx] + (v >>  8); swap (rc4_key, idx, j); idx++;
101     j += rc4_key->S[idx] + (v >> 16); swap (rc4_key, idx, j); idx++;
102     j += rc4_key->S[idx] + (v >> 24); swap (rc4_key, idx, j); idx++;
103
104     v = data[3];
105
106     j += rc4_key->S[idx] + (v >>  0); swap (rc4_key, idx, j); idx++;
107     j += rc4_key->S[idx] + (v >>  8); swap (rc4_key, idx, j); idx++;
108     j += rc4_key->S[idx] + (v >> 16); swap (rc4_key, idx, j); idx++;
109     j += rc4_key->S[idx] + (v >> 24); swap (rc4_key, idx, j); idx++;
110   }
111 }
112
113 __device__ static u8 rc4_next_16 (RC4_KEY *rc4_key, u8 i, u8 j, const u32 in[4], u32 out[4])
114 {
115   for (u32 k = 0; k < 4; k++)
116   {
117     u32 xor4 = 0;
118
119     u8 idx;
120
121     i += 1;
122     j += rc4_key->S[i];
123
124     swap (rc4_key, i, j);
125
126     idx = rc4_key->S[i] + rc4_key->S[j];
127
128     xor4 |= rc4_key->S[idx] <<  0;
129
130     i += 1;
131     j += rc4_key->S[i];
132
133     swap (rc4_key, i, j);
134
135     idx = rc4_key->S[i] + rc4_key->S[j];
136
137     xor4 |= rc4_key->S[idx] <<  8;
138
139     i += 1;
140     j += rc4_key->S[i];
141
142     swap (rc4_key, i, j);
143
144     idx = rc4_key->S[i] + rc4_key->S[j];
145
146     xor4 |= rc4_key->S[idx] << 16;
147
148     i += 1;
149     j += rc4_key->S[i];
150
151     swap (rc4_key, i, j);
152
153     idx = rc4_key->S[i] + rc4_key->S[j];
154
155     xor4 |= rc4_key->S[idx] << 24;
156
157     out[k] = in[k] ^ xor4;
158   }
159
160   return j;
161 }
162
163 __device__ static void md5_transform (const u32x w0[4], const u32x w1[4], const u32x w2[4], const u32x w3[4], u32x digest[4])
164 {
165   u32x a = digest[0];
166   u32x b = digest[1];
167   u32x c = digest[2];
168   u32x d = digest[3];
169
170   u32x w0_t = w0[0];
171   u32x w1_t = w0[1];
172   u32x w2_t = w0[2];
173   u32x w3_t = w0[3];
174   u32x w4_t = w1[0];
175   u32x w5_t = w1[1];
176   u32x w6_t = w1[2];
177   u32x w7_t = w1[3];
178   u32x w8_t = w2[0];
179   u32x w9_t = w2[1];
180   u32x wa_t = w2[2];
181   u32x wb_t = w2[3];
182   u32x wc_t = w3[0];
183   u32x wd_t = w3[1];
184   u32x we_t = w3[2];
185   u32x wf_t = w3[3];
186
187   MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
188   MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
189   MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
190   MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
191   MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
192   MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
193   MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
194   MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
195   MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
196   MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
197   MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
198   MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
199   MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
200   MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
201   MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
202   MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
203
204   MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
205   MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
206   MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
207   MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
208   MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
209   MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
210   MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
211   MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
212   MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
213   MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
214   MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
215   MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
216   MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
217   MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
218   MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
219   MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
220
221   MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
222   MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
223   MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
224   MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
225   MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
226   MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
227   MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
228   MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
229   MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
230   MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
231   MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
232   MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
233   MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
234   MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
235   MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
236   MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
237
238   MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
239   MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
240   MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
241   MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
242   MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
243   MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
244   MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
245   MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
246   MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
247   MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
248   MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
249   MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
250   MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
251   MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
252   MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
253   MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
254
255   digest[0] += a;
256   digest[1] += b;
257   digest[2] += c;
258   digest[3] += d;
259 }
260
261 __device__ __constant__ gpu_rule_t c_rules[1024];
262
263 extern "C" __global__ void __launch_bounds__ (64, 1) m09710_m04 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const oldoffice01_t *oldoffice01_bufs, u32 *d_return_buf, 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 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
264 {
265   /**
266    * modifier
267    */
268
269   const u32 lid = threadIdx.x;
270
271   __shared__ RC4_KEY rc4_keys[64];
272
273   RC4_KEY *rc4_key = &rc4_keys[lid];
274
275   /**
276    * base
277    */
278
279   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
280
281   if (gid >= gid_max) return;
282
283   u32x pw_buf0[4];
284
285   pw_buf0[0] = pws[gid].i[ 0];
286   pw_buf0[1] = pws[gid].i[ 1];
287   pw_buf0[2] = pws[gid].i[ 2];
288   pw_buf0[3] = pws[gid].i[ 3];
289
290   u32x pw_buf1[4];
291
292   pw_buf1[0] = pws[gid].i[ 4];
293   pw_buf1[1] = pws[gid].i[ 5];
294   pw_buf1[2] = pws[gid].i[ 6];
295   pw_buf1[3] = pws[gid].i[ 7];
296
297   const u32 pw_len = pws[gid].pw_len;
298
299   /**
300    * esalt
301    */
302
303   const u32 version = oldoffice01_bufs[salt_pos].version;
304
305   u32 encryptedVerifier[4];
306
307   encryptedVerifier[0] = oldoffice01_bufs[salt_pos].encryptedVerifier[0];
308   encryptedVerifier[1] = oldoffice01_bufs[salt_pos].encryptedVerifier[1];
309   encryptedVerifier[2] = oldoffice01_bufs[salt_pos].encryptedVerifier[2];
310   encryptedVerifier[3] = oldoffice01_bufs[salt_pos].encryptedVerifier[3];
311
312   /**
313    * loop
314    */
315
316   for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
317   {
318     u32x w0[4];
319
320     w0[0] = pw_buf0[0];
321     w0[1] = pw_buf0[1];
322     w0[2] = pw_buf0[2];
323     w0[3] = pw_buf0[3];
324
325     u32x w1[4];
326
327     w1[0] = pw_buf1[0];
328     w1[1] = pw_buf1[1];
329     w1[2] = pw_buf1[2];
330     w1[3] = pw_buf1[3];
331
332     u32x w2[4];
333
334     w2[0] = 0;
335     w2[1] = 0;
336     w2[2] = 0;
337     w2[3] = 0;
338
339     u32x w3[4];
340
341     w3[0] = 0;
342     w3[1] = 0;
343     w3[2] = 0;
344     w3[3] = 0;
345
346     apply_rules (c_rules[il_pos].cmds, w0, w1, pw_len);
347
348     // first md5 to generate RC4 128 bit key
349
350     u32x w0_t[4];
351     u32x w1_t[4];
352     u32x w2_t[4];
353     u32x w3_t[4];
354
355     w0_t[0]  = w0[0];
356     w0_t[1]  = w0[1] & 0xff;
357     w0_t[2]  = 0x8000;
358     w0_t[3]  = 0;
359     w1_t[0]  = 0;
360     w1_t[1]  = 0;
361     w1_t[2]  = 0;
362     w1_t[3]  = 0;
363     w2_t[0]  = 0;
364     w2_t[1]  = 0;
365     w2_t[2]  = 0;
366     w2_t[3]  = 0;
367     w3_t[0]  = 0;
368     w3_t[1]  = 0;
369     w3_t[2]  = 9 * 8;
370     w3_t[3]  = 0;
371
372     u32x digest[4];
373
374     digest[0] = MD5M_A;
375     digest[1] = MD5M_B;
376     digest[2] = MD5M_C;
377     digest[3] = MD5M_D;
378
379     md5_transform (w0_t, w1_t, w2_t, w3_t, digest);
380
381     // now the RC4 part
382
383     u32x key[4];
384
385     key[0] = digest[0];
386     key[1] = digest[1];
387     key[2] = digest[2];
388     key[3] = digest[3];
389
390     rc4_init_16 (rc4_key, key);
391
392     u32x out[4];
393
394     u8 j = rc4_next_16 (rc4_key, 0, 0, encryptedVerifier, out);
395
396     w0_t[0] = out[0];
397     w0_t[1] = out[1];
398     w0_t[2] = out[2];
399     w0_t[3] = out[3];
400     w1_t[0] = 0x80;
401     w1_t[1] = 0;
402     w1_t[2] = 0;
403     w1_t[3] = 0;
404     w2_t[0] = 0;
405     w2_t[1] = 0;
406     w2_t[2] = 0;
407     w2_t[3] = 0;
408     w3_t[0] = 0;
409     w3_t[1] = 0;
410     w3_t[2] = 16 * 8;
411     w3_t[3] = 0;
412
413     digest[0] = MD5M_A;
414     digest[1] = MD5M_B;
415     digest[2] = MD5M_C;
416     digest[3] = MD5M_D;
417
418     md5_transform (w0_t, w1_t, w2_t, w3_t, digest);
419
420     rc4_next_16 (rc4_key, 16, j, digest, out);
421
422     const u32x r0 = out[0];
423     const u32x r1 = out[1];
424     const u32x r2 = out[2];
425     const u32x r3 = out[3];
426
427     #include VECT_COMPARE_M
428   }
429 }
430
431 extern "C" __global__ void __launch_bounds__ (64, 1) m09710_m08 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const oldoffice01_t *oldoffice01_bufs, u32 *d_return_buf, 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 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
432 {
433 }
434
435 extern "C" __global__ void __launch_bounds__ (64, 1) m09710_m16 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const oldoffice01_t *oldoffice01_bufs, u32 *d_return_buf, 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 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
436 {
437 }
438
439 extern "C" __global__ void __launch_bounds__ (64, 1) m09710_s04 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const oldoffice01_t *oldoffice01_bufs, u32 *d_return_buf, 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 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
440 {
441   /**
442    * modifier
443    */
444
445   const u32 lid = threadIdx.x;
446
447   __shared__ RC4_KEY rc4_keys[64];
448
449   RC4_KEY *rc4_key = &rc4_keys[lid];
450
451   /**
452    * base
453    */
454
455   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
456
457   if (gid >= gid_max) return;
458
459   u32x pw_buf0[4];
460
461   pw_buf0[0] = pws[gid].i[ 0];
462   pw_buf0[1] = pws[gid].i[ 1];
463   pw_buf0[2] = pws[gid].i[ 2];
464   pw_buf0[3] = pws[gid].i[ 3];
465
466   u32x pw_buf1[4];
467
468   pw_buf1[0] = pws[gid].i[ 4];
469   pw_buf1[1] = pws[gid].i[ 5];
470   pw_buf1[2] = pws[gid].i[ 6];
471   pw_buf1[3] = pws[gid].i[ 7];
472
473   const u32 pw_len = pws[gid].pw_len;
474
475   /**
476    * digest
477    */
478
479   const u32 search[4] =
480   {
481     digests_buf[digests_offset].digest_buf[DGST_R0],
482     digests_buf[digests_offset].digest_buf[DGST_R1],
483     digests_buf[digests_offset].digest_buf[DGST_R2],
484     digests_buf[digests_offset].digest_buf[DGST_R3]
485   };
486
487   /**
488    * esalt
489    */
490
491   const u32 version = oldoffice01_bufs[salt_pos].version;
492
493   u32 encryptedVerifier[4];
494
495   encryptedVerifier[0] = oldoffice01_bufs[salt_pos].encryptedVerifier[0];
496   encryptedVerifier[1] = oldoffice01_bufs[salt_pos].encryptedVerifier[1];
497   encryptedVerifier[2] = oldoffice01_bufs[salt_pos].encryptedVerifier[2];
498   encryptedVerifier[3] = oldoffice01_bufs[salt_pos].encryptedVerifier[3];
499
500   /**
501    * loop
502    */
503
504   for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
505   {
506     u32x w0[4];
507
508     w0[0] = pw_buf0[0];
509     w0[1] = pw_buf0[1];
510     w0[2] = pw_buf0[2];
511     w0[3] = pw_buf0[3];
512
513     u32x w1[4];
514
515     w1[0] = pw_buf1[0];
516     w1[1] = pw_buf1[1];
517     w1[2] = pw_buf1[2];
518     w1[3] = pw_buf1[3];
519
520     u32x w2[4];
521
522     w2[0] = 0;
523     w2[1] = 0;
524     w2[2] = 0;
525     w2[3] = 0;
526
527     u32x w3[4];
528
529     w3[0] = 0;
530     w3[1] = 0;
531     w3[2] = 0;
532     w3[3] = 0;
533
534     apply_rules (c_rules[il_pos].cmds, w0, w1, pw_len);
535
536     // first md5 to generate RC4 128 bit key
537
538     u32x w0_t[4];
539     u32x w1_t[4];
540     u32x w2_t[4];
541     u32x w3_t[4];
542
543     w0_t[0]  = w0[0];
544     w0_t[1]  = w0[1] & 0xff;
545     w0_t[2]  = 0x8000;
546     w0_t[3]  = 0;
547     w1_t[0]  = 0;
548     w1_t[1]  = 0;
549     w1_t[2]  = 0;
550     w1_t[3]  = 0;
551     w2_t[0]  = 0;
552     w2_t[1]  = 0;
553     w2_t[2]  = 0;
554     w2_t[3]  = 0;
555     w3_t[0]  = 0;
556     w3_t[1]  = 0;
557     w3_t[2]  = 9 * 8;
558     w3_t[3]  = 0;
559
560     u32x digest[4];
561
562     digest[0] = MD5M_A;
563     digest[1] = MD5M_B;
564     digest[2] = MD5M_C;
565     digest[3] = MD5M_D;
566
567     md5_transform (w0_t, w1_t, w2_t, w3_t, digest);
568
569     // now the RC4 part
570
571     u32x key[4];
572
573     key[0] = digest[0];
574     key[1] = digest[1];
575     key[2] = digest[2];
576     key[3] = digest[3];
577
578     rc4_init_16 (rc4_key, key);
579
580     u32x out[4];
581
582     u8 j = rc4_next_16 (rc4_key, 0, 0, encryptedVerifier, out);
583
584     w0_t[0] = out[0];
585     w0_t[1] = out[1];
586     w0_t[2] = out[2];
587     w0_t[3] = out[3];
588     w1_t[0] = 0x80;
589     w1_t[1] = 0;
590     w1_t[2] = 0;
591     w1_t[3] = 0;
592     w2_t[0] = 0;
593     w2_t[1] = 0;
594     w2_t[2] = 0;
595     w2_t[3] = 0;
596     w3_t[0] = 0;
597     w3_t[1] = 0;
598     w3_t[2] = 16 * 8;
599     w3_t[3] = 0;
600
601     digest[0] = MD5M_A;
602     digest[1] = MD5M_B;
603     digest[2] = MD5M_C;
604     digest[3] = MD5M_D;
605
606     md5_transform (w0_t, w1_t, w2_t, w3_t, digest);
607
608     rc4_next_16 (rc4_key, 16, j, digest, out);
609
610     const u32x r0 = out[0];
611     const u32x r1 = out[1];
612     const u32x r2 = out[2];
613     const u32x r3 = out[3];
614
615     #include VECT_COMPARE_S
616   }
617 }
618
619 extern "C" __global__ void __launch_bounds__ (64, 1) m09710_s08 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const oldoffice01_t *oldoffice01_bufs, u32 *d_return_buf, 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 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
620 {
621 }
622
623 extern "C" __global__ void __launch_bounds__ (64, 1) m09710_s16 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const oldoffice01_t *oldoffice01_bufs, u32 *d_return_buf, 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 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
624 {
625 }