Merge branch 'master' of https://github.com/hashcat/oclHashcat
[hashcat.git] / OpenCL / m05600_a3.cl
1 /**
2  * Author......: Jens Steube <jens.steube@gmail.com>
3  * License.....: MIT
4  */
5
6 #define _NETNTLMV2_
7
8 #include "include/constants.h"
9 #include "include/kernel_vendor.h"
10
11 #define DGST_R0 0
12 #define DGST_R1 3
13 #define DGST_R2 2
14 #define DGST_R3 1
15
16 #include "include/kernel_functions.c"
17 #include "OpenCL/types_ocl.c"
18 #include "OpenCL/common.c"
19
20 #define COMPARE_S "OpenCL/check_single_comp4.c"
21 #define COMPARE_M "OpenCL/check_multi_comp4.c"
22
23 static void md4_transform (const u32 w0[4], const u32 w1[4], const u32 w2[4], const u32 w3[4], u32 digest[4])
24 {
25   u32 a = digest[0];
26   u32 b = digest[1];
27   u32 c = digest[2];
28   u32 d = digest[3];
29
30   u32 w0_t = w0[0];
31   u32 w1_t = w0[1];
32   u32 w2_t = w0[2];
33   u32 w3_t = w0[3];
34   u32 w4_t = w1[0];
35   u32 w5_t = w1[1];
36   u32 w6_t = w1[2];
37   u32 w7_t = w1[3];
38   u32 w8_t = w2[0];
39   u32 w9_t = w2[1];
40   u32 wa_t = w2[2];
41   u32 wb_t = w2[3];
42   u32 wc_t = w3[0];
43   u32 wd_t = w3[1];
44   u32 we_t = w3[2];
45   u32 wf_t = w3[3];
46
47   MD4_STEP (MD4_Fo, a, b, c, d, w0_t, MD4C00, MD4S00);
48   MD4_STEP (MD4_Fo, d, a, b, c, w1_t, MD4C00, MD4S01);
49   MD4_STEP (MD4_Fo, c, d, a, b, w2_t, MD4C00, MD4S02);
50   MD4_STEP (MD4_Fo, b, c, d, a, w3_t, MD4C00, MD4S03);
51   MD4_STEP (MD4_Fo, a, b, c, d, w4_t, MD4C00, MD4S00);
52   MD4_STEP (MD4_Fo, d, a, b, c, w5_t, MD4C00, MD4S01);
53   MD4_STEP (MD4_Fo, c, d, a, b, w6_t, MD4C00, MD4S02);
54   MD4_STEP (MD4_Fo, b, c, d, a, w7_t, MD4C00, MD4S03);
55   MD4_STEP (MD4_Fo, a, b, c, d, w8_t, MD4C00, MD4S00);
56   MD4_STEP (MD4_Fo, d, a, b, c, w9_t, MD4C00, MD4S01);
57   MD4_STEP (MD4_Fo, c, d, a, b, wa_t, MD4C00, MD4S02);
58   MD4_STEP (MD4_Fo, b, c, d, a, wb_t, MD4C00, MD4S03);
59   MD4_STEP (MD4_Fo, a, b, c, d, wc_t, MD4C00, MD4S00);
60   MD4_STEP (MD4_Fo, d, a, b, c, wd_t, MD4C00, MD4S01);
61   MD4_STEP (MD4_Fo, c, d, a, b, we_t, MD4C00, MD4S02);
62   MD4_STEP (MD4_Fo, b, c, d, a, wf_t, MD4C00, MD4S03);
63
64   MD4_STEP (MD4_Go, a, b, c, d, w0_t, MD4C01, MD4S10);
65   MD4_STEP (MD4_Go, d, a, b, c, w4_t, MD4C01, MD4S11);
66   MD4_STEP (MD4_Go, c, d, a, b, w8_t, MD4C01, MD4S12);
67   MD4_STEP (MD4_Go, b, c, d, a, wc_t, MD4C01, MD4S13);
68   MD4_STEP (MD4_Go, a, b, c, d, w1_t, MD4C01, MD4S10);
69   MD4_STEP (MD4_Go, d, a, b, c, w5_t, MD4C01, MD4S11);
70   MD4_STEP (MD4_Go, c, d, a, b, w9_t, MD4C01, MD4S12);
71   MD4_STEP (MD4_Go, b, c, d, a, wd_t, MD4C01, MD4S13);
72   MD4_STEP (MD4_Go, a, b, c, d, w2_t, MD4C01, MD4S10);
73   MD4_STEP (MD4_Go, d, a, b, c, w6_t, MD4C01, MD4S11);
74   MD4_STEP (MD4_Go, c, d, a, b, wa_t, MD4C01, MD4S12);
75   MD4_STEP (MD4_Go, b, c, d, a, we_t, MD4C01, MD4S13);
76   MD4_STEP (MD4_Go, a, b, c, d, w3_t, MD4C01, MD4S10);
77   MD4_STEP (MD4_Go, d, a, b, c, w7_t, MD4C01, MD4S11);
78   MD4_STEP (MD4_Go, c, d, a, b, wb_t, MD4C01, MD4S12);
79   MD4_STEP (MD4_Go, b, c, d, a, wf_t, MD4C01, MD4S13);
80
81   MD4_STEP (MD4_H , a, b, c, d, w0_t, MD4C02, MD4S20);
82   MD4_STEP (MD4_H , d, a, b, c, w8_t, MD4C02, MD4S21);
83   MD4_STEP (MD4_H , c, d, a, b, w4_t, MD4C02, MD4S22);
84   MD4_STEP (MD4_H , b, c, d, a, wc_t, MD4C02, MD4S23);
85   MD4_STEP (MD4_H , a, b, c, d, w2_t, MD4C02, MD4S20);
86   MD4_STEP (MD4_H , d, a, b, c, wa_t, MD4C02, MD4S21);
87   MD4_STEP (MD4_H , c, d, a, b, w6_t, MD4C02, MD4S22);
88   MD4_STEP (MD4_H , b, c, d, a, we_t, MD4C02, MD4S23);
89   MD4_STEP (MD4_H , a, b, c, d, w1_t, MD4C02, MD4S20);
90   MD4_STEP (MD4_H , d, a, b, c, w9_t, MD4C02, MD4S21);
91   MD4_STEP (MD4_H , c, d, a, b, w5_t, MD4C02, MD4S22);
92   MD4_STEP (MD4_H , b, c, d, a, wd_t, MD4C02, MD4S23);
93   MD4_STEP (MD4_H , a, b, c, d, w3_t, MD4C02, MD4S20);
94   MD4_STEP (MD4_H , d, a, b, c, wb_t, MD4C02, MD4S21);
95   MD4_STEP (MD4_H , c, d, a, b, w7_t, MD4C02, MD4S22);
96   MD4_STEP (MD4_H , b, c, d, a, wf_t, MD4C02, MD4S23);
97
98   digest[0] += a;
99   digest[1] += b;
100   digest[2] += c;
101   digest[3] += d;
102 }
103
104 static void md5_transform (const u32 w0[4], const u32 w1[4], const u32 w2[4], const u32 w3[4], u32 digest[4])
105 {
106   u32 a = digest[0];
107   u32 b = digest[1];
108   u32 c = digest[2];
109   u32 d = digest[3];
110
111   u32 w0_t = w0[0];
112   u32 w1_t = w0[1];
113   u32 w2_t = w0[2];
114   u32 w3_t = w0[3];
115   u32 w4_t = w1[0];
116   u32 w5_t = w1[1];
117   u32 w6_t = w1[2];
118   u32 w7_t = w1[3];
119   u32 w8_t = w2[0];
120   u32 w9_t = w2[1];
121   u32 wa_t = w2[2];
122   u32 wb_t = w2[3];
123   u32 wc_t = w3[0];
124   u32 wd_t = w3[1];
125   u32 we_t = w3[2];
126   u32 wf_t = w3[3];
127
128   MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
129   MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
130   MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
131   MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
132   MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
133   MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
134   MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
135   MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
136   MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
137   MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
138   MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
139   MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
140   MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
141   MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
142   MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
143   MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
144
145   MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
146   MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
147   MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
148   MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
149   MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
150   MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
151   MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
152   MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
153   MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
154   MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
155   MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
156   MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
157   MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
158   MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
159   MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
160   MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
161
162   MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
163   MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
164   MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
165   MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
166   MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
167   MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
168   MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
169   MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
170   MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
171   MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
172   MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
173   MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
174   MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
175   MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
176   MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
177   MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
178
179   MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
180   MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
181   MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
182   MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
183   MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
184   MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
185   MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
186   MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
187   MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
188   MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
189   MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
190   MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
191   MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
192   MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
193   MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
194   MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
195
196   digest[0] += a;
197   digest[1] += b;
198   digest[2] += c;
199   digest[3] += d;
200 }
201
202 static void hmac_md5_pad (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], u32 ipad[4], u32 opad[4])
203 {
204   w0[0] = w0[0] ^ 0x36363636;
205   w0[1] = w0[1] ^ 0x36363636;
206   w0[2] = w0[2] ^ 0x36363636;
207   w0[3] = w0[3] ^ 0x36363636;
208   w1[0] = w1[0] ^ 0x36363636;
209   w1[1] = w1[1] ^ 0x36363636;
210   w1[2] = w1[2] ^ 0x36363636;
211   w1[3] = w1[3] ^ 0x36363636;
212   w2[0] = w2[0] ^ 0x36363636;
213   w2[1] = w2[1] ^ 0x36363636;
214   w2[2] = w2[2] ^ 0x36363636;
215   w2[3] = w2[3] ^ 0x36363636;
216   w3[0] = w3[0] ^ 0x36363636;
217   w3[1] = w3[1] ^ 0x36363636;
218   w3[2] = w3[2] ^ 0x36363636;
219   w3[3] = w3[3] ^ 0x36363636;
220
221   ipad[0] = MD5M_A;
222   ipad[1] = MD5M_B;
223   ipad[2] = MD5M_C;
224   ipad[3] = MD5M_D;
225
226   md5_transform (w0, w1, w2, w3, ipad);
227
228   w0[0] = w0[0] ^ 0x6a6a6a6a;
229   w0[1] = w0[1] ^ 0x6a6a6a6a;
230   w0[2] = w0[2] ^ 0x6a6a6a6a;
231   w0[3] = w0[3] ^ 0x6a6a6a6a;
232   w1[0] = w1[0] ^ 0x6a6a6a6a;
233   w1[1] = w1[1] ^ 0x6a6a6a6a;
234   w1[2] = w1[2] ^ 0x6a6a6a6a;
235   w1[3] = w1[3] ^ 0x6a6a6a6a;
236   w2[0] = w2[0] ^ 0x6a6a6a6a;
237   w2[1] = w2[1] ^ 0x6a6a6a6a;
238   w2[2] = w2[2] ^ 0x6a6a6a6a;
239   w2[3] = w2[3] ^ 0x6a6a6a6a;
240   w3[0] = w3[0] ^ 0x6a6a6a6a;
241   w3[1] = w3[1] ^ 0x6a6a6a6a;
242   w3[2] = w3[2] ^ 0x6a6a6a6a;
243   w3[3] = w3[3] ^ 0x6a6a6a6a;
244
245   opad[0] = MD5M_A;
246   opad[1] = MD5M_B;
247   opad[2] = MD5M_C;
248   opad[3] = MD5M_D;
249
250   md5_transform (w0, w1, w2, w3, opad);
251 }
252
253 static 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])
254 {
255   digest[0] = ipad[0];
256   digest[1] = ipad[1];
257   digest[2] = ipad[2];
258   digest[3] = ipad[3];
259
260   md5_transform (w0, w1, w2, w3, digest);
261
262   w0[0] = digest[0];
263   w0[1] = digest[1];
264   w0[2] = digest[2];
265   w0[3] = digest[3];
266   w1[0] = 0x80;
267   w1[1] = 0;
268   w1[2] = 0;
269   w1[3] = 0;
270   w2[0] = 0;
271   w2[1] = 0;
272   w2[2] = 0;
273   w2[3] = 0;
274   w3[0] = 0;
275   w3[1] = 0;
276   w3[2] = (64 + 16) * 8;
277   w3[3] = 0;
278
279   digest[0] = opad[0];
280   digest[1] = opad[1];
281   digest[2] = opad[2];
282   digest[3] = opad[3];
283
284   md5_transform (w0, w1, w2, w3, digest);
285 }
286
287 static void m05600m (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_len, __global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global netntlm_t *netntlm_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, __local u32 s_userdomain_buf[64], __local u32 s_chall_buf[256])
288 {
289   /**
290    * modifier
291    */
292
293   const u32 gid = get_global_id (0);
294   const u32 lid = get_local_id (0);
295
296   /**
297    * prepare
298    */
299
300   const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
301                             + netntlm_bufs[salt_pos].domain_len;
302
303   const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
304                        + netntlm_bufs[salt_pos].clichall_len;
305
306   /**
307    * loop
308    */
309
310   u32 w0l = w0[0];
311
312   for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos++)
313   {
314     const u32 w0r = bfs_buf[il_pos].i;
315
316     w0[0] = w0l | w0r;
317
318     u32 digest[4];
319
320     digest[0] = MD4M_A;
321     digest[1] = MD4M_B;
322     digest[2] = MD4M_C;
323     digest[3] = MD4M_D;
324
325     md4_transform (w0, w1, w2, w3, digest);
326
327     u32 w0_t[4];
328     u32 w1_t[4];
329     u32 w2_t[4];
330     u32 w3_t[4];
331
332     w0_t[0] = digest[0];
333     w0_t[1] = digest[1];
334     w0_t[2] = digest[2];
335     w0_t[3] = digest[3];
336     w1_t[0] = 0;
337     w1_t[1] = 0;
338     w1_t[2] = 0;
339     w1_t[3] = 0;
340     w2_t[0] = 0;
341     w2_t[1] = 0;
342     w2_t[2] = 0;
343     w2_t[3] = 0;
344     w3_t[0] = 0;
345     w3_t[1] = 0;
346     w3_t[2] = 0;
347     w3_t[3] = 0;
348
349     digest[0] = MD5M_A;
350     digest[1] = MD5M_B;
351     digest[2] = MD5M_C;
352     digest[3] = MD5M_D;
353
354     u32 ipad[4];
355     u32 opad[4];
356
357     hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
358
359     int left;
360     int off;
361
362     for (left = userdomain_len, off = 0; left >= 56; left -= 64, off += 16)
363     {
364       w0_t[0] = s_userdomain_buf[off +  0];
365       w0_t[1] = s_userdomain_buf[off +  1];
366       w0_t[2] = s_userdomain_buf[off +  2];
367       w0_t[3] = s_userdomain_buf[off +  3];
368       w1_t[0] = s_userdomain_buf[off +  4];
369       w1_t[1] = s_userdomain_buf[off +  5];
370       w1_t[2] = s_userdomain_buf[off +  6];
371       w1_t[3] = s_userdomain_buf[off +  7];
372       w2_t[0] = s_userdomain_buf[off +  8];
373       w2_t[1] = s_userdomain_buf[off +  9];
374       w2_t[2] = s_userdomain_buf[off + 10];
375       w2_t[3] = s_userdomain_buf[off + 11];
376       w3_t[0] = s_userdomain_buf[off + 12];
377       w3_t[1] = s_userdomain_buf[off + 13];
378       w3_t[2] = s_userdomain_buf[off + 14];
379       w3_t[3] = s_userdomain_buf[off + 15];
380
381       md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
382     }
383
384     w0_t[0] = s_userdomain_buf[off +  0];
385     w0_t[1] = s_userdomain_buf[off +  1];
386     w0_t[2] = s_userdomain_buf[off +  2];
387     w0_t[3] = s_userdomain_buf[off +  3];
388     w1_t[0] = s_userdomain_buf[off +  4];
389     w1_t[1] = s_userdomain_buf[off +  5];
390     w1_t[2] = s_userdomain_buf[off +  6];
391     w1_t[3] = s_userdomain_buf[off +  7];
392     w2_t[0] = s_userdomain_buf[off +  8];
393     w2_t[1] = s_userdomain_buf[off +  9];
394     w2_t[2] = s_userdomain_buf[off + 10];
395     w2_t[3] = s_userdomain_buf[off + 11];
396     w3_t[0] = s_userdomain_buf[off + 12];
397     w3_t[1] = s_userdomain_buf[off + 13];
398     w3_t[2] = (64 + userdomain_len) * 8;
399     w3_t[3] = 0;
400
401     hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
402
403     w0_t[0] = digest[0];
404     w0_t[1] = digest[1];
405     w0_t[2] = digest[2];
406     w0_t[3] = digest[3];
407     w1_t[0] = 0;
408     w1_t[1] = 0;
409     w1_t[2] = 0;
410     w1_t[3] = 0;
411     w2_t[0] = 0;
412     w2_t[1] = 0;
413     w2_t[2] = 0;
414     w2_t[3] = 0;
415     w3_t[0] = 0;
416     w3_t[1] = 0;
417     w3_t[2] = 0;
418     w3_t[3] = 0;
419
420     digest[0] = MD5M_A;
421     digest[1] = MD5M_B;
422     digest[2] = MD5M_C;
423     digest[3] = MD5M_D;
424
425     hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
426
427     for (left = chall_len, off = 0; left >= 56; left -= 64, off += 16)
428     {
429       w0_t[0] = s_chall_buf[off +  0];
430       w0_t[1] = s_chall_buf[off +  1];
431       w0_t[2] = s_chall_buf[off +  2];
432       w0_t[3] = s_chall_buf[off +  3];
433       w1_t[0] = s_chall_buf[off +  4];
434       w1_t[1] = s_chall_buf[off +  5];
435       w1_t[2] = s_chall_buf[off +  6];
436       w1_t[3] = s_chall_buf[off +  7];
437       w2_t[0] = s_chall_buf[off +  8];
438       w2_t[1] = s_chall_buf[off +  9];
439       w2_t[2] = s_chall_buf[off + 10];
440       w2_t[3] = s_chall_buf[off + 11];
441       w3_t[0] = s_chall_buf[off + 12];
442       w3_t[1] = s_chall_buf[off + 13];
443       w3_t[2] = s_chall_buf[off + 14];
444       w3_t[3] = s_chall_buf[off + 15];
445
446       md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
447     }
448
449     w0_t[0] = s_chall_buf[off +  0];
450     w0_t[1] = s_chall_buf[off +  1];
451     w0_t[2] = s_chall_buf[off +  2];
452     w0_t[3] = s_chall_buf[off +  3];
453     w1_t[0] = s_chall_buf[off +  4];
454     w1_t[1] = s_chall_buf[off +  5];
455     w1_t[2] = s_chall_buf[off +  6];
456     w1_t[3] = s_chall_buf[off +  7];
457     w2_t[0] = s_chall_buf[off +  8];
458     w2_t[1] = s_chall_buf[off +  9];
459     w2_t[2] = s_chall_buf[off + 10];
460     w2_t[3] = s_chall_buf[off + 11];
461     w3_t[0] = s_chall_buf[off + 12];
462     w3_t[1] = s_chall_buf[off + 13];
463     w3_t[2] = (64 + chall_len) * 8;
464     w3_t[3] = 0;
465
466     hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
467
468     const u32 r0 = digest[0];
469     const u32 r1 = digest[3];
470     const u32 r2 = digest[2];
471     const u32 r3 = digest[1];
472
473     #include COMPARE_M
474   }
475 }
476
477 static void m05600s (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_len, __global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global netntlm_t *netntlm_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, __local u32 s_userdomain_buf[64], __local u32 s_chall_buf[256])
478 {
479   /**
480    * modifier
481    */
482
483   const u32 gid = get_global_id (0);
484   const u32 lid = get_local_id (0);
485
486   /**
487    * digest
488    */
489
490   const u32 search[4] =
491   {
492     digests_buf[digests_offset].digest_buf[DGST_R0],
493     digests_buf[digests_offset].digest_buf[DGST_R1],
494     digests_buf[digests_offset].digest_buf[DGST_R2],
495     digests_buf[digests_offset].digest_buf[DGST_R3]
496   };
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    * loop
510    */
511
512   u32 w0l = w0[0];
513
514   for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos++)
515   {
516     const u32 w0r = bfs_buf[il_pos].i;
517
518     w0[0] = w0l | w0r;
519
520     u32 digest[4];
521
522     digest[0] = MD4M_A;
523     digest[1] = MD4M_B;
524     digest[2] = MD4M_C;
525     digest[3] = MD4M_D;
526
527     md4_transform (w0, w1, w2, w3, digest);
528
529     u32 w0_t[4];
530     u32 w1_t[4];
531     u32 w2_t[4];
532     u32 w3_t[4];
533
534     w0_t[0] = digest[0];
535     w0_t[1] = digest[1];
536     w0_t[2] = digest[2];
537     w0_t[3] = digest[3];
538     w1_t[0] = 0;
539     w1_t[1] = 0;
540     w1_t[2] = 0;
541     w1_t[3] = 0;
542     w2_t[0] = 0;
543     w2_t[1] = 0;
544     w2_t[2] = 0;
545     w2_t[3] = 0;
546     w3_t[0] = 0;
547     w3_t[1] = 0;
548     w3_t[2] = 0;
549     w3_t[3] = 0;
550
551     digest[0] = MD5M_A;
552     digest[1] = MD5M_B;
553     digest[2] = MD5M_C;
554     digest[3] = MD5M_D;
555
556     u32 ipad[4];
557     u32 opad[4];
558
559     hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
560
561     int left;
562     int off;
563
564     for (left = userdomain_len, off = 0; left >= 56; left -= 64, off += 16)
565     {
566       w0_t[0] = s_userdomain_buf[off +  0];
567       w0_t[1] = s_userdomain_buf[off +  1];
568       w0_t[2] = s_userdomain_buf[off +  2];
569       w0_t[3] = s_userdomain_buf[off +  3];
570       w1_t[0] = s_userdomain_buf[off +  4];
571       w1_t[1] = s_userdomain_buf[off +  5];
572       w1_t[2] = s_userdomain_buf[off +  6];
573       w1_t[3] = s_userdomain_buf[off +  7];
574       w2_t[0] = s_userdomain_buf[off +  8];
575       w2_t[1] = s_userdomain_buf[off +  9];
576       w2_t[2] = s_userdomain_buf[off + 10];
577       w2_t[3] = s_userdomain_buf[off + 11];
578       w3_t[0] = s_userdomain_buf[off + 12];
579       w3_t[1] = s_userdomain_buf[off + 13];
580       w3_t[2] = s_userdomain_buf[off + 14];
581       w3_t[3] = s_userdomain_buf[off + 15];
582
583       md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
584     }
585
586     w0_t[0] = s_userdomain_buf[off +  0];
587     w0_t[1] = s_userdomain_buf[off +  1];
588     w0_t[2] = s_userdomain_buf[off +  2];
589     w0_t[3] = s_userdomain_buf[off +  3];
590     w1_t[0] = s_userdomain_buf[off +  4];
591     w1_t[1] = s_userdomain_buf[off +  5];
592     w1_t[2] = s_userdomain_buf[off +  6];
593     w1_t[3] = s_userdomain_buf[off +  7];
594     w2_t[0] = s_userdomain_buf[off +  8];
595     w2_t[1] = s_userdomain_buf[off +  9];
596     w2_t[2] = s_userdomain_buf[off + 10];
597     w2_t[3] = s_userdomain_buf[off + 11];
598     w3_t[0] = s_userdomain_buf[off + 12];
599     w3_t[1] = s_userdomain_buf[off + 13];
600     w3_t[2] = (64 + userdomain_len) * 8;
601     w3_t[3] = 0;
602
603     hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
604
605     w0_t[0] = digest[0];
606     w0_t[1] = digest[1];
607     w0_t[2] = digest[2];
608     w0_t[3] = digest[3];
609     w1_t[0] = 0;
610     w1_t[1] = 0;
611     w1_t[2] = 0;
612     w1_t[3] = 0;
613     w2_t[0] = 0;
614     w2_t[1] = 0;
615     w2_t[2] = 0;
616     w2_t[3] = 0;
617     w3_t[0] = 0;
618     w3_t[1] = 0;
619     w3_t[2] = 0;
620     w3_t[3] = 0;
621
622     digest[0] = MD5M_A;
623     digest[1] = MD5M_B;
624     digest[2] = MD5M_C;
625     digest[3] = MD5M_D;
626
627     hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
628
629     for (left = chall_len, off = 0; left >= 56; left -= 64, off += 16)
630     {
631       w0_t[0] = s_chall_buf[off +  0];
632       w0_t[1] = s_chall_buf[off +  1];
633       w0_t[2] = s_chall_buf[off +  2];
634       w0_t[3] = s_chall_buf[off +  3];
635       w1_t[0] = s_chall_buf[off +  4];
636       w1_t[1] = s_chall_buf[off +  5];
637       w1_t[2] = s_chall_buf[off +  6];
638       w1_t[3] = s_chall_buf[off +  7];
639       w2_t[0] = s_chall_buf[off +  8];
640       w2_t[1] = s_chall_buf[off +  9];
641       w2_t[2] = s_chall_buf[off + 10];
642       w2_t[3] = s_chall_buf[off + 11];
643       w3_t[0] = s_chall_buf[off + 12];
644       w3_t[1] = s_chall_buf[off + 13];
645       w3_t[2] = s_chall_buf[off + 14];
646       w3_t[3] = s_chall_buf[off + 15];
647
648       md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
649     }
650
651     w0_t[0] = s_chall_buf[off +  0];
652     w0_t[1] = s_chall_buf[off +  1];
653     w0_t[2] = s_chall_buf[off +  2];
654     w0_t[3] = s_chall_buf[off +  3];
655     w1_t[0] = s_chall_buf[off +  4];
656     w1_t[1] = s_chall_buf[off +  5];
657     w1_t[2] = s_chall_buf[off +  6];
658     w1_t[3] = s_chall_buf[off +  7];
659     w2_t[0] = s_chall_buf[off +  8];
660     w2_t[1] = s_chall_buf[off +  9];
661     w2_t[2] = s_chall_buf[off + 10];
662     w2_t[3] = s_chall_buf[off + 11];
663     w3_t[0] = s_chall_buf[off + 12];
664     w3_t[1] = s_chall_buf[off + 13];
665     w3_t[2] = (64 + chall_len) * 8;
666     w3_t[3] = 0;
667
668     hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
669
670     const u32 r0 = digest[0];
671     const u32 r1 = digest[3];
672     const u32 r2 = digest[2];
673     const u32 r3 = digest[1];
674
675     #include COMPARE_S
676   }
677 }
678
679 __kernel void m05600_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global netntlm_t *netntlm_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
680 {
681   /**
682    * modifier
683    */
684
685   const u32 gid = get_global_id (0);
686   const u32 lid = get_local_id (0);
687   const u32 lsz = get_local_size (0);
688
689   /**
690    * salt
691    */
692
693   __local u32 s_userdomain_buf[64];
694
695   for (u32 i = lid; i < 64; i += lsz)
696   {
697     s_userdomain_buf[i] = netntlm_bufs[salt_pos].userdomain_buf[i];
698   }
699
700   __local u32 s_chall_buf[256];
701
702   for (u32 i = lid; i < 256; i += lsz)
703   {
704     s_chall_buf[i] = netntlm_bufs[salt_pos].chall_buf[i];
705   }
706
707   barrier (CLK_LOCAL_MEM_FENCE);
708
709   if (gid >= gid_max) return;
710
711   const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
712                            + netntlm_bufs[salt_pos].domain_len;
713
714   const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
715                       + netntlm_bufs[salt_pos].clichall_len;
716
717   /**
718    * base
719    */
720
721   u32 w0[4];
722
723   w0[0] = pws[gid].i[ 0];
724   w0[1] = pws[gid].i[ 1];
725   w0[2] = pws[gid].i[ 2];
726   w0[3] = pws[gid].i[ 3];
727
728   u32 w1[4];
729
730   w1[0] = 0;
731   w1[1] = 0;
732   w1[2] = 0;
733   w1[3] = 0;
734
735   u32 w2[4];
736
737   w2[0] = 0;
738   w2[1] = 0;
739   w2[2] = 0;
740   w2[3] = 0;
741
742   u32 w3[4];
743
744   w3[0] = 0;
745   w3[1] = 0;
746   w3[2] = pws[gid].i[14];
747   w3[3] = 0;
748
749   const u32 pw_len = pws[gid].pw_len;
750
751   /**
752    * main
753    */
754
755   m05600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, netntlm_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset, s_userdomain_buf, s_chall_buf);
756 }
757
758 __kernel void m05600_m08 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global netntlm_t *netntlm_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
759 {
760   /**
761    * modifier
762    */
763
764   const u32 gid = get_global_id (0);
765   const u32 lid = get_local_id (0);
766   const u32 lsz = get_local_size (0);
767
768   /**
769    * salt
770    */
771
772   __local u32 s_userdomain_buf[64];
773
774   for (u32 i = lid; i < 64; i += lsz)
775   {
776     s_userdomain_buf[i] = netntlm_bufs[salt_pos].userdomain_buf[i];
777   }
778
779   __local u32 s_chall_buf[256];
780
781   for (u32 i = lid; i < 256; i += lsz)
782   {
783     s_chall_buf[i] = netntlm_bufs[salt_pos].chall_buf[i];
784   }
785
786   barrier (CLK_LOCAL_MEM_FENCE);
787
788   if (gid >= gid_max) return;
789
790   const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
791                            + netntlm_bufs[salt_pos].domain_len;
792
793   const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
794                       + netntlm_bufs[salt_pos].clichall_len;
795
796   /**
797    * base
798    */
799
800   u32 w0[4];
801
802   w0[0] = pws[gid].i[ 0];
803   w0[1] = pws[gid].i[ 1];
804   w0[2] = pws[gid].i[ 2];
805   w0[3] = pws[gid].i[ 3];
806
807   u32 w1[4];
808
809   w1[0] = pws[gid].i[ 4];
810   w1[1] = pws[gid].i[ 5];
811   w1[2] = pws[gid].i[ 6];
812   w1[3] = pws[gid].i[ 7];
813
814   u32 w2[4];
815
816   w2[0] = 0;
817   w2[1] = 0;
818   w2[2] = 0;
819   w2[3] = 0;
820
821   u32 w3[4];
822
823   w3[0] = 0;
824   w3[1] = 0;
825   w3[2] = pws[gid].i[14];
826   w3[3] = 0;
827
828   const u32 pw_len = pws[gid].pw_len;
829
830   /**
831    * main
832    */
833
834   m05600m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, netntlm_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset, s_userdomain_buf, s_chall_buf);
835 }
836
837 __kernel void m05600_m16 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global netntlm_t *netntlm_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
838 {
839 }
840
841 __kernel void m05600_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global netntlm_t *netntlm_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
842 {
843   /**
844    * modifier
845    */
846
847   const u32 gid = get_global_id (0);
848   const u32 lid = get_local_id (0);
849   const u32 lsz = get_local_size (0);
850
851   /**
852    * salt
853    */
854
855   __local u32 s_userdomain_buf[64];
856
857   for (u32 i = lid; i < 64; i += lsz)
858   {
859     s_userdomain_buf[i] = netntlm_bufs[salt_pos].userdomain_buf[i];
860   }
861
862   __local u32 s_chall_buf[256];
863
864   for (u32 i = lid; i < 256; i += lsz)
865   {
866     s_chall_buf[i] = netntlm_bufs[salt_pos].chall_buf[i];
867   }
868
869   barrier (CLK_LOCAL_MEM_FENCE);
870
871   if (gid >= gid_max) return;
872
873   const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
874                            + netntlm_bufs[salt_pos].domain_len;
875
876   const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
877                       + netntlm_bufs[salt_pos].clichall_len;
878
879   /**
880    * base
881    */
882
883   u32 w0[4];
884
885   w0[0] = pws[gid].i[ 0];
886   w0[1] = pws[gid].i[ 1];
887   w0[2] = pws[gid].i[ 2];
888   w0[3] = pws[gid].i[ 3];
889
890   u32 w1[4];
891
892   w1[0] = 0;
893   w1[1] = 0;
894   w1[2] = 0;
895   w1[3] = 0;
896
897   u32 w2[4];
898
899   w2[0] = 0;
900   w2[1] = 0;
901   w2[2] = 0;
902   w2[3] = 0;
903
904   u32 w3[4];
905
906   w3[0] = 0;
907   w3[1] = 0;
908   w3[2] = pws[gid].i[14];
909   w3[3] = 0;
910
911   const u32 pw_len = pws[gid].pw_len;
912
913   /**
914    * main
915    */
916
917   m05600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, netntlm_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset, s_userdomain_buf, s_chall_buf);
918 }
919
920 __kernel void m05600_s08 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global netntlm_t *netntlm_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
921 {
922   /**
923    * modifier
924    */
925
926   const u32 gid = get_global_id (0);
927   const u32 lid = get_local_id (0);
928   const u32 lsz = get_local_size (0);
929
930   /**
931    * salt
932    */
933
934   __local u32 s_userdomain_buf[64];
935
936   for (u32 i = lid; i < 64; i += lsz)
937   {
938     s_userdomain_buf[i] = netntlm_bufs[salt_pos].userdomain_buf[i];
939   }
940
941   __local u32 s_chall_buf[256];
942
943   for (u32 i = lid; i < 256; i += lsz)
944   {
945     s_chall_buf[i] = netntlm_bufs[salt_pos].chall_buf[i];
946   }
947
948   barrier (CLK_LOCAL_MEM_FENCE);
949
950   if (gid >= gid_max) return;
951
952   const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
953                            + netntlm_bufs[salt_pos].domain_len;
954
955   const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
956                       + netntlm_bufs[salt_pos].clichall_len;
957
958   /**
959    * base
960    */
961
962   u32 w0[4];
963
964   w0[0] = pws[gid].i[ 0];
965   w0[1] = pws[gid].i[ 1];
966   w0[2] = pws[gid].i[ 2];
967   w0[3] = pws[gid].i[ 3];
968
969   u32 w1[4];
970
971   w1[0] = pws[gid].i[ 4];
972   w1[1] = pws[gid].i[ 5];
973   w1[2] = pws[gid].i[ 6];
974   w1[3] = pws[gid].i[ 7];
975
976   u32 w2[4];
977
978   w2[0] = 0;
979   w2[1] = 0;
980   w2[2] = 0;
981   w2[3] = 0;
982
983   u32 w3[4];
984
985   w3[0] = 0;
986   w3[1] = 0;
987   w3[2] = pws[gid].i[14];
988   w3[3] = 0;
989
990   const u32 pw_len = pws[gid].pw_len;
991
992   /**
993    * main
994    */
995
996   m05600s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, netntlm_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset, s_userdomain_buf, s_chall_buf);
997 }
998
999 __kernel void m05600_s16 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global netntlm_t *netntlm_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
1000 {
1001 }