Merge pull request #241 from philsmd/master
[hashcat.git] / OpenCL / m07700_a0.cl
1 /**
2  * Author......: Jens Steube <jens.steube@gmail.com>
3  * License.....: MIT
4  */
5
6 #define _SAPB_
7
8 #include "include/constants.h"
9 #include "include/kernel_vendor.h"
10
11 #define DGST_R0 0
12 #define DGST_R1 1
13 #define DGST_R2 2
14 #define DGST_R3 3
15
16 #include "include/kernel_functions.c"
17 #include "OpenCL/types_ocl.c"
18 #include "OpenCL/common.c"
19 #include "include/rp_kernel.h"
20 #include "OpenCL/rp.c"
21
22 #define COMPARE_S "OpenCL/check_single_comp4.c"
23 #define COMPARE_M "OpenCL/check_multi_comp4.c"
24
25 #define GETCHAR(a,p)  (((a)[(p) / 4] >> (((p) & 3) * 8)) & 0xff)
26 #define PUTCHAR(a,p,c) ((a)[(p) / 4] = (((a)[(p) / 4] & ~(0xff << (((p) & 3) * 8))) | ((c) << (((p) & 3) * 8))))
27
28 #define SETSHIFTEDINT(a,n,v)        \
29 {                                   \
30   const u32 s = ((n) & 3) * 8;     \
31   const u64 x = (u64) (v) << s; \
32   (a)[((n)/4)+0] &= ~(0xff << ((n & 3) * 8)); \
33   (a)[((n)/4)+0] |= x;              \
34   (a)[((n)/4)+1]  = x >> 32;        \
35 }
36
37 __constant u32 sapb_trans_tbl[256] =
38 {
39   // first value hack for 0 byte as part of an optimization
40   0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
41   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
42   0x3f, 0x40, 0x41, 0x50, 0x43, 0x44, 0x45, 0x4b, 0x47, 0x48, 0x4d, 0x4e, 0x54, 0x51, 0x53, 0x46,
43   0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x56, 0x55, 0x5c, 0x49, 0x5d, 0x4a,
44   0x42, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
45   0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x58, 0x5b, 0x59, 0xff, 0x52,
46   0x4c, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
47   0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x57, 0x5e, 0x5a, 0x4f, 0xff,
48   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
49   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
50   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
51   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
52   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
53   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
54   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
55   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
56 };
57
58 __constant u32 bcodeArray[48] =
59 {
60   0x14, 0x77, 0xf3, 0xd4, 0xbb, 0x71, 0x23, 0xd0, 0x03, 0xff, 0x47, 0x93, 0x55, 0xaa, 0x66, 0x91,
61   0xf2, 0x88, 0x6b, 0x99, 0xbf, 0xcb, 0x32, 0x1a, 0x19, 0xd9, 0xa7, 0x82, 0x22, 0x49, 0xa2, 0x51,
62   0xe2, 0xb7, 0x33, 0x71, 0x8b, 0x9f, 0x5d, 0x01, 0x44, 0x70, 0xae, 0x11, 0xef, 0x28, 0xf0, 0x0d
63 };
64
65 static u32 sapb_trans (const u32 in)
66 {
67   u32 out = 0;
68
69   out |= (sapb_trans_tbl[(in >>  0) & 0xff]) <<  0;
70   out |= (sapb_trans_tbl[(in >>  8) & 0xff]) <<  8;
71   out |= (sapb_trans_tbl[(in >> 16) & 0xff]) << 16;
72   out |= (sapb_trans_tbl[(in >> 24) & 0xff]) << 24;
73
74   return out;
75 }
76
77 static u32 walld0rf_magic (const u32 w0[4], const u32 pw_len, const u32 salt_buf0[4], const u32 salt_len, const u32 a, const u32 b, const u32 c, const u32 d, u32 t[16])
78 {
79   t[ 0] = 0;
80   t[ 1] = 0;
81   t[ 2] = 0;
82   t[ 3] = 0;
83   t[ 4] = 0;
84   t[ 5] = 0;
85   t[ 6] = 0;
86   t[ 7] = 0;
87   t[ 8] = 0;
88   t[ 9] = 0;
89   t[10] = 0;
90   t[11] = 0;
91   t[12] = 0;
92   t[13] = 0;
93   t[14] = 0;
94   t[15] = 0;
95
96   u32 sum20 = ((a >> 24) & 3)
97              + ((a >> 16) & 3)
98              + ((a >>  8) & 3)
99              + ((a >>  0) & 3)
100              + ((b >>  8) & 3);
101
102   sum20 |= 0x20;
103
104   const u32 w[2] = { w0[0], w0[1] };
105
106   const u32 s[3] = { salt_buf0[0], salt_buf0[1], salt_buf0[2] };
107
108   u32 saved_key[4] = { a, b, c, d };
109
110   u32 i1 = 0;
111   u32 i2 = 0;
112   u32 i3 = 0;
113
114   // we can assume this because the password must be at least 3
115   // and the username must be at least 1 so we can save the if ()
116
117   u32 t0 = 0;
118
119   if ((d >> 24) & 1)
120   {
121     t0 |= bcodeArray[47] <<  0;
122     t0 |= (w[0] & 0xff)  <<  8;
123     t0 |= (s[0] & 0xff)  << 16;
124     t0 |= bcodeArray[ 1] << 24;
125
126     i1 = 1;
127     i2 = 5;
128     i3 = 1;
129   }
130   else
131   {
132     t0 |= (w[0] & 0xff)  <<  0;
133     t0 |= (s[0] & 0xff)  <<  8;
134     t0 |= bcodeArray[ 0] << 16;
135
136     i1 = 1;
137     i2 = 4;
138     i3 = 1;
139   }
140
141   t[0] = t0;
142
143   // because the following code can increase i2 by a maximum of 5,
144   // there is an overflow potential of 4 before it comes to the next test for i2 >= sum20
145   // we need to truncate in that case
146
147   while ((i1 < pw_len) && (i3 < salt_len))
148   {
149     u32 x0 = 0;
150
151     u32 i2_sav = i2;
152
153     if (GETCHAR (saved_key, 15 - i1) & 1)
154     {
155       x0 |= bcodeArray[48 - 1 - i1]  <<  0; i2++;
156       x0 |= GETCHAR (w, i1)          <<  8; i2++; i1++;
157       x0 |= GETCHAR (s, i3)          << 16; i2++; i3++;
158       x0 |= bcodeArray[i2 - i1 - i3] << 24; i2++; i2++;
159     }
160     else
161     {
162       x0 |= GETCHAR (w, i1)          <<  0; i2++; i1++;
163       x0 |= GETCHAR (s, i3)          <<  8; i2++; i3++;
164       x0 |= bcodeArray[i2 - i1 - i3] << 16; i2++; i2++;
165     }
166
167     SETSHIFTEDINT (t, i2_sav, x0);
168
169     if (i2 >= sum20)
170     {
171       return sum20;
172     }
173   }
174
175   while ((i1 < pw_len) || (i3 < salt_len))
176   {
177     if (i1 < pw_len) // max 8
178     {
179       if (GETCHAR (saved_key, 15 - i1) & 1)
180       {
181         PUTCHAR (t, i2, bcodeArray[48 - 1 - i1]);
182
183         i2++;
184       }
185
186       PUTCHAR (t, i2, GETCHAR (w, i1));
187
188       i1++;
189       i2++;
190     }
191     else
192     {
193       PUTCHAR (t, i2, GETCHAR (s, i3));
194
195       i2++;
196       i3++;
197     }
198
199     PUTCHAR (t, i2, bcodeArray[i2 - i1 - i3]);
200
201     i2++;
202     i2++;
203
204     if (i2 >= sum20)
205     {
206       return sum20;
207     }
208   }
209
210   while (i2 < sum20)
211   {
212     PUTCHAR (t, i2, bcodeArray[i2 - i1 - i3]);
213
214     i2++;
215     i2++;
216   }
217
218   return sum20;
219 }
220
221 __kernel void m07700_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 void *esalt_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
222 {
223   /**
224    * modifier
225    */
226
227   const u32 lid = get_local_id (0);
228
229   /**
230    * base
231    */
232
233   const u32 gid = get_global_id (0);
234
235   if (gid >= gid_max) return;
236
237   u32 pw_buf0[4];
238
239   pw_buf0[0] = pws[gid].i[ 0];
240   pw_buf0[1] = pws[gid].i[ 1];
241   pw_buf0[2] = 0;
242   pw_buf0[3] = 0;
243
244   u32 pw_buf1[4];
245
246   pw_buf1[0] = 0;
247   pw_buf1[1] = 0;
248   pw_buf1[2] = 0;
249   pw_buf1[3] = 0;
250
251   const u32 pw_len = pws[gid].pw_len;
252
253   /**
254    * salt
255    */
256
257   u32 salt_buf0[4];
258
259   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[0];
260   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[1];
261   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[2];
262   salt_buf0[3] = 0;
263
264   const u32 salt_len = salt_bufs[salt_pos].salt_len;
265
266   salt_buf0[0] = sapb_trans (salt_buf0[0]);
267   salt_buf0[1] = sapb_trans (salt_buf0[1]);
268   salt_buf0[2] = sapb_trans (salt_buf0[2]);
269
270   /**
271    * loop
272    */
273
274   for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
275   {
276     u32 w0[4];
277
278     w0[0] = pw_buf0[0];
279     w0[1] = pw_buf0[1];
280     w0[2] = 0;
281     w0[3] = 0;
282
283     u32 w1[4];
284
285     w1[0] = 0;
286     w1[1] = 0;
287     w1[2] = 0;
288     w1[3] = 0;
289
290     u32 w2[4];
291
292     w2[0] = 0;
293     w2[1] = 0;
294     w2[2] = 0;
295     w2[3] = 0;
296
297     u32 w3[4];
298
299     w3[0] = 0;
300     w3[1] = 0;
301     w3[2] = 0;
302     w3[3] = 0;
303
304     const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
305
306     if (out_len > 8) continue; // otherwise it overflows in waldorf function
307
308     w0[0] = sapb_trans (w0[0]);
309     w0[1] = sapb_trans (w0[1]);
310
311     /**
312      * append salt
313      */
314
315     u32 s0[4];
316
317     s0[0] = salt_buf0[0];
318     s0[1] = salt_buf0[1];
319     s0[2] = salt_buf0[2];
320     s0[3] = 0;
321
322     u32 s1[4];
323
324     s1[0] = 0;
325     s1[1] = 0;
326     s1[2] = 0;
327     s1[3] = 0;
328
329     u32 s2[4];
330
331     s2[0] = 0;
332     s2[1] = 0;
333     s2[2] = 0;
334     s2[3] = 0;
335
336     u32 s3[4];
337
338     s3[0] = 0;
339     s3[1] = 0;
340     s3[2] = 0;
341     s3[3] = 0;
342
343     switch_buffer_by_offset_le (s0, s1, s2, s3, out_len);
344
345     const u32 pw_salt_len = out_len + salt_len;
346
347     u32 t[16];
348
349     t[ 0] = s0[0] | w0[0];
350     t[ 1] = s0[1] | w0[1];
351     t[ 2] = s0[2];
352     t[ 3] = s0[3];
353     t[ 4] = s1[0];
354     t[ 5] = 0;
355     t[ 6] = 0;
356     t[ 7] = 0;
357     t[ 8] = 0;
358     t[ 9] = 0;
359     t[10] = 0;
360     t[11] = 0;
361     t[12] = 0;
362     t[13] = 0;
363     t[14] = pw_salt_len * 8;
364     t[15] = 0;
365
366     PUTCHAR (t, pw_salt_len, 0x80);
367
368     /**
369      * md5
370      */
371
372     u32 a = MD5M_A;
373     u32 b = MD5M_B;
374     u32 c = MD5M_C;
375     u32 d = MD5M_D;
376
377     MD5_STEP (MD5_Fo, a, b, c, d, t[ 0], MD5C00, MD5S00);
378     MD5_STEP (MD5_Fo, d, a, b, c, t[ 1], MD5C01, MD5S01);
379     MD5_STEP (MD5_Fo, c, d, a, b, t[ 2], MD5C02, MD5S02);
380     MD5_STEP (MD5_Fo, b, c, d, a, t[ 3], MD5C03, MD5S03);
381     MD5_STEP (MD5_Fo, a, b, c, d, t[ 4], MD5C04, MD5S00);
382     MD5_STEP (MD5_Fo, d, a, b, c, t[ 5], MD5C05, MD5S01);
383     MD5_STEP (MD5_Fo, c, d, a, b, t[ 6], MD5C06, MD5S02);
384     MD5_STEP (MD5_Fo, b, c, d, a, t[ 7], MD5C07, MD5S03);
385     MD5_STEP (MD5_Fo, a, b, c, d, t[ 8], MD5C08, MD5S00);
386     MD5_STEP (MD5_Fo, d, a, b, c, t[ 9], MD5C09, MD5S01);
387     MD5_STEP (MD5_Fo, c, d, a, b, t[10], MD5C0a, MD5S02);
388     MD5_STEP (MD5_Fo, b, c, d, a, t[11], MD5C0b, MD5S03);
389     MD5_STEP (MD5_Fo, a, b, c, d, t[12], MD5C0c, MD5S00);
390     MD5_STEP (MD5_Fo, d, a, b, c, t[13], MD5C0d, MD5S01);
391     MD5_STEP (MD5_Fo, c, d, a, b, t[14], MD5C0e, MD5S02);
392     MD5_STEP (MD5_Fo, b, c, d, a, t[15], MD5C0f, MD5S03);
393
394     MD5_STEP (MD5_Go, a, b, c, d, t[ 1], MD5C10, MD5S10);
395     MD5_STEP (MD5_Go, d, a, b, c, t[ 6], MD5C11, MD5S11);
396     MD5_STEP (MD5_Go, c, d, a, b, t[11], MD5C12, MD5S12);
397     MD5_STEP (MD5_Go, b, c, d, a, t[ 0], MD5C13, MD5S13);
398     MD5_STEP (MD5_Go, a, b, c, d, t[ 5], MD5C14, MD5S10);
399     MD5_STEP (MD5_Go, d, a, b, c, t[10], MD5C15, MD5S11);
400     MD5_STEP (MD5_Go, c, d, a, b, t[15], MD5C16, MD5S12);
401     MD5_STEP (MD5_Go, b, c, d, a, t[ 4], MD5C17, MD5S13);
402     MD5_STEP (MD5_Go, a, b, c, d, t[ 9], MD5C18, MD5S10);
403     MD5_STEP (MD5_Go, d, a, b, c, t[14], MD5C19, MD5S11);
404     MD5_STEP (MD5_Go, c, d, a, b, t[ 3], MD5C1a, MD5S12);
405     MD5_STEP (MD5_Go, b, c, d, a, t[ 8], MD5C1b, MD5S13);
406     MD5_STEP (MD5_Go, a, b, c, d, t[13], MD5C1c, MD5S10);
407     MD5_STEP (MD5_Go, d, a, b, c, t[ 2], MD5C1d, MD5S11);
408     MD5_STEP (MD5_Go, c, d, a, b, t[ 7], MD5C1e, MD5S12);
409     MD5_STEP (MD5_Go, b, c, d, a, t[12], MD5C1f, MD5S13);
410
411     MD5_STEP (MD5_H , a, b, c, d, t[ 5], MD5C20, MD5S20);
412     MD5_STEP (MD5_H , d, a, b, c, t[ 8], MD5C21, MD5S21);
413     MD5_STEP (MD5_H , c, d, a, b, t[11], MD5C22, MD5S22);
414     MD5_STEP (MD5_H , b, c, d, a, t[14], MD5C23, MD5S23);
415     MD5_STEP (MD5_H , a, b, c, d, t[ 1], MD5C24, MD5S20);
416     MD5_STEP (MD5_H , d, a, b, c, t[ 4], MD5C25, MD5S21);
417     MD5_STEP (MD5_H , c, d, a, b, t[ 7], MD5C26, MD5S22);
418     MD5_STEP (MD5_H , b, c, d, a, t[10], MD5C27, MD5S23);
419     MD5_STEP (MD5_H , a, b, c, d, t[13], MD5C28, MD5S20);
420     MD5_STEP (MD5_H , d, a, b, c, t[ 0], MD5C29, MD5S21);
421     MD5_STEP (MD5_H , c, d, a, b, t[ 3], MD5C2a, MD5S22);
422     MD5_STEP (MD5_H , b, c, d, a, t[ 6], MD5C2b, MD5S23);
423     MD5_STEP (MD5_H , a, b, c, d, t[ 9], MD5C2c, MD5S20);
424     MD5_STEP (MD5_H , d, a, b, c, t[12], MD5C2d, MD5S21);
425     MD5_STEP (MD5_H , c, d, a, b, t[15], MD5C2e, MD5S22);
426     MD5_STEP (MD5_H , b, c, d, a, t[ 2], MD5C2f, MD5S23);
427
428     MD5_STEP (MD5_I , a, b, c, d, t[ 0], MD5C30, MD5S30);
429     MD5_STEP (MD5_I , d, a, b, c, t[ 7], MD5C31, MD5S31);
430     MD5_STEP (MD5_I , c, d, a, b, t[14], MD5C32, MD5S32);
431     MD5_STEP (MD5_I , b, c, d, a, t[ 5], MD5C33, MD5S33);
432     MD5_STEP (MD5_I , a, b, c, d, t[12], MD5C34, MD5S30);
433     MD5_STEP (MD5_I , d, a, b, c, t[ 3], MD5C35, MD5S31);
434     MD5_STEP (MD5_I , c, d, a, b, t[10], MD5C36, MD5S32);
435     MD5_STEP (MD5_I , b, c, d, a, t[ 1], MD5C37, MD5S33);
436     MD5_STEP (MD5_I , a, b, c, d, t[ 8], MD5C38, MD5S30);
437     MD5_STEP (MD5_I , d, a, b, c, t[15], MD5C39, MD5S31);
438     MD5_STEP (MD5_I , c, d, a, b, t[ 6], MD5C3a, MD5S32);
439     MD5_STEP (MD5_I , b, c, d, a, t[13], MD5C3b, MD5S33);
440     MD5_STEP (MD5_I , a, b, c, d, t[ 4], MD5C3c, MD5S30);
441     MD5_STEP (MD5_I , d, a, b, c, t[11], MD5C3d, MD5S31);
442     MD5_STEP (MD5_I , c, d, a, b, t[ 2], MD5C3e, MD5S32);
443     MD5_STEP (MD5_I , b, c, d, a, t[ 9], MD5C3f, MD5S33);
444
445     a += MD5M_A;
446     b += MD5M_B;
447     c += MD5M_C;
448     d += MD5M_D;
449
450     const u32 sum20 = walld0rf_magic (w0, out_len, salt_buf0, salt_len, a, b, c, d, t);
451
452     SETSHIFTEDINT (t, sum20, 0x80);
453
454     t[14] = sum20 * 8;
455
456     a = MD5M_A;
457     b = MD5M_B;
458     c = MD5M_C;
459     d = MD5M_D;
460
461     MD5_STEP (MD5_Fo, a, b, c, d, t[ 0], MD5C00, MD5S00);
462     MD5_STEP (MD5_Fo, d, a, b, c, t[ 1], MD5C01, MD5S01);
463     MD5_STEP (MD5_Fo, c, d, a, b, t[ 2], MD5C02, MD5S02);
464     MD5_STEP (MD5_Fo, b, c, d, a, t[ 3], MD5C03, MD5S03);
465     MD5_STEP (MD5_Fo, a, b, c, d, t[ 4], MD5C04, MD5S00);
466     MD5_STEP (MD5_Fo, d, a, b, c, t[ 5], MD5C05, MD5S01);
467     MD5_STEP (MD5_Fo, c, d, a, b, t[ 6], MD5C06, MD5S02);
468     MD5_STEP (MD5_Fo, b, c, d, a, t[ 7], MD5C07, MD5S03);
469     MD5_STEP (MD5_Fo, a, b, c, d, t[ 8], MD5C08, MD5S00);
470     MD5_STEP (MD5_Fo, d, a, b, c, t[ 9], MD5C09, MD5S01);
471     MD5_STEP (MD5_Fo, c, d, a, b, t[10], MD5C0a, MD5S02);
472     MD5_STEP (MD5_Fo, b, c, d, a, t[11], MD5C0b, MD5S03);
473     MD5_STEP (MD5_Fo, a, b, c, d, t[12], MD5C0c, MD5S00);
474     MD5_STEP (MD5_Fo, d, a, b, c, t[13], MD5C0d, MD5S01);
475     MD5_STEP (MD5_Fo, c, d, a, b, t[14], MD5C0e, MD5S02);
476     MD5_STEP (MD5_Fo, b, c, d, a, t[15], MD5C0f, MD5S03);
477
478     MD5_STEP (MD5_Go, a, b, c, d, t[ 1], MD5C10, MD5S10);
479     MD5_STEP (MD5_Go, d, a, b, c, t[ 6], MD5C11, MD5S11);
480     MD5_STEP (MD5_Go, c, d, a, b, t[11], MD5C12, MD5S12);
481     MD5_STEP (MD5_Go, b, c, d, a, t[ 0], MD5C13, MD5S13);
482     MD5_STEP (MD5_Go, a, b, c, d, t[ 5], MD5C14, MD5S10);
483     MD5_STEP (MD5_Go, d, a, b, c, t[10], MD5C15, MD5S11);
484     MD5_STEP (MD5_Go, c, d, a, b, t[15], MD5C16, MD5S12);
485     MD5_STEP (MD5_Go, b, c, d, a, t[ 4], MD5C17, MD5S13);
486     MD5_STEP (MD5_Go, a, b, c, d, t[ 9], MD5C18, MD5S10);
487     MD5_STEP (MD5_Go, d, a, b, c, t[14], MD5C19, MD5S11);
488     MD5_STEP (MD5_Go, c, d, a, b, t[ 3], MD5C1a, MD5S12);
489     MD5_STEP (MD5_Go, b, c, d, a, t[ 8], MD5C1b, MD5S13);
490     MD5_STEP (MD5_Go, a, b, c, d, t[13], MD5C1c, MD5S10);
491     MD5_STEP (MD5_Go, d, a, b, c, t[ 2], MD5C1d, MD5S11);
492     MD5_STEP (MD5_Go, c, d, a, b, t[ 7], MD5C1e, MD5S12);
493     MD5_STEP (MD5_Go, b, c, d, a, t[12], MD5C1f, MD5S13);
494
495     MD5_STEP (MD5_H , a, b, c, d, t[ 5], MD5C20, MD5S20);
496     MD5_STEP (MD5_H , d, a, b, c, t[ 8], MD5C21, MD5S21);
497     MD5_STEP (MD5_H , c, d, a, b, t[11], MD5C22, MD5S22);
498     MD5_STEP (MD5_H , b, c, d, a, t[14], MD5C23, MD5S23);
499     MD5_STEP (MD5_H , a, b, c, d, t[ 1], MD5C24, MD5S20);
500     MD5_STEP (MD5_H , d, a, b, c, t[ 4], MD5C25, MD5S21);
501     MD5_STEP (MD5_H , c, d, a, b, t[ 7], MD5C26, MD5S22);
502     MD5_STEP (MD5_H , b, c, d, a, t[10], MD5C27, MD5S23);
503     MD5_STEP (MD5_H , a, b, c, d, t[13], MD5C28, MD5S20);
504     MD5_STEP (MD5_H , d, a, b, c, t[ 0], MD5C29, MD5S21);
505     MD5_STEP (MD5_H , c, d, a, b, t[ 3], MD5C2a, MD5S22);
506     MD5_STEP (MD5_H , b, c, d, a, t[ 6], MD5C2b, MD5S23);
507     MD5_STEP (MD5_H , a, b, c, d, t[ 9], MD5C2c, MD5S20);
508     MD5_STEP (MD5_H , d, a, b, c, t[12], MD5C2d, MD5S21);
509     MD5_STEP (MD5_H , c, d, a, b, t[15], MD5C2e, MD5S22);
510     MD5_STEP (MD5_H , b, c, d, a, t[ 2], MD5C2f, MD5S23);
511
512     MD5_STEP (MD5_I , a, b, c, d, t[ 0], MD5C30, MD5S30);
513     MD5_STEP (MD5_I , d, a, b, c, t[ 7], MD5C31, MD5S31);
514     MD5_STEP (MD5_I , c, d, a, b, t[14], MD5C32, MD5S32);
515     MD5_STEP (MD5_I , b, c, d, a, t[ 5], MD5C33, MD5S33);
516     MD5_STEP (MD5_I , a, b, c, d, t[12], MD5C34, MD5S30);
517     MD5_STEP (MD5_I , d, a, b, c, t[ 3], MD5C35, MD5S31);
518     MD5_STEP (MD5_I , c, d, a, b, t[10], MD5C36, MD5S32);
519     MD5_STEP (MD5_I , b, c, d, a, t[ 1], MD5C37, MD5S33);
520     MD5_STEP (MD5_I , a, b, c, d, t[ 8], MD5C38, MD5S30);
521     MD5_STEP (MD5_I , d, a, b, c, t[15], MD5C39, MD5S31);
522     MD5_STEP (MD5_I , c, d, a, b, t[ 6], MD5C3a, MD5S32);
523     MD5_STEP (MD5_I , b, c, d, a, t[13], MD5C3b, MD5S33);
524     MD5_STEP (MD5_I , a, b, c, d, t[ 4], MD5C3c, MD5S30);
525     MD5_STEP (MD5_I , d, a, b, c, t[11], MD5C3d, MD5S31);
526     MD5_STEP (MD5_I , c, d, a, b, t[ 2], MD5C3e, MD5S32);
527     MD5_STEP (MD5_I , b, c, d, a, t[ 9], MD5C3f, MD5S33);
528
529     a += MD5M_A;
530     b += MD5M_B;
531     c += MD5M_C;
532     d += MD5M_D;
533
534     a ^= c;
535     b ^= d;
536
537     const u32 r0 = a;
538     const u32 r1 = b;
539     const u32 r2 = 0;
540     const u32 r3 = 0;
541
542     #include COMPARE_M
543   }
544 }
545
546 __kernel void m07700_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 void *esalt_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
547 {
548 }
549
550 __kernel void m07700_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 void *esalt_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
551 {
552 }
553
554 __kernel void m07700_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 void *esalt_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
555 {
556   /**
557    * modifier
558    */
559
560   const u32 lid = get_local_id (0);
561
562   /**
563    * base
564    */
565
566   const u32 gid = get_global_id (0);
567
568   if (gid >= gid_max) return;
569
570   u32 pw_buf0[4];
571
572   pw_buf0[0] = pws[gid].i[ 0];
573   pw_buf0[1] = pws[gid].i[ 1];
574   pw_buf0[2] = 0;
575   pw_buf0[3] = 0;
576
577   u32 pw_buf1[4];
578
579   pw_buf1[0] = 0;
580   pw_buf1[1] = 0;
581   pw_buf1[2] = 0;
582   pw_buf1[3] = 0;
583
584   const u32 pw_len = pws[gid].pw_len;
585
586   /**
587    * salt
588    */
589
590   u32 salt_buf0[4];
591
592   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[0];
593   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[1];
594   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[2];
595   salt_buf0[3] = 0;
596
597   const u32 salt_len = salt_bufs[salt_pos].salt_len;
598
599   salt_buf0[0] = sapb_trans (salt_buf0[0]);
600   salt_buf0[1] = sapb_trans (salt_buf0[1]);
601   salt_buf0[2] = sapb_trans (salt_buf0[2]);
602
603   /**
604    * digest
605    */
606
607   const u32 search[4] =
608   {
609     digests_buf[digests_offset].digest_buf[DGST_R0],
610     digests_buf[digests_offset].digest_buf[DGST_R1],
611     digests_buf[digests_offset].digest_buf[DGST_R2],
612     digests_buf[digests_offset].digest_buf[DGST_R3]
613   };
614
615   /**
616    * loop
617    */
618
619   for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
620   {
621     u32 w0[4];
622
623     w0[0] = pw_buf0[0];
624     w0[1] = pw_buf0[1];
625     w0[2] = 0;
626     w0[3] = 0;
627
628     u32 w1[4];
629
630     w1[0] = 0;
631     w1[1] = 0;
632     w1[2] = 0;
633     w1[3] = 0;
634
635     u32 w2[4];
636
637     w2[0] = 0;
638     w2[1] = 0;
639     w2[2] = 0;
640     w2[3] = 0;
641
642     u32 w3[4];
643
644     w3[0] = 0;
645     w3[1] = 0;
646     w3[2] = 0;
647     w3[3] = 0;
648
649     const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
650
651     if (out_len > 8) continue; // otherwise it overflows in waldorf function
652
653     w0[0] = sapb_trans (w0[0]);
654     w0[1] = sapb_trans (w0[1]);
655
656     /**
657      * append salt
658      */
659
660     u32 s0[4];
661
662     s0[0] = salt_buf0[0];
663     s0[1] = salt_buf0[1];
664     s0[2] = salt_buf0[2];
665     s0[3] = 0;
666
667     u32 s1[4];
668
669     s1[0] = 0;
670     s1[1] = 0;
671     s1[2] = 0;
672     s1[3] = 0;
673
674     u32 s2[4];
675
676     s2[0] = 0;
677     s2[1] = 0;
678     s2[2] = 0;
679     s2[3] = 0;
680
681     u32 s3[4];
682
683     s3[0] = 0;
684     s3[1] = 0;
685     s3[2] = 0;
686     s3[3] = 0;
687
688     switch_buffer_by_offset_le (s0, s1, s2, s3, out_len);
689
690     const u32 pw_salt_len = out_len + salt_len;
691
692     u32 t[16];
693
694     t[ 0] = s0[0] | w0[0];
695     t[ 1] = s0[1] | w0[1];
696     t[ 2] = s0[2];
697     t[ 3] = s0[3];
698     t[ 4] = s1[0];
699     t[ 5] = 0;
700     t[ 6] = 0;
701     t[ 7] = 0;
702     t[ 8] = 0;
703     t[ 9] = 0;
704     t[10] = 0;
705     t[11] = 0;
706     t[12] = 0;
707     t[13] = 0;
708     t[14] = pw_salt_len * 8;
709     t[15] = 0;
710
711     PUTCHAR (t, pw_salt_len, 0x80);
712
713     /**
714      * md5
715      */
716
717     u32 a = MD5M_A;
718     u32 b = MD5M_B;
719     u32 c = MD5M_C;
720     u32 d = MD5M_D;
721
722     MD5_STEP (MD5_Fo, a, b, c, d, t[ 0], MD5C00, MD5S00);
723     MD5_STEP (MD5_Fo, d, a, b, c, t[ 1], MD5C01, MD5S01);
724     MD5_STEP (MD5_Fo, c, d, a, b, t[ 2], MD5C02, MD5S02);
725     MD5_STEP (MD5_Fo, b, c, d, a, t[ 3], MD5C03, MD5S03);
726     MD5_STEP (MD5_Fo, a, b, c, d, t[ 4], MD5C04, MD5S00);
727     MD5_STEP (MD5_Fo, d, a, b, c, t[ 5], MD5C05, MD5S01);
728     MD5_STEP (MD5_Fo, c, d, a, b, t[ 6], MD5C06, MD5S02);
729     MD5_STEP (MD5_Fo, b, c, d, a, t[ 7], MD5C07, MD5S03);
730     MD5_STEP (MD5_Fo, a, b, c, d, t[ 8], MD5C08, MD5S00);
731     MD5_STEP (MD5_Fo, d, a, b, c, t[ 9], MD5C09, MD5S01);
732     MD5_STEP (MD5_Fo, c, d, a, b, t[10], MD5C0a, MD5S02);
733     MD5_STEP (MD5_Fo, b, c, d, a, t[11], MD5C0b, MD5S03);
734     MD5_STEP (MD5_Fo, a, b, c, d, t[12], MD5C0c, MD5S00);
735     MD5_STEP (MD5_Fo, d, a, b, c, t[13], MD5C0d, MD5S01);
736     MD5_STEP (MD5_Fo, c, d, a, b, t[14], MD5C0e, MD5S02);
737     MD5_STEP (MD5_Fo, b, c, d, a, t[15], MD5C0f, MD5S03);
738
739     MD5_STEP (MD5_Go, a, b, c, d, t[ 1], MD5C10, MD5S10);
740     MD5_STEP (MD5_Go, d, a, b, c, t[ 6], MD5C11, MD5S11);
741     MD5_STEP (MD5_Go, c, d, a, b, t[11], MD5C12, MD5S12);
742     MD5_STEP (MD5_Go, b, c, d, a, t[ 0], MD5C13, MD5S13);
743     MD5_STEP (MD5_Go, a, b, c, d, t[ 5], MD5C14, MD5S10);
744     MD5_STEP (MD5_Go, d, a, b, c, t[10], MD5C15, MD5S11);
745     MD5_STEP (MD5_Go, c, d, a, b, t[15], MD5C16, MD5S12);
746     MD5_STEP (MD5_Go, b, c, d, a, t[ 4], MD5C17, MD5S13);
747     MD5_STEP (MD5_Go, a, b, c, d, t[ 9], MD5C18, MD5S10);
748     MD5_STEP (MD5_Go, d, a, b, c, t[14], MD5C19, MD5S11);
749     MD5_STEP (MD5_Go, c, d, a, b, t[ 3], MD5C1a, MD5S12);
750     MD5_STEP (MD5_Go, b, c, d, a, t[ 8], MD5C1b, MD5S13);
751     MD5_STEP (MD5_Go, a, b, c, d, t[13], MD5C1c, MD5S10);
752     MD5_STEP (MD5_Go, d, a, b, c, t[ 2], MD5C1d, MD5S11);
753     MD5_STEP (MD5_Go, c, d, a, b, t[ 7], MD5C1e, MD5S12);
754     MD5_STEP (MD5_Go, b, c, d, a, t[12], MD5C1f, MD5S13);
755
756     MD5_STEP (MD5_H , a, b, c, d, t[ 5], MD5C20, MD5S20);
757     MD5_STEP (MD5_H , d, a, b, c, t[ 8], MD5C21, MD5S21);
758     MD5_STEP (MD5_H , c, d, a, b, t[11], MD5C22, MD5S22);
759     MD5_STEP (MD5_H , b, c, d, a, t[14], MD5C23, MD5S23);
760     MD5_STEP (MD5_H , a, b, c, d, t[ 1], MD5C24, MD5S20);
761     MD5_STEP (MD5_H , d, a, b, c, t[ 4], MD5C25, MD5S21);
762     MD5_STEP (MD5_H , c, d, a, b, t[ 7], MD5C26, MD5S22);
763     MD5_STEP (MD5_H , b, c, d, a, t[10], MD5C27, MD5S23);
764     MD5_STEP (MD5_H , a, b, c, d, t[13], MD5C28, MD5S20);
765     MD5_STEP (MD5_H , d, a, b, c, t[ 0], MD5C29, MD5S21);
766     MD5_STEP (MD5_H , c, d, a, b, t[ 3], MD5C2a, MD5S22);
767     MD5_STEP (MD5_H , b, c, d, a, t[ 6], MD5C2b, MD5S23);
768     MD5_STEP (MD5_H , a, b, c, d, t[ 9], MD5C2c, MD5S20);
769     MD5_STEP (MD5_H , d, a, b, c, t[12], MD5C2d, MD5S21);
770     MD5_STEP (MD5_H , c, d, a, b, t[15], MD5C2e, MD5S22);
771     MD5_STEP (MD5_H , b, c, d, a, t[ 2], MD5C2f, MD5S23);
772
773     MD5_STEP (MD5_I , a, b, c, d, t[ 0], MD5C30, MD5S30);
774     MD5_STEP (MD5_I , d, a, b, c, t[ 7], MD5C31, MD5S31);
775     MD5_STEP (MD5_I , c, d, a, b, t[14], MD5C32, MD5S32);
776     MD5_STEP (MD5_I , b, c, d, a, t[ 5], MD5C33, MD5S33);
777     MD5_STEP (MD5_I , a, b, c, d, t[12], MD5C34, MD5S30);
778     MD5_STEP (MD5_I , d, a, b, c, t[ 3], MD5C35, MD5S31);
779     MD5_STEP (MD5_I , c, d, a, b, t[10], MD5C36, MD5S32);
780     MD5_STEP (MD5_I , b, c, d, a, t[ 1], MD5C37, MD5S33);
781     MD5_STEP (MD5_I , a, b, c, d, t[ 8], MD5C38, MD5S30);
782     MD5_STEP (MD5_I , d, a, b, c, t[15], MD5C39, MD5S31);
783     MD5_STEP (MD5_I , c, d, a, b, t[ 6], MD5C3a, MD5S32);
784     MD5_STEP (MD5_I , b, c, d, a, t[13], MD5C3b, MD5S33);
785     MD5_STEP (MD5_I , a, b, c, d, t[ 4], MD5C3c, MD5S30);
786     MD5_STEP (MD5_I , d, a, b, c, t[11], MD5C3d, MD5S31);
787     MD5_STEP (MD5_I , c, d, a, b, t[ 2], MD5C3e, MD5S32);
788     MD5_STEP (MD5_I , b, c, d, a, t[ 9], MD5C3f, MD5S33);
789
790     a += MD5M_A;
791     b += MD5M_B;
792     c += MD5M_C;
793     d += MD5M_D;
794
795     const u32 sum20 = walld0rf_magic (w0, out_len, salt_buf0, salt_len, a, b, c, d, t);
796
797     SETSHIFTEDINT (t, sum20, 0x80);
798
799     t[14] = sum20 * 8;
800
801     a = MD5M_A;
802     b = MD5M_B;
803     c = MD5M_C;
804     d = MD5M_D;
805
806     MD5_STEP (MD5_Fo, a, b, c, d, t[ 0], MD5C00, MD5S00);
807     MD5_STEP (MD5_Fo, d, a, b, c, t[ 1], MD5C01, MD5S01);
808     MD5_STEP (MD5_Fo, c, d, a, b, t[ 2], MD5C02, MD5S02);
809     MD5_STEP (MD5_Fo, b, c, d, a, t[ 3], MD5C03, MD5S03);
810     MD5_STEP (MD5_Fo, a, b, c, d, t[ 4], MD5C04, MD5S00);
811     MD5_STEP (MD5_Fo, d, a, b, c, t[ 5], MD5C05, MD5S01);
812     MD5_STEP (MD5_Fo, c, d, a, b, t[ 6], MD5C06, MD5S02);
813     MD5_STEP (MD5_Fo, b, c, d, a, t[ 7], MD5C07, MD5S03);
814     MD5_STEP (MD5_Fo, a, b, c, d, t[ 8], MD5C08, MD5S00);
815     MD5_STEP (MD5_Fo, d, a, b, c, t[ 9], MD5C09, MD5S01);
816     MD5_STEP (MD5_Fo, c, d, a, b, t[10], MD5C0a, MD5S02);
817     MD5_STEP (MD5_Fo, b, c, d, a, t[11], MD5C0b, MD5S03);
818     MD5_STEP (MD5_Fo, a, b, c, d, t[12], MD5C0c, MD5S00);
819     MD5_STEP (MD5_Fo, d, a, b, c, t[13], MD5C0d, MD5S01);
820     MD5_STEP (MD5_Fo, c, d, a, b, t[14], MD5C0e, MD5S02);
821     MD5_STEP (MD5_Fo, b, c, d, a, t[15], MD5C0f, MD5S03);
822
823     MD5_STEP (MD5_Go, a, b, c, d, t[ 1], MD5C10, MD5S10);
824     MD5_STEP (MD5_Go, d, a, b, c, t[ 6], MD5C11, MD5S11);
825     MD5_STEP (MD5_Go, c, d, a, b, t[11], MD5C12, MD5S12);
826     MD5_STEP (MD5_Go, b, c, d, a, t[ 0], MD5C13, MD5S13);
827     MD5_STEP (MD5_Go, a, b, c, d, t[ 5], MD5C14, MD5S10);
828     MD5_STEP (MD5_Go, d, a, b, c, t[10], MD5C15, MD5S11);
829     MD5_STEP (MD5_Go, c, d, a, b, t[15], MD5C16, MD5S12);
830     MD5_STEP (MD5_Go, b, c, d, a, t[ 4], MD5C17, MD5S13);
831     MD5_STEP (MD5_Go, a, b, c, d, t[ 9], MD5C18, MD5S10);
832     MD5_STEP (MD5_Go, d, a, b, c, t[14], MD5C19, MD5S11);
833     MD5_STEP (MD5_Go, c, d, a, b, t[ 3], MD5C1a, MD5S12);
834     MD5_STEP (MD5_Go, b, c, d, a, t[ 8], MD5C1b, MD5S13);
835     MD5_STEP (MD5_Go, a, b, c, d, t[13], MD5C1c, MD5S10);
836     MD5_STEP (MD5_Go, d, a, b, c, t[ 2], MD5C1d, MD5S11);
837     MD5_STEP (MD5_Go, c, d, a, b, t[ 7], MD5C1e, MD5S12);
838     MD5_STEP (MD5_Go, b, c, d, a, t[12], MD5C1f, MD5S13);
839
840     MD5_STEP (MD5_H , a, b, c, d, t[ 5], MD5C20, MD5S20);
841     MD5_STEP (MD5_H , d, a, b, c, t[ 8], MD5C21, MD5S21);
842     MD5_STEP (MD5_H , c, d, a, b, t[11], MD5C22, MD5S22);
843     MD5_STEP (MD5_H , b, c, d, a, t[14], MD5C23, MD5S23);
844     MD5_STEP (MD5_H , a, b, c, d, t[ 1], MD5C24, MD5S20);
845     MD5_STEP (MD5_H , d, a, b, c, t[ 4], MD5C25, MD5S21);
846     MD5_STEP (MD5_H , c, d, a, b, t[ 7], MD5C26, MD5S22);
847     MD5_STEP (MD5_H , b, c, d, a, t[10], MD5C27, MD5S23);
848     MD5_STEP (MD5_H , a, b, c, d, t[13], MD5C28, MD5S20);
849     MD5_STEP (MD5_H , d, a, b, c, t[ 0], MD5C29, MD5S21);
850     MD5_STEP (MD5_H , c, d, a, b, t[ 3], MD5C2a, MD5S22);
851     MD5_STEP (MD5_H , b, c, d, a, t[ 6], MD5C2b, MD5S23);
852     MD5_STEP (MD5_H , a, b, c, d, t[ 9], MD5C2c, MD5S20);
853     MD5_STEP (MD5_H , d, a, b, c, t[12], MD5C2d, MD5S21);
854     MD5_STEP (MD5_H , c, d, a, b, t[15], MD5C2e, MD5S22);
855     MD5_STEP (MD5_H , b, c, d, a, t[ 2], MD5C2f, MD5S23);
856
857     MD5_STEP (MD5_I , a, b, c, d, t[ 0], MD5C30, MD5S30);
858     MD5_STEP (MD5_I , d, a, b, c, t[ 7], MD5C31, MD5S31);
859     MD5_STEP (MD5_I , c, d, a, b, t[14], MD5C32, MD5S32);
860     MD5_STEP (MD5_I , b, c, d, a, t[ 5], MD5C33, MD5S33);
861     MD5_STEP (MD5_I , a, b, c, d, t[12], MD5C34, MD5S30);
862     MD5_STEP (MD5_I , d, a, b, c, t[ 3], MD5C35, MD5S31);
863     MD5_STEP (MD5_I , c, d, a, b, t[10], MD5C36, MD5S32);
864     MD5_STEP (MD5_I , b, c, d, a, t[ 1], MD5C37, MD5S33);
865     MD5_STEP (MD5_I , a, b, c, d, t[ 8], MD5C38, MD5S30);
866     MD5_STEP (MD5_I , d, a, b, c, t[15], MD5C39, MD5S31);
867     MD5_STEP (MD5_I , c, d, a, b, t[ 6], MD5C3a, MD5S32);
868     MD5_STEP (MD5_I , b, c, d, a, t[13], MD5C3b, MD5S33);
869     MD5_STEP (MD5_I , a, b, c, d, t[ 4], MD5C3c, MD5S30);
870     MD5_STEP (MD5_I , d, a, b, c, t[11], MD5C3d, MD5S31);
871     MD5_STEP (MD5_I , c, d, a, b, t[ 2], MD5C3e, MD5S32);
872     MD5_STEP (MD5_I , b, c, d, a, t[ 9], MD5C3f, MD5S33);
873
874     a += MD5M_A;
875     b += MD5M_B;
876     c += MD5M_C;
877     d += MD5M_D;
878
879     a ^= c;
880     b ^= d;
881
882     const u32 r0 = a;
883     const u32 r1 = b;
884     const u32 r2 = 0;
885     const u32 r3 = 0;
886
887     #include COMPARE_S
888   }
889 }
890
891 __kernel void m07700_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 void *esalt_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
892 {
893 }
894
895 __kernel void m07700_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 void *esalt_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
896 {
897 }