Fix m 60 a 0 by making modified variable non-const
[hashcat.git] / OpenCL / m05600_a3.cl
1 /**
2  * Authors.....: Jens Steube <jens.steube@gmail.com>
3  *               Gabriele Gristina <matrix@hashcat.net>
4  *
5  * License.....: MIT
6  */
7
8 #define _NETNTLMV2_
9
10 #define NEW_SIMD_CODE
11
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"
18
19 void md4_transform (const u32x w0[4], const u32x w1[4], const u32x w2[4], const u32x w3[4], u32x digest[4])
20 {
21   u32x a = digest[0];
22   u32x b = digest[1];
23   u32x c = digest[2];
24   u32x d = digest[3];
25
26   u32x w0_t = w0[0];
27   u32x w1_t = w0[1];
28   u32x w2_t = w0[2];
29   u32x w3_t = w0[3];
30   u32x w4_t = w1[0];
31   u32x w5_t = w1[1];
32   u32x w6_t = w1[2];
33   u32x w7_t = w1[3];
34   u32x w8_t = w2[0];
35   u32x w9_t = w2[1];
36   u32x wa_t = w2[2];
37   u32x wb_t = w2[3];
38   u32x wc_t = w3[0];
39   u32x wd_t = w3[1];
40   u32x we_t = w3[2];
41   u32x wf_t = w3[3];
42
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);
59
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);
76
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);
93
94   digest[0] += a;
95   digest[1] += b;
96   digest[2] += c;
97   digest[3] += d;
98 }
99
100 void md5_transform (const u32x w0[4], const u32x w1[4], const u32x w2[4], const u32x w3[4], u32x digest[4])
101 {
102   u32x a = digest[0];
103   u32x b = digest[1];
104   u32x c = digest[2];
105   u32x d = digest[3];
106
107   u32x w0_t = w0[0];
108   u32x w1_t = w0[1];
109   u32x w2_t = w0[2];
110   u32x w3_t = w0[3];
111   u32x w4_t = w1[0];
112   u32x w5_t = w1[1];
113   u32x w6_t = w1[2];
114   u32x w7_t = w1[3];
115   u32x w8_t = w2[0];
116   u32x w9_t = w2[1];
117   u32x wa_t = w2[2];
118   u32x wb_t = w2[3];
119   u32x wc_t = w3[0];
120   u32x wd_t = w3[1];
121   u32x we_t = w3[2];
122   u32x wf_t = w3[3];
123
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);
140
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);
157
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);
174
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);
191
192   digest[0] += a;
193   digest[1] += b;
194   digest[2] += c;
195   digest[3] += d;
196 }
197
198 void hmac_md5_pad (u32x w0[4], u32x w1[4], u32x w2[4], u32x w3[4], u32x ipad[4], u32x opad[4])
199 {
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;
216
217   ipad[0] = MD5M_A;
218   ipad[1] = MD5M_B;
219   ipad[2] = MD5M_C;
220   ipad[3] = MD5M_D;
221
222   md5_transform (w0, w1, w2, w3, ipad);
223
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;
240
241   opad[0] = MD5M_A;
242   opad[1] = MD5M_B;
243   opad[2] = MD5M_C;
244   opad[3] = MD5M_D;
245
246   md5_transform (w0, w1, w2, w3, opad);
247 }
248
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])
250 {
251   digest[0] = ipad[0];
252   digest[1] = ipad[1];
253   digest[2] = ipad[2];
254   digest[3] = ipad[3];
255
256   md5_transform (w0, w1, w2, w3, digest);
257
258   w0[0] = digest[0];
259   w0[1] = digest[1];
260   w0[2] = digest[2];
261   w0[3] = digest[3];
262   w1[0] = 0x80;
263   w1[1] = 0;
264   w1[2] = 0;
265   w1[3] = 0;
266   w2[0] = 0;
267   w2[1] = 0;
268   w2[2] = 0;
269   w2[3] = 0;
270   w3[0] = 0;
271   w3[1] = 0;
272   w3[2] = (64 + 16) * 8;
273   w3[3] = 0;
274
275   digest[0] = opad[0];
276   digest[1] = opad[1];
277   digest[2] = opad[2];
278   digest[3] = opad[3];
279
280   md5_transform (w0, w1, w2, w3, digest);
281 }
282
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)
284 {
285   /**
286    * modifier
287    */
288
289   const u32 gid = get_global_id (0);
290   const u32 lid = get_local_id (0);
291
292   /**
293    * prepare
294    */
295
296   const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
297                            + netntlm_bufs[salt_pos].domain_len;
298
299   const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
300                       + netntlm_bufs[salt_pos].clichall_len;
301
302   /**
303    * loop
304    */
305
306   u32 w0l = w0[0];
307
308   for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
309   {
310     const u32x w0r = ix_create_bft (bfs_buf, il_pos);
311
312     const u32x w0lr = w0l | w0r;
313
314     /**
315      * pads
316      */
317
318     u32x w0_t[4];
319     u32x w1_t[4];
320     u32x w2_t[4];
321     u32x w3_t[4];
322
323     w0_t[0] = w0lr;
324     w0_t[1] = w0[1];
325     w0_t[2] = w0[2];
326     w0_t[3] = w0[3];
327     w1_t[0] = w1[0];
328     w1_t[1] = w1[1];
329     w1_t[2] = w1[2];
330     w1_t[3] = w1[3];
331     w2_t[0] = w2[0];
332     w2_t[1] = w2[1];
333     w2_t[2] = w2[2];
334     w2_t[3] = w2[3];
335     w3_t[0] = w3[0];
336     w3_t[1] = w3[1];
337     w3_t[2] = w3[2];
338     w3_t[3] = w3[3];
339
340     u32x digest[4];
341
342     digest[0] = MD4M_A;
343     digest[1] = MD4M_B;
344     digest[2] = MD4M_C;
345     digest[3] = MD4M_D;
346
347     md4_transform (w0_t, w1_t, w2_t, w3_t, digest);
348
349     w0_t[0] = digest[0];
350     w0_t[1] = digest[1];
351     w0_t[2] = digest[2];
352     w0_t[3] = digest[3];
353     w1_t[0] = 0;
354     w1_t[1] = 0;
355     w1_t[2] = 0;
356     w1_t[3] = 0;
357     w2_t[0] = 0;
358     w2_t[1] = 0;
359     w2_t[2] = 0;
360     w2_t[3] = 0;
361     w3_t[0] = 0;
362     w3_t[1] = 0;
363     w3_t[2] = 0;
364     w3_t[3] = 0;
365
366     digest[0] = MD5M_A;
367     digest[1] = MD5M_B;
368     digest[2] = MD5M_C;
369     digest[3] = MD5M_D;
370
371     u32x ipad[4];
372     u32x opad[4];
373
374     hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
375
376     int left;
377     int off;
378
379     for (left = userdomain_len, off = 0; left >= 56; left -= 64, off += 16)
380     {
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];
397
398       md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
399     }
400
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;
416     w3_t[3] = 0;
417
418     hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
419
420     w0_t[0] = digest[0];
421     w0_t[1] = digest[1];
422     w0_t[2] = digest[2];
423     w0_t[3] = digest[3];
424     w1_t[0] = 0;
425     w1_t[1] = 0;
426     w1_t[2] = 0;
427     w1_t[3] = 0;
428     w2_t[0] = 0;
429     w2_t[1] = 0;
430     w2_t[2] = 0;
431     w2_t[3] = 0;
432     w3_t[0] = 0;
433     w3_t[1] = 0;
434     w3_t[2] = 0;
435     w3_t[3] = 0;
436
437     digest[0] = MD5M_A;
438     digest[1] = MD5M_B;
439     digest[2] = MD5M_C;
440     digest[3] = MD5M_D;
441
442     hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
443
444     for (left = chall_len, off = 0; left >= 56; left -= 64, off += 16)
445     {
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];
462
463       md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
464     }
465
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;
481     w3_t[3] = 0;
482
483     hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
484
485     COMPARE_M_SIMD (digest[0], digest[3], digest[2], digest[1]);
486   }
487 }
488
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)
490 {
491   /**
492    * modifier
493    */
494
495   const u32 gid = get_global_id (0);
496   const u32 lid = get_local_id (0);
497
498   /**
499    * prepare
500    */
501
502   const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
503                            + netntlm_bufs[salt_pos].domain_len;
504
505   const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
506                       + netntlm_bufs[salt_pos].clichall_len;
507
508   /**
509    * digest
510    */
511
512   const u32 search[4] =
513   {
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]
518   };
519
520   /**
521    * loop
522    */
523
524   u32 w0l = w0[0];
525
526   for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
527   {
528     const u32x w0r = ix_create_bft (bfs_buf, il_pos);
529
530     const u32x w0lr = w0l | w0r;
531
532     /**
533      * pads
534      */
535
536     u32x w0_t[4];
537     u32x w1_t[4];
538     u32x w2_t[4];
539     u32x w3_t[4];
540
541     w0_t[0] = w0lr;
542     w0_t[1] = w0[1];
543     w0_t[2] = w0[2];
544     w0_t[3] = w0[3];
545     w1_t[0] = w1[0];
546     w1_t[1] = w1[1];
547     w1_t[2] = w1[2];
548     w1_t[3] = w1[3];
549     w2_t[0] = w2[0];
550     w2_t[1] = w2[1];
551     w2_t[2] = w2[2];
552     w2_t[3] = w2[3];
553     w3_t[0] = w3[0];
554     w3_t[1] = w3[1];
555     w3_t[2] = w3[2];
556     w3_t[3] = w3[3];
557
558     u32x digest[4];
559
560     digest[0] = MD4M_A;
561     digest[1] = MD4M_B;
562     digest[2] = MD4M_C;
563     digest[3] = MD4M_D;
564
565     md4_transform (w0_t, w1_t, w2_t, w3_t, digest);
566
567     w0_t[0] = digest[0];
568     w0_t[1] = digest[1];
569     w0_t[2] = digest[2];
570     w0_t[3] = digest[3];
571     w1_t[0] = 0;
572     w1_t[1] = 0;
573     w1_t[2] = 0;
574     w1_t[3] = 0;
575     w2_t[0] = 0;
576     w2_t[1] = 0;
577     w2_t[2] = 0;
578     w2_t[3] = 0;
579     w3_t[0] = 0;
580     w3_t[1] = 0;
581     w3_t[2] = 0;
582     w3_t[3] = 0;
583
584     digest[0] = MD5M_A;
585     digest[1] = MD5M_B;
586     digest[2] = MD5M_C;
587     digest[3] = MD5M_D;
588
589     u32x ipad[4];
590     u32x opad[4];
591
592     hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
593
594     int left;
595     int off;
596
597     for (left = userdomain_len, off = 0; left >= 56; left -= 64, off += 16)
598     {
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];
615
616       md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
617     }
618
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;
634     w3_t[3] = 0;
635
636     hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
637
638     w0_t[0] = digest[0];
639     w0_t[1] = digest[1];
640     w0_t[2] = digest[2];
641     w0_t[3] = digest[3];
642     w1_t[0] = 0;
643     w1_t[1] = 0;
644     w1_t[2] = 0;
645     w1_t[3] = 0;
646     w2_t[0] = 0;
647     w2_t[1] = 0;
648     w2_t[2] = 0;
649     w2_t[3] = 0;
650     w3_t[0] = 0;
651     w3_t[1] = 0;
652     w3_t[2] = 0;
653     w3_t[3] = 0;
654
655     digest[0] = MD5M_A;
656     digest[1] = MD5M_B;
657     digest[2] = MD5M_C;
658     digest[3] = MD5M_D;
659
660     hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
661
662     for (left = chall_len, off = 0; left >= 56; left -= 64, off += 16)
663     {
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];
680
681       md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
682     }
683
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;
699     w3_t[3] = 0;
700
701     hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
702
703     COMPARE_S_SIMD (digest[0], digest[3], digest[2], digest[1]);
704   }
705 }
706
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)
708 {
709   /**
710    * modifier
711    */
712
713   const u32 gid = get_global_id (0);
714   const u32 lid = get_local_id (0);
715   const u32 lsz = get_local_size (0);
716
717   /**
718    * salt
719    */
720
721   __local u32 s_userdomain_buf[64];
722
723   for (u32 i = lid; i < 64; i += lsz)
724   {
725     s_userdomain_buf[i] = netntlm_bufs[salt_pos].userdomain_buf[i];
726   }
727
728   __local u32 s_chall_buf[256];
729
730   for (u32 i = lid; i < 256; i += lsz)
731   {
732     s_chall_buf[i] = netntlm_bufs[salt_pos].chall_buf[i];
733   }
734
735   barrier (CLK_LOCAL_MEM_FENCE);
736
737   if (gid >= gid_max) return;
738
739   const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
740                            + netntlm_bufs[salt_pos].domain_len;
741
742   const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
743                       + netntlm_bufs[salt_pos].clichall_len;
744
745   /**
746    * base
747    */
748
749   u32 w0[4];
750
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];
755
756   u32 w1[4];
757
758   w1[0] = 0;
759   w1[1] = 0;
760   w1[2] = 0;
761   w1[3] = 0;
762
763   u32 w2[4];
764
765   w2[0] = 0;
766   w2[1] = 0;
767   w2[2] = 0;
768   w2[3] = 0;
769
770   u32 w3[4];
771
772   w3[0] = 0;
773   w3[1] = 0;
774   w3[2] = pws[gid].i[14];
775   w3[3] = 0;
776
777   const u32 pw_len = pws[gid].pw_len;
778
779   /**
780    * main
781    */
782
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);
784 }
785
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)
787 {
788   /**
789    * modifier
790    */
791
792   const u32 gid = get_global_id (0);
793   const u32 lid = get_local_id (0);
794   const u32 lsz = get_local_size (0);
795
796   /**
797    * salt
798    */
799
800   __local u32 s_userdomain_buf[64];
801
802   for (u32 i = lid; i < 64; i += lsz)
803   {
804     s_userdomain_buf[i] = netntlm_bufs[salt_pos].userdomain_buf[i];
805   }
806
807   __local u32 s_chall_buf[256];
808
809   for (u32 i = lid; i < 256; i += lsz)
810   {
811     s_chall_buf[i] = netntlm_bufs[salt_pos].chall_buf[i];
812   }
813
814   barrier (CLK_LOCAL_MEM_FENCE);
815
816   if (gid >= gid_max) return;
817
818   const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
819                            + netntlm_bufs[salt_pos].domain_len;
820
821   const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
822                       + netntlm_bufs[salt_pos].clichall_len;
823
824   /**
825    * base
826    */
827
828   u32 w0[4];
829
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];
834
835   u32 w1[4];
836
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];
841
842   u32 w2[4];
843
844   w2[0] = 0;
845   w2[1] = 0;
846   w2[2] = 0;
847   w2[3] = 0;
848
849   u32 w3[4];
850
851   w3[0] = 0;
852   w3[1] = 0;
853   w3[2] = pws[gid].i[14];
854   w3[3] = 0;
855
856   const u32 pw_len = pws[gid].pw_len;
857
858   /**
859    * main
860    */
861
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);
863 }
864
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)
866 {
867 }
868
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)
870 {
871   /**
872    * modifier
873    */
874
875   const u32 gid = get_global_id (0);
876   const u32 lid = get_local_id (0);
877   const u32 lsz = get_local_size (0);
878
879   /**
880    * salt
881    */
882
883   __local u32 s_userdomain_buf[64];
884
885   for (u32 i = lid; i < 64; i += lsz)
886   {
887     s_userdomain_buf[i] = netntlm_bufs[salt_pos].userdomain_buf[i];
888   }
889
890   __local u32 s_chall_buf[256];
891
892   for (u32 i = lid; i < 256; i += lsz)
893   {
894     s_chall_buf[i] = netntlm_bufs[salt_pos].chall_buf[i];
895   }
896
897   barrier (CLK_LOCAL_MEM_FENCE);
898
899   if (gid >= gid_max) return;
900
901   const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
902                            + netntlm_bufs[salt_pos].domain_len;
903
904   const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
905                       + netntlm_bufs[salt_pos].clichall_len;
906
907   /**
908    * base
909    */
910
911   u32 w0[4];
912
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];
917
918   u32 w1[4];
919
920   w1[0] = 0;
921   w1[1] = 0;
922   w1[2] = 0;
923   w1[3] = 0;
924
925   u32 w2[4];
926
927   w2[0] = 0;
928   w2[1] = 0;
929   w2[2] = 0;
930   w2[3] = 0;
931
932   u32 w3[4];
933
934   w3[0] = 0;
935   w3[1] = 0;
936   w3[2] = pws[gid].i[14];
937   w3[3] = 0;
938
939   const u32 pw_len = pws[gid].pw_len;
940
941   /**
942    * main
943    */
944
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);
946 }
947
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)
949 {
950   /**
951    * modifier
952    */
953
954   const u32 gid = get_global_id (0);
955   const u32 lid = get_local_id (0);
956   const u32 lsz = get_local_size (0);
957
958   /**
959    * salt
960    */
961
962   __local u32 s_userdomain_buf[64];
963
964   for (u32 i = lid; i < 64; i += lsz)
965   {
966     s_userdomain_buf[i] = netntlm_bufs[salt_pos].userdomain_buf[i];
967   }
968
969   __local u32 s_chall_buf[256];
970
971   for (u32 i = lid; i < 256; i += lsz)
972   {
973     s_chall_buf[i] = netntlm_bufs[salt_pos].chall_buf[i];
974   }
975
976   barrier (CLK_LOCAL_MEM_FENCE);
977
978   if (gid >= gid_max) return;
979
980   const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
981                            + netntlm_bufs[salt_pos].domain_len;
982
983   const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
984                       + netntlm_bufs[salt_pos].clichall_len;
985
986   /**
987    * base
988    */
989
990   u32 w0[4];
991
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];
996
997   u32 w1[4];
998
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];
1003
1004   u32 w2[4];
1005
1006   w2[0] = 0;
1007   w2[1] = 0;
1008   w2[2] = 0;
1009   w2[3] = 0;
1010
1011   u32 w3[4];
1012
1013   w3[0] = 0;
1014   w3[1] = 0;
1015   w3[2] = pws[gid].i[14];
1016   w3[3] = 0;
1017
1018   const u32 pw_len = pws[gid].pw_len;
1019
1020   /**
1021    * main
1022    */
1023
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);
1025 }
1026
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)
1028 {
1029 }