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