Converted _a3 kernels, use SIMD for CPU and GPU
[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 #define NEW_SIMD_CODE
9
10 #include "include/constants.h"
11 #include "include/kernel_vendor.h"
12
13 #define DGST_R0 0
14 #define DGST_R1 3
15 #define DGST_R2 2
16 #define DGST_R3 1
17
18 #include "include/kernel_functions.c"
19 #include "OpenCL/types_ocl.c"
20 #include "OpenCL/common.c"
21 #include "OpenCL/simd.c"
22
23 static void md4_transform (const u32x w0[4], const u32x w1[4], const u32x w2[4], const u32x w3[4], u32x digest[4])
24 {
25   u32x a = digest[0];
26   u32x b = digest[1];
27   u32x c = digest[2];
28   u32x d = digest[3];
29
30   u32x w0_t = w0[0];
31   u32x w1_t = w0[1];
32   u32x w2_t = w0[2];
33   u32x w3_t = w0[3];
34   u32x w4_t = w1[0];
35   u32x w5_t = w1[1];
36   u32x w6_t = w1[2];
37   u32x w7_t = w1[3];
38   u32x w8_t = w2[0];
39   u32x w9_t = w2[1];
40   u32x wa_t = w2[2];
41   u32x wb_t = w2[3];
42   u32x wc_t = w3[0];
43   u32x wd_t = w3[1];
44   u32x we_t = w3[2];
45   u32x 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 u32x w0[4], const u32x w1[4], const u32x w2[4], const u32x w3[4], u32x digest[4])
105 {
106   u32x a = digest[0];
107   u32x b = digest[1];
108   u32x c = digest[2];
109   u32x d = digest[3];
110
111   u32x w0_t = w0[0];
112   u32x w1_t = w0[1];
113   u32x w2_t = w0[2];
114   u32x w3_t = w0[3];
115   u32x w4_t = w1[0];
116   u32x w5_t = w1[1];
117   u32x w6_t = w1[2];
118   u32x w7_t = w1[3];
119   u32x w8_t = w2[0];
120   u32x w9_t = w2[1];
121   u32x wa_t = w2[2];
122   u32x wb_t = w2[3];
123   u32x wc_t = w3[0];
124   u32x wd_t = w3[1];
125   u32x we_t = w3[2];
126   u32x 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 (u32x w0[4], u32x w1[4], u32x w2[4], u32x w3[4], u32x ipad[4], u32x 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 (u32x w0[4], u32x w1[4], u32x w2[4], u32x w3[4], u32x ipad[4], u32x opad[4], u32x 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 += VECT_SIZE)
313   {
314     const u32x w0r = w0r_create_bft (bfs_buf, il_pos);
315
316     const u32x w0lr = w0l | w0r;
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
328     w1_t[0] = w1[0];
329     w1_t[1] = w1[1];
330     w1_t[2] = w1[2];
331     w1_t[3] = w1[3];
332
333     w2_t[0] = w2[0];
334     w2_t[1] = w2[1];
335     w2_t[2] = w2[2];
336     w2_t[3] = w2[3];
337
338     w3_t[0] = w3[0];
339     w3_t[1] = w3[1];
340     w3_t[2] = w3[2];
341     w3_t[3] = w3[3];
342
343     u32x digest[4];
344
345     digest[0] = MD4M_A;
346     digest[1] = MD4M_B;
347     digest[2] = MD4M_C;
348     digest[3] = MD4M_D;
349
350     md4_transform (w0_t, w1_t, w2_t, w3_t, digest);
351
352     w0_t[0] = digest[0];
353     w0_t[1] = digest[1];
354     w0_t[2] = digest[2];
355     w0_t[3] = digest[3];
356     w1_t[0] = 0;
357     w1_t[1] = 0;
358     w1_t[2] = 0;
359     w1_t[3] = 0;
360     w2_t[0] = 0;
361     w2_t[1] = 0;
362     w2_t[2] = 0;
363     w2_t[3] = 0;
364     w3_t[0] = 0;
365     w3_t[1] = 0;
366     w3_t[2] = 0;
367     w3_t[3] = 0;
368
369     digest[0] = MD5M_A;
370     digest[1] = MD5M_B;
371     digest[2] = MD5M_C;
372     digest[3] = MD5M_D;
373
374     u32x ipad[4];
375     u32x opad[4];
376
377     hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
378
379     int left;
380     int off;
381
382     for (left = userdomain_len, off = 0; left >= 56; left -= 64, off += 16)
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] = s_userdomain_buf[off + 14];
399       w3_t[3] = s_userdomain_buf[off + 15];
400
401       md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
402     }
403
404     w0_t[0] = s_userdomain_buf[off +  0];
405     w0_t[1] = s_userdomain_buf[off +  1];
406     w0_t[2] = s_userdomain_buf[off +  2];
407     w0_t[3] = s_userdomain_buf[off +  3];
408     w1_t[0] = s_userdomain_buf[off +  4];
409     w1_t[1] = s_userdomain_buf[off +  5];
410     w1_t[2] = s_userdomain_buf[off +  6];
411     w1_t[3] = s_userdomain_buf[off +  7];
412     w2_t[0] = s_userdomain_buf[off +  8];
413     w2_t[1] = s_userdomain_buf[off +  9];
414     w2_t[2] = s_userdomain_buf[off + 10];
415     w2_t[3] = s_userdomain_buf[off + 11];
416     w3_t[0] = s_userdomain_buf[off + 12];
417     w3_t[1] = s_userdomain_buf[off + 13];
418     w3_t[2] = (64 + userdomain_len) * 8;
419     w3_t[3] = 0;
420
421     hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
422
423     w0_t[0] = digest[0];
424     w0_t[1] = digest[1];
425     w0_t[2] = digest[2];
426     w0_t[3] = digest[3];
427     w1_t[0] = 0;
428     w1_t[1] = 0;
429     w1_t[2] = 0;
430     w1_t[3] = 0;
431     w2_t[0] = 0;
432     w2_t[1] = 0;
433     w2_t[2] = 0;
434     w2_t[3] = 0;
435     w3_t[0] = 0;
436     w3_t[1] = 0;
437     w3_t[2] = 0;
438     w3_t[3] = 0;
439
440     digest[0] = MD5M_A;
441     digest[1] = MD5M_B;
442     digest[2] = MD5M_C;
443     digest[3] = MD5M_D;
444
445     hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
446
447     for (left = chall_len, off = 0; left >= 56; left -= 64, off += 16)
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] = s_chall_buf[off + 14];
464       w3_t[3] = s_chall_buf[off + 15];
465
466       md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
467     }
468
469     w0_t[0] = s_chall_buf[off +  0];
470     w0_t[1] = s_chall_buf[off +  1];
471     w0_t[2] = s_chall_buf[off +  2];
472     w0_t[3] = s_chall_buf[off +  3];
473     w1_t[0] = s_chall_buf[off +  4];
474     w1_t[1] = s_chall_buf[off +  5];
475     w1_t[2] = s_chall_buf[off +  6];
476     w1_t[3] = s_chall_buf[off +  7];
477     w2_t[0] = s_chall_buf[off +  8];
478     w2_t[1] = s_chall_buf[off +  9];
479     w2_t[2] = s_chall_buf[off + 10];
480     w2_t[3] = s_chall_buf[off + 11];
481     w3_t[0] = s_chall_buf[off + 12];
482     w3_t[1] = s_chall_buf[off + 13];
483     w3_t[2] = (64 + chall_len) * 8;
484     w3_t[3] = 0;
485
486     hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
487
488     COMPARE_M_SIMD (digest[0], digest[3], digest[2], digest[1]);
489   }
490 }
491
492 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])
493 {
494   /**
495    * modifier
496    */
497
498   const u32 gid = get_global_id (0);
499   const u32 lid = get_local_id (0);
500
501   /**
502    * digest
503    */
504
505   const u32 search[4] =
506   {
507     digests_buf[digests_offset].digest_buf[DGST_R0],
508     digests_buf[digests_offset].digest_buf[DGST_R1],
509     digests_buf[digests_offset].digest_buf[DGST_R2],
510     digests_buf[digests_offset].digest_buf[DGST_R3]
511   };
512
513   /**
514    * prepare
515    */
516
517   const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
518                             + netntlm_bufs[salt_pos].domain_len;
519
520   const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
521                        + netntlm_bufs[salt_pos].clichall_len;
522
523   /**
524    * loop
525    */
526
527   u32 w0l = w0[0];
528
529   for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos += VECT_SIZE)
530   {
531     const u32x w0r = w0r_create_bft (bfs_buf, il_pos);
532
533     const u32x w0lr = w0l | w0r;
534
535     u32x w0_t[4];
536     u32x w1_t[4];
537     u32x w2_t[4];
538     u32x w3_t[4];
539
540     w0_t[0] = w0lr;
541     w0_t[1] = w0[1];
542     w0_t[2] = w0[2];
543     w0_t[3] = w0[3];
544
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
550     w2_t[0] = w2[0];
551     w2_t[1] = w2[1];
552     w2_t[2] = w2[2];
553     w2_t[3] = w2[3];
554
555     w3_t[0] = w3[0];
556     w3_t[1] = w3[1];
557     w3_t[2] = w3[2];
558     w3_t[3] = w3[3];
559
560     u32x digest[4];
561
562     digest[0] = MD4M_A;
563     digest[1] = MD4M_B;
564     digest[2] = MD4M_C;
565     digest[3] = MD4M_D;
566
567     md4_transform (w0_t, w1_t, w2_t, w3_t, digest);
568
569     w0_t[0] = digest[0];
570     w0_t[1] = digest[1];
571     w0_t[2] = digest[2];
572     w0_t[3] = digest[3];
573     w1_t[0] = 0;
574     w1_t[1] = 0;
575     w1_t[2] = 0;
576     w1_t[3] = 0;
577     w2_t[0] = 0;
578     w2_t[1] = 0;
579     w2_t[2] = 0;
580     w2_t[3] = 0;
581     w3_t[0] = 0;
582     w3_t[1] = 0;
583     w3_t[2] = 0;
584     w3_t[3] = 0;
585
586     digest[0] = MD5M_A;
587     digest[1] = MD5M_B;
588     digest[2] = MD5M_C;
589     digest[3] = MD5M_D;
590
591     u32x ipad[4];
592     u32x opad[4];
593
594     hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
595
596     int left;
597     int off;
598
599     for (left = userdomain_len, off = 0; left >= 56; left -= 64, off += 16)
600     {
601       w0_t[0] = s_userdomain_buf[off +  0];
602       w0_t[1] = s_userdomain_buf[off +  1];
603       w0_t[2] = s_userdomain_buf[off +  2];
604       w0_t[3] = s_userdomain_buf[off +  3];
605       w1_t[0] = s_userdomain_buf[off +  4];
606       w1_t[1] = s_userdomain_buf[off +  5];
607       w1_t[2] = s_userdomain_buf[off +  6];
608       w1_t[3] = s_userdomain_buf[off +  7];
609       w2_t[0] = s_userdomain_buf[off +  8];
610       w2_t[1] = s_userdomain_buf[off +  9];
611       w2_t[2] = s_userdomain_buf[off + 10];
612       w2_t[3] = s_userdomain_buf[off + 11];
613       w3_t[0] = s_userdomain_buf[off + 12];
614       w3_t[1] = s_userdomain_buf[off + 13];
615       w3_t[2] = s_userdomain_buf[off + 14];
616       w3_t[3] = s_userdomain_buf[off + 15];
617
618       md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
619     }
620
621     w0_t[0] = s_userdomain_buf[off +  0];
622     w0_t[1] = s_userdomain_buf[off +  1];
623     w0_t[2] = s_userdomain_buf[off +  2];
624     w0_t[3] = s_userdomain_buf[off +  3];
625     w1_t[0] = s_userdomain_buf[off +  4];
626     w1_t[1] = s_userdomain_buf[off +  5];
627     w1_t[2] = s_userdomain_buf[off +  6];
628     w1_t[3] = s_userdomain_buf[off +  7];
629     w2_t[0] = s_userdomain_buf[off +  8];
630     w2_t[1] = s_userdomain_buf[off +  9];
631     w2_t[2] = s_userdomain_buf[off + 10];
632     w2_t[3] = s_userdomain_buf[off + 11];
633     w3_t[0] = s_userdomain_buf[off + 12];
634     w3_t[1] = s_userdomain_buf[off + 13];
635     w3_t[2] = (64 + userdomain_len) * 8;
636     w3_t[3] = 0;
637
638     hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
639
640     w0_t[0] = digest[0];
641     w0_t[1] = digest[1];
642     w0_t[2] = digest[2];
643     w0_t[3] = digest[3];
644     w1_t[0] = 0;
645     w1_t[1] = 0;
646     w1_t[2] = 0;
647     w1_t[3] = 0;
648     w2_t[0] = 0;
649     w2_t[1] = 0;
650     w2_t[2] = 0;
651     w2_t[3] = 0;
652     w3_t[0] = 0;
653     w3_t[1] = 0;
654     w3_t[2] = 0;
655     w3_t[3] = 0;
656
657     digest[0] = MD5M_A;
658     digest[1] = MD5M_B;
659     digest[2] = MD5M_C;
660     digest[3] = MD5M_D;
661
662     hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
663
664     for (left = chall_len, off = 0; left >= 56; left -= 64, off += 16)
665     {
666       w0_t[0] = s_chall_buf[off +  0];
667       w0_t[1] = s_chall_buf[off +  1];
668       w0_t[2] = s_chall_buf[off +  2];
669       w0_t[3] = s_chall_buf[off +  3];
670       w1_t[0] = s_chall_buf[off +  4];
671       w1_t[1] = s_chall_buf[off +  5];
672       w1_t[2] = s_chall_buf[off +  6];
673       w1_t[3] = s_chall_buf[off +  7];
674       w2_t[0] = s_chall_buf[off +  8];
675       w2_t[1] = s_chall_buf[off +  9];
676       w2_t[2] = s_chall_buf[off + 10];
677       w2_t[3] = s_chall_buf[off + 11];
678       w3_t[0] = s_chall_buf[off + 12];
679       w3_t[1] = s_chall_buf[off + 13];
680       w3_t[2] = s_chall_buf[off + 14];
681       w3_t[3] = s_chall_buf[off + 15];
682
683       md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
684     }
685
686     w0_t[0] = s_chall_buf[off +  0];
687     w0_t[1] = s_chall_buf[off +  1];
688     w0_t[2] = s_chall_buf[off +  2];
689     w0_t[3] = s_chall_buf[off +  3];
690     w1_t[0] = s_chall_buf[off +  4];
691     w1_t[1] = s_chall_buf[off +  5];
692     w1_t[2] = s_chall_buf[off +  6];
693     w1_t[3] = s_chall_buf[off +  7];
694     w2_t[0] = s_chall_buf[off +  8];
695     w2_t[1] = s_chall_buf[off +  9];
696     w2_t[2] = s_chall_buf[off + 10];
697     w2_t[3] = s_chall_buf[off + 11];
698     w3_t[0] = s_chall_buf[off + 12];
699     w3_t[1] = s_chall_buf[off + 13];
700     w3_t[2] = (64 + chall_len) * 8;
701     w3_t[3] = 0;
702
703     hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
704
705     COMPARE_S_SIMD (digest[0], digest[3], digest[2], digest[1]);
706   }
707 }
708
709 __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)
710 {
711   /**
712    * modifier
713    */
714
715   const u32 gid = get_global_id (0);
716   const u32 lid = get_local_id (0);
717   const u32 lsz = get_local_size (0);
718
719   /**
720    * salt
721    */
722
723   __local u32 s_userdomain_buf[64];
724
725   for (u32 i = lid; i < 64; i += lsz)
726   {
727     s_userdomain_buf[i] = netntlm_bufs[salt_pos].userdomain_buf[i];
728   }
729
730   __local u32 s_chall_buf[256];
731
732   for (u32 i = lid; i < 256; i += lsz)
733   {
734     s_chall_buf[i] = netntlm_bufs[salt_pos].chall_buf[i];
735   }
736
737   barrier (CLK_LOCAL_MEM_FENCE);
738
739   if (gid >= gid_max) return;
740
741   const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
742                            + netntlm_bufs[salt_pos].domain_len;
743
744   const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
745                       + netntlm_bufs[salt_pos].clichall_len;
746
747   /**
748    * base
749    */
750
751   u32 w0[4];
752
753   w0[0] = pws[gid].i[ 0];
754   w0[1] = pws[gid].i[ 1];
755   w0[2] = pws[gid].i[ 2];
756   w0[3] = pws[gid].i[ 3];
757
758   u32 w1[4];
759
760   w1[0] = 0;
761   w1[1] = 0;
762   w1[2] = 0;
763   w1[3] = 0;
764
765   u32 w2[4];
766
767   w2[0] = 0;
768   w2[1] = 0;
769   w2[2] = 0;
770   w2[3] = 0;
771
772   u32 w3[4];
773
774   w3[0] = 0;
775   w3[1] = 0;
776   w3[2] = pws[gid].i[14];
777   w3[3] = 0;
778
779   const u32 pw_len = pws[gid].pw_len;
780
781   /**
782    * main
783    */
784
785   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);
786 }
787
788 __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)
789 {
790   /**
791    * modifier
792    */
793
794   const u32 gid = get_global_id (0);
795   const u32 lid = get_local_id (0);
796   const u32 lsz = get_local_size (0);
797
798   /**
799    * salt
800    */
801
802   __local u32 s_userdomain_buf[64];
803
804   for (u32 i = lid; i < 64; i += lsz)
805   {
806     s_userdomain_buf[i] = netntlm_bufs[salt_pos].userdomain_buf[i];
807   }
808
809   __local u32 s_chall_buf[256];
810
811   for (u32 i = lid; i < 256; i += lsz)
812   {
813     s_chall_buf[i] = netntlm_bufs[salt_pos].chall_buf[i];
814   }
815
816   barrier (CLK_LOCAL_MEM_FENCE);
817
818   if (gid >= gid_max) return;
819
820   const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
821                            + netntlm_bufs[salt_pos].domain_len;
822
823   const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
824                       + netntlm_bufs[salt_pos].clichall_len;
825
826   /**
827    * base
828    */
829
830   u32 w0[4];
831
832   w0[0] = pws[gid].i[ 0];
833   w0[1] = pws[gid].i[ 1];
834   w0[2] = pws[gid].i[ 2];
835   w0[3] = pws[gid].i[ 3];
836
837   u32 w1[4];
838
839   w1[0] = pws[gid].i[ 4];
840   w1[1] = pws[gid].i[ 5];
841   w1[2] = pws[gid].i[ 6];
842   w1[3] = pws[gid].i[ 7];
843
844   u32 w2[4];
845
846   w2[0] = 0;
847   w2[1] = 0;
848   w2[2] = 0;
849   w2[3] = 0;
850
851   u32 w3[4];
852
853   w3[0] = 0;
854   w3[1] = 0;
855   w3[2] = pws[gid].i[14];
856   w3[3] = 0;
857
858   const u32 pw_len = pws[gid].pw_len;
859
860   /**
861    * main
862    */
863
864   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);
865 }
866
867 __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)
868 {
869 }
870
871 __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)
872 {
873   /**
874    * modifier
875    */
876
877   const u32 gid = get_global_id (0);
878   const u32 lid = get_local_id (0);
879   const u32 lsz = get_local_size (0);
880
881   /**
882    * salt
883    */
884
885   __local u32 s_userdomain_buf[64];
886
887   for (u32 i = lid; i < 64; i += lsz)
888   {
889     s_userdomain_buf[i] = netntlm_bufs[salt_pos].userdomain_buf[i];
890   }
891
892   __local u32 s_chall_buf[256];
893
894   for (u32 i = lid; i < 256; i += lsz)
895   {
896     s_chall_buf[i] = netntlm_bufs[salt_pos].chall_buf[i];
897   }
898
899   barrier (CLK_LOCAL_MEM_FENCE);
900
901   if (gid >= gid_max) return;
902
903   const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
904                            + netntlm_bufs[salt_pos].domain_len;
905
906   const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
907                       + netntlm_bufs[salt_pos].clichall_len;
908
909   /**
910    * base
911    */
912
913   u32 w0[4];
914
915   w0[0] = pws[gid].i[ 0];
916   w0[1] = pws[gid].i[ 1];
917   w0[2] = pws[gid].i[ 2];
918   w0[3] = pws[gid].i[ 3];
919
920   u32 w1[4];
921
922   w1[0] = 0;
923   w1[1] = 0;
924   w1[2] = 0;
925   w1[3] = 0;
926
927   u32 w2[4];
928
929   w2[0] = 0;
930   w2[1] = 0;
931   w2[2] = 0;
932   w2[3] = 0;
933
934   u32 w3[4];
935
936   w3[0] = 0;
937   w3[1] = 0;
938   w3[2] = pws[gid].i[14];
939   w3[3] = 0;
940
941   const u32 pw_len = pws[gid].pw_len;
942
943   /**
944    * main
945    */
946
947   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);
948 }
949
950 __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)
951 {
952   /**
953    * modifier
954    */
955
956   const u32 gid = get_global_id (0);
957   const u32 lid = get_local_id (0);
958   const u32 lsz = get_local_size (0);
959
960   /**
961    * salt
962    */
963
964   __local u32 s_userdomain_buf[64];
965
966   for (u32 i = lid; i < 64; i += lsz)
967   {
968     s_userdomain_buf[i] = netntlm_bufs[salt_pos].userdomain_buf[i];
969   }
970
971   __local u32 s_chall_buf[256];
972
973   for (u32 i = lid; i < 256; i += lsz)
974   {
975     s_chall_buf[i] = netntlm_bufs[salt_pos].chall_buf[i];
976   }
977
978   barrier (CLK_LOCAL_MEM_FENCE);
979
980   if (gid >= gid_max) return;
981
982   const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
983                            + netntlm_bufs[salt_pos].domain_len;
984
985   const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
986                       + netntlm_bufs[salt_pos].clichall_len;
987
988   /**
989    * base
990    */
991
992   u32 w0[4];
993
994   w0[0] = pws[gid].i[ 0];
995   w0[1] = pws[gid].i[ 1];
996   w0[2] = pws[gid].i[ 2];
997   w0[3] = pws[gid].i[ 3];
998
999   u32 w1[4];
1000
1001   w1[0] = pws[gid].i[ 4];
1002   w1[1] = pws[gid].i[ 5];
1003   w1[2] = pws[gid].i[ 6];
1004   w1[3] = pws[gid].i[ 7];
1005
1006   u32 w2[4];
1007
1008   w2[0] = 0;
1009   w2[1] = 0;
1010   w2[2] = 0;
1011   w2[3] = 0;
1012
1013   u32 w3[4];
1014
1015   w3[0] = 0;
1016   w3[1] = 0;
1017   w3[2] = pws[gid].i[14];
1018   w3[3] = 0;
1019
1020   const u32 pw_len = pws[gid].pw_len;
1021
1022   /**
1023    * main
1024    */
1025
1026   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);
1027 }
1028
1029 __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)
1030 {
1031 }