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