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