- Dropped all vector code since new GPU's are all scalar, makes the code much easier
[hashcat.git] / OpenCL / m07700_a1.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 "types_ocl.c"
18 #include "common.c"
19
20 #define COMPARE_S "check_single_comp4.c"
21 #define COMPARE_M "check_multi_comp4.c"
22
23 #define GETCHAR(a,p)  (((a)[(p) / 4] >> (((p) & 3) * 8)) & 0xff)
24 #define PUTCHAR(a,p,c) ((a)[(p) / 4] = (((a)[(p) / 4] & ~(0xff << (((p) & 3) * 8))) | ((c) << (((p) & 3) * 8))))
25
26 #define SETSHIFTEDINT(a,n,v)        \
27 {                                   \
28   const u32 s = ((n) & 3) * 8;     \
29   const u64 x = (u64) (v) << s; \
30   (a)[((n)/4)+0] &= ~(0xff << ((n & 3) * 8)); \
31   (a)[((n)/4)+0] |= x;              \
32   (a)[((n)/4)+1]  = x >> 32;        \
33 }
34
35 __constant u32 sapb_trans_tbl[256] =
36 {
37   // first value hack for 0 byte as part of an optimization
38   0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
39   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
40   0x3f, 0x40, 0x41, 0x50, 0x43, 0x44, 0x45, 0x4b, 0x47, 0x48, 0x4d, 0x4e, 0x54, 0x51, 0x53, 0x46,
41   0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x56, 0x55, 0x5c, 0x49, 0x5d, 0x4a,
42   0x42, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
43   0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x58, 0x5b, 0x59, 0xff, 0x52,
44   0x4c, 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, 0x57, 0x5e, 0x5a, 0x4f, 0xff,
46   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
47   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 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 };
55
56 __constant u32 bcodeArray[48] =
57 {
58   0x14, 0x77, 0xf3, 0xd4, 0xbb, 0x71, 0x23, 0xd0, 0x03, 0xff, 0x47, 0x93, 0x55, 0xaa, 0x66, 0x91,
59   0xf2, 0x88, 0x6b, 0x99, 0xbf, 0xcb, 0x32, 0x1a, 0x19, 0xd9, 0xa7, 0x82, 0x22, 0x49, 0xa2, 0x51,
60   0xe2, 0xb7, 0x33, 0x71, 0x8b, 0x9f, 0x5d, 0x01, 0x44, 0x70, 0xae, 0x11, 0xef, 0x28, 0xf0, 0x0d
61 };
62
63 static u32 sapb_trans (const u32 in)
64 {
65   u32 out = 0;
66
67   #ifdef VECT_SIZE1
68   out |= (sapb_trans_tbl[(in >>  0) & 0xff]) <<  0;
69   out |= (sapb_trans_tbl[(in >>  8) & 0xff]) <<  8;
70   out |= (sapb_trans_tbl[(in >> 16) & 0xff]) << 16;
71   out |= (sapb_trans_tbl[(in >> 24) & 0xff]) << 24;
72   #endif
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 __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 combs_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 wordl0[4];
238
239   wordl0[0] = pws[gid].i[ 0];
240   wordl0[1] = pws[gid].i[ 1];
241   wordl0[2] = 0;
242   wordl0[3] = 0;
243
244   u32 wordl1[4];
245
246   wordl1[0] = 0;
247   wordl1[1] = 0;
248   wordl1[2] = 0;
249   wordl1[3] = 0;
250
251   u32 wordl2[4];
252
253   wordl2[0] = 0;
254   wordl2[1] = 0;
255   wordl2[2] = 0;
256   wordl2[3] = 0;
257
258   u32 wordl3[4];
259
260   wordl3[0] = 0;
261   wordl3[1] = 0;
262   wordl3[2] = 0;
263   wordl3[3] = 0;
264
265   const u32 pw_l_len = pws[gid].pw_len;
266
267   if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
268   {
269     switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
270   }
271
272   /**
273    * salt
274    */
275
276   u32 salt_buf0[4];
277
278   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[0];
279   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[1];
280   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[2];
281   salt_buf0[3] = 0;
282
283   const u32 salt_len = salt_bufs[salt_pos].salt_len;
284
285   salt_buf0[0] = sapb_trans (salt_buf0[0]);
286   salt_buf0[1] = sapb_trans (salt_buf0[1]);
287   salt_buf0[2] = sapb_trans (salt_buf0[2]);
288
289   /**
290    * digest
291    */
292
293   /**
294    * loop
295    */
296
297   for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
298   {
299     const u32 pw_r_len = combs_buf[il_pos].pw_len;
300
301     const u32 pw_len = pw_l_len + pw_r_len;
302
303     u32 wordr0[4];
304
305     wordr0[0] = combs_buf[il_pos].i[0];
306     wordr0[1] = combs_buf[il_pos].i[1];
307     wordr0[2] = 0;
308     wordr0[3] = 0;
309
310     u32 wordr1[4];
311
312     wordr1[0] = 0;
313     wordr1[1] = 0;
314     wordr1[2] = 0;
315     wordr1[3] = 0;
316
317     u32 wordr2[4];
318
319     wordr2[0] = 0;
320     wordr2[1] = 0;
321     wordr2[2] = 0;
322     wordr2[3] = 0;
323
324     u32 wordr3[4];
325
326     wordr3[0] = 0;
327     wordr3[1] = 0;
328     wordr3[2] = 0;
329     wordr3[3] = 0;
330
331     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
332     {
333       switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
334     }
335
336     u32 w0[4];
337
338     w0[0] = sapb_trans (wordl0[0] | wordr0[0]);
339     w0[1] = sapb_trans (wordl0[1] | wordr0[1]);
340     w0[2] = 0;
341     w0[3] = 0;
342
343     /**
344      * append salt
345      */
346
347     u32 s0[4];
348
349     s0[0] = salt_buf0[0];
350     s0[1] = salt_buf0[1];
351     s0[2] = salt_buf0[2];
352     s0[3] = 0;
353
354     u32 s1[4];
355
356     s1[0] = 0;
357     s1[1] = 0;
358     s1[2] = 0;
359     s1[3] = 0;
360
361     u32 s2[4];
362
363     s2[0] = 0;
364     s2[1] = 0;
365     s2[2] = 0;
366     s2[3] = 0;
367
368     u32 s3[4];
369
370     s3[0] = 0;
371     s3[1] = 0;
372     s3[2] = 0;
373     s3[3] = 0;
374
375     switch_buffer_by_offset (s0, s1, s2, s3, pw_len);
376
377     const u32 pw_salt_len = pw_len + salt_len;
378
379     u32 t[16];
380
381     t[ 0] = s0[0] | w0[0];
382     t[ 1] = s0[1] | w0[1];
383     t[ 2] = s0[2];
384     t[ 3] = s0[3];
385     t[ 4] = s1[0];
386     t[ 5] = 0;
387     t[ 6] = 0;
388     t[ 7] = 0;
389     t[ 8] = 0;
390     t[ 9] = 0;
391     t[10] = 0;
392     t[11] = 0;
393     t[12] = 0;
394     t[13] = 0;
395     t[14] = pw_salt_len * 8;
396     t[15] = 0;
397
398     PUTCHAR (t, pw_salt_len, 0x80);
399
400     /**
401      * md5
402      */
403
404     u32 a = MD5M_A;
405     u32 b = MD5M_B;
406     u32 c = MD5M_C;
407     u32 d = MD5M_D;
408
409     MD5_STEP (MD5_Fo, a, b, c, d, t[ 0], MD5C00, MD5S00);
410     MD5_STEP (MD5_Fo, d, a, b, c, t[ 1], MD5C01, MD5S01);
411     MD5_STEP (MD5_Fo, c, d, a, b, t[ 2], MD5C02, MD5S02);
412     MD5_STEP (MD5_Fo, b, c, d, a, t[ 3], MD5C03, MD5S03);
413     MD5_STEP (MD5_Fo, a, b, c, d, t[ 4], MD5C04, MD5S00);
414     MD5_STEP (MD5_Fo, d, a, b, c, t[ 5], MD5C05, MD5S01);
415     MD5_STEP (MD5_Fo, c, d, a, b, t[ 6], MD5C06, MD5S02);
416     MD5_STEP (MD5_Fo, b, c, d, a, t[ 7], MD5C07, MD5S03);
417     MD5_STEP (MD5_Fo, a, b, c, d, t[ 8], MD5C08, MD5S00);
418     MD5_STEP (MD5_Fo, d, a, b, c, t[ 9], MD5C09, MD5S01);
419     MD5_STEP (MD5_Fo, c, d, a, b, t[10], MD5C0a, MD5S02);
420     MD5_STEP (MD5_Fo, b, c, d, a, t[11], MD5C0b, MD5S03);
421     MD5_STEP (MD5_Fo, a, b, c, d, t[12], MD5C0c, MD5S00);
422     MD5_STEP (MD5_Fo, d, a, b, c, t[13], MD5C0d, MD5S01);
423     MD5_STEP (MD5_Fo, c, d, a, b, t[14], MD5C0e, MD5S02);
424     MD5_STEP (MD5_Fo, b, c, d, a, t[15], MD5C0f, MD5S03);
425
426     MD5_STEP (MD5_Go, a, b, c, d, t[ 1], MD5C10, MD5S10);
427     MD5_STEP (MD5_Go, d, a, b, c, t[ 6], MD5C11, MD5S11);
428     MD5_STEP (MD5_Go, c, d, a, b, t[11], MD5C12, MD5S12);
429     MD5_STEP (MD5_Go, b, c, d, a, t[ 0], MD5C13, MD5S13);
430     MD5_STEP (MD5_Go, a, b, c, d, t[ 5], MD5C14, MD5S10);
431     MD5_STEP (MD5_Go, d, a, b, c, t[10], MD5C15, MD5S11);
432     MD5_STEP (MD5_Go, c, d, a, b, t[15], MD5C16, MD5S12);
433     MD5_STEP (MD5_Go, b, c, d, a, t[ 4], MD5C17, MD5S13);
434     MD5_STEP (MD5_Go, a, b, c, d, t[ 9], MD5C18, MD5S10);
435     MD5_STEP (MD5_Go, d, a, b, c, t[14], MD5C19, MD5S11);
436     MD5_STEP (MD5_Go, c, d, a, b, t[ 3], MD5C1a, MD5S12);
437     MD5_STEP (MD5_Go, b, c, d, a, t[ 8], MD5C1b, MD5S13);
438     MD5_STEP (MD5_Go, a, b, c, d, t[13], MD5C1c, MD5S10);
439     MD5_STEP (MD5_Go, d, a, b, c, t[ 2], MD5C1d, MD5S11);
440     MD5_STEP (MD5_Go, c, d, a, b, t[ 7], MD5C1e, MD5S12);
441     MD5_STEP (MD5_Go, b, c, d, a, t[12], MD5C1f, MD5S13);
442
443     MD5_STEP (MD5_H , a, b, c, d, t[ 5], MD5C20, MD5S20);
444     MD5_STEP (MD5_H , d, a, b, c, t[ 8], MD5C21, MD5S21);
445     MD5_STEP (MD5_H , c, d, a, b, t[11], MD5C22, MD5S22);
446     MD5_STEP (MD5_H , b, c, d, a, t[14], MD5C23, MD5S23);
447     MD5_STEP (MD5_H , a, b, c, d, t[ 1], MD5C24, MD5S20);
448     MD5_STEP (MD5_H , d, a, b, c, t[ 4], MD5C25, MD5S21);
449     MD5_STEP (MD5_H , c, d, a, b, t[ 7], MD5C26, MD5S22);
450     MD5_STEP (MD5_H , b, c, d, a, t[10], MD5C27, MD5S23);
451     MD5_STEP (MD5_H , a, b, c, d, t[13], MD5C28, MD5S20);
452     MD5_STEP (MD5_H , d, a, b, c, t[ 0], MD5C29, MD5S21);
453     MD5_STEP (MD5_H , c, d, a, b, t[ 3], MD5C2a, MD5S22);
454     MD5_STEP (MD5_H , b, c, d, a, t[ 6], MD5C2b, MD5S23);
455     MD5_STEP (MD5_H , a, b, c, d, t[ 9], MD5C2c, MD5S20);
456     MD5_STEP (MD5_H , d, a, b, c, t[12], MD5C2d, MD5S21);
457     MD5_STEP (MD5_H , c, d, a, b, t[15], MD5C2e, MD5S22);
458     MD5_STEP (MD5_H , b, c, d, a, t[ 2], MD5C2f, MD5S23);
459
460     MD5_STEP (MD5_I , a, b, c, d, t[ 0], MD5C30, MD5S30);
461     MD5_STEP (MD5_I , d, a, b, c, t[ 7], MD5C31, MD5S31);
462     MD5_STEP (MD5_I , c, d, a, b, t[14], MD5C32, MD5S32);
463     MD5_STEP (MD5_I , b, c, d, a, t[ 5], MD5C33, MD5S33);
464     MD5_STEP (MD5_I , a, b, c, d, t[12], MD5C34, MD5S30);
465     MD5_STEP (MD5_I , d, a, b, c, t[ 3], MD5C35, MD5S31);
466     MD5_STEP (MD5_I , c, d, a, b, t[10], MD5C36, MD5S32);
467     MD5_STEP (MD5_I , b, c, d, a, t[ 1], MD5C37, MD5S33);
468     MD5_STEP (MD5_I , a, b, c, d, t[ 8], MD5C38, MD5S30);
469     MD5_STEP (MD5_I , d, a, b, c, t[15], MD5C39, MD5S31);
470     MD5_STEP (MD5_I , c, d, a, b, t[ 6], MD5C3a, MD5S32);
471     MD5_STEP (MD5_I , b, c, d, a, t[13], MD5C3b, MD5S33);
472     MD5_STEP (MD5_I , a, b, c, d, t[ 4], MD5C3c, MD5S30);
473     MD5_STEP (MD5_I , d, a, b, c, t[11], MD5C3d, MD5S31);
474     MD5_STEP (MD5_I , c, d, a, b, t[ 2], MD5C3e, MD5S32);
475     MD5_STEP (MD5_I , b, c, d, a, t[ 9], MD5C3f, MD5S33);
476
477     a += MD5M_A;
478     b += MD5M_B;
479     c += MD5M_C;
480     d += MD5M_D;
481
482     const u32 sum20 = walld0rf_magic (w0, pw_len, salt_buf0, salt_len, a, b, c, d, t);
483
484     SETSHIFTEDINT (t, sum20, 0x80);
485
486     t[14] = sum20 * 8;
487
488     a = MD5M_A;
489     b = MD5M_B;
490     c = MD5M_C;
491     d = MD5M_D;
492
493     MD5_STEP (MD5_Fo, a, b, c, d, t[ 0], MD5C00, MD5S00);
494     MD5_STEP (MD5_Fo, d, a, b, c, t[ 1], MD5C01, MD5S01);
495     MD5_STEP (MD5_Fo, c, d, a, b, t[ 2], MD5C02, MD5S02);
496     MD5_STEP (MD5_Fo, b, c, d, a, t[ 3], MD5C03, MD5S03);
497     MD5_STEP (MD5_Fo, a, b, c, d, t[ 4], MD5C04, MD5S00);
498     MD5_STEP (MD5_Fo, d, a, b, c, t[ 5], MD5C05, MD5S01);
499     MD5_STEP (MD5_Fo, c, d, a, b, t[ 6], MD5C06, MD5S02);
500     MD5_STEP (MD5_Fo, b, c, d, a, t[ 7], MD5C07, MD5S03);
501     MD5_STEP (MD5_Fo, a, b, c, d, t[ 8], MD5C08, MD5S00);
502     MD5_STEP (MD5_Fo, d, a, b, c, t[ 9], MD5C09, MD5S01);
503     MD5_STEP (MD5_Fo, c, d, a, b, t[10], MD5C0a, MD5S02);
504     MD5_STEP (MD5_Fo, b, c, d, a, t[11], MD5C0b, MD5S03);
505     MD5_STEP (MD5_Fo, a, b, c, d, t[12], MD5C0c, MD5S00);
506     MD5_STEP (MD5_Fo, d, a, b, c, t[13], MD5C0d, MD5S01);
507     MD5_STEP (MD5_Fo, c, d, a, b, t[14], MD5C0e, MD5S02);
508     MD5_STEP (MD5_Fo, b, c, d, a, t[15], MD5C0f, MD5S03);
509
510     MD5_STEP (MD5_Go, a, b, c, d, t[ 1], MD5C10, MD5S10);
511     MD5_STEP (MD5_Go, d, a, b, c, t[ 6], MD5C11, MD5S11);
512     MD5_STEP (MD5_Go, c, d, a, b, t[11], MD5C12, MD5S12);
513     MD5_STEP (MD5_Go, b, c, d, a, t[ 0], MD5C13, MD5S13);
514     MD5_STEP (MD5_Go, a, b, c, d, t[ 5], MD5C14, MD5S10);
515     MD5_STEP (MD5_Go, d, a, b, c, t[10], MD5C15, MD5S11);
516     MD5_STEP (MD5_Go, c, d, a, b, t[15], MD5C16, MD5S12);
517     MD5_STEP (MD5_Go, b, c, d, a, t[ 4], MD5C17, MD5S13);
518     MD5_STEP (MD5_Go, a, b, c, d, t[ 9], MD5C18, MD5S10);
519     MD5_STEP (MD5_Go, d, a, b, c, t[14], MD5C19, MD5S11);
520     MD5_STEP (MD5_Go, c, d, a, b, t[ 3], MD5C1a, MD5S12);
521     MD5_STEP (MD5_Go, b, c, d, a, t[ 8], MD5C1b, MD5S13);
522     MD5_STEP (MD5_Go, a, b, c, d, t[13], MD5C1c, MD5S10);
523     MD5_STEP (MD5_Go, d, a, b, c, t[ 2], MD5C1d, MD5S11);
524     MD5_STEP (MD5_Go, c, d, a, b, t[ 7], MD5C1e, MD5S12);
525     MD5_STEP (MD5_Go, b, c, d, a, t[12], MD5C1f, MD5S13);
526
527     MD5_STEP (MD5_H , a, b, c, d, t[ 5], MD5C20, MD5S20);
528     MD5_STEP (MD5_H , d, a, b, c, t[ 8], MD5C21, MD5S21);
529     MD5_STEP (MD5_H , c, d, a, b, t[11], MD5C22, MD5S22);
530     MD5_STEP (MD5_H , b, c, d, a, t[14], MD5C23, MD5S23);
531     MD5_STEP (MD5_H , a, b, c, d, t[ 1], MD5C24, MD5S20);
532     MD5_STEP (MD5_H , d, a, b, c, t[ 4], MD5C25, MD5S21);
533     MD5_STEP (MD5_H , c, d, a, b, t[ 7], MD5C26, MD5S22);
534     MD5_STEP (MD5_H , b, c, d, a, t[10], MD5C27, MD5S23);
535     MD5_STEP (MD5_H , a, b, c, d, t[13], MD5C28, MD5S20);
536     MD5_STEP (MD5_H , d, a, b, c, t[ 0], MD5C29, MD5S21);
537     MD5_STEP (MD5_H , c, d, a, b, t[ 3], MD5C2a, MD5S22);
538     MD5_STEP (MD5_H , b, c, d, a, t[ 6], MD5C2b, MD5S23);
539     MD5_STEP (MD5_H , a, b, c, d, t[ 9], MD5C2c, MD5S20);
540     MD5_STEP (MD5_H , d, a, b, c, t[12], MD5C2d, MD5S21);
541     MD5_STEP (MD5_H , c, d, a, b, t[15], MD5C2e, MD5S22);
542     MD5_STEP (MD5_H , b, c, d, a, t[ 2], MD5C2f, MD5S23);
543
544     MD5_STEP (MD5_I , a, b, c, d, t[ 0], MD5C30, MD5S30);
545     MD5_STEP (MD5_I , d, a, b, c, t[ 7], MD5C31, MD5S31);
546     MD5_STEP (MD5_I , c, d, a, b, t[14], MD5C32, MD5S32);
547     MD5_STEP (MD5_I , b, c, d, a, t[ 5], MD5C33, MD5S33);
548     MD5_STEP (MD5_I , a, b, c, d, t[12], MD5C34, MD5S30);
549     MD5_STEP (MD5_I , d, a, b, c, t[ 3], MD5C35, MD5S31);
550     MD5_STEP (MD5_I , c, d, a, b, t[10], MD5C36, MD5S32);
551     MD5_STEP (MD5_I , b, c, d, a, t[ 1], MD5C37, MD5S33);
552     MD5_STEP (MD5_I , a, b, c, d, t[ 8], MD5C38, MD5S30);
553     MD5_STEP (MD5_I , d, a, b, c, t[15], MD5C39, MD5S31);
554     MD5_STEP (MD5_I , c, d, a, b, t[ 6], MD5C3a, MD5S32);
555     MD5_STEP (MD5_I , b, c, d, a, t[13], MD5C3b, MD5S33);
556     MD5_STEP (MD5_I , a, b, c, d, t[ 4], MD5C3c, MD5S30);
557     MD5_STEP (MD5_I , d, a, b, c, t[11], MD5C3d, MD5S31);
558     MD5_STEP (MD5_I , c, d, a, b, t[ 2], MD5C3e, MD5S32);
559     MD5_STEP (MD5_I , b, c, d, a, t[ 9], MD5C3f, MD5S33);
560
561     a += MD5M_A;
562     b += MD5M_B;
563     c += MD5M_C;
564     d += MD5M_D;
565
566     a ^= c;
567     b ^= d;
568
569     const u32 r0 = a;
570     const u32 r1 = b;
571     const u32 r2 = 0;
572     const u32 r3 = 0;
573
574     #include COMPARE_M
575   }
576 }
577
578 __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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
579 {
580 }
581
582 __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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
583 {
584 }
585
586 __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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
587 {
588   /**
589    * modifier
590    */
591
592   const u32 lid = get_local_id (0);
593
594   /**
595    * base
596    */
597
598   const u32 gid = get_global_id (0);
599
600   if (gid >= gid_max) return;
601
602   u32 wordl0[4];
603
604   wordl0[0] = pws[gid].i[ 0];
605   wordl0[1] = pws[gid].i[ 1];
606   wordl0[2] = 0;
607   wordl0[3] = 0;
608
609   u32 wordl1[4];
610
611   wordl1[0] = 0;
612   wordl1[1] = 0;
613   wordl1[2] = 0;
614   wordl1[3] = 0;
615
616   u32 wordl2[4];
617
618   wordl2[0] = 0;
619   wordl2[1] = 0;
620   wordl2[2] = 0;
621   wordl2[3] = 0;
622
623   u32 wordl3[4];
624
625   wordl3[0] = 0;
626   wordl3[1] = 0;
627   wordl3[2] = 0;
628   wordl3[3] = 0;
629
630   const u32 pw_l_len = pws[gid].pw_len;
631
632   if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
633   {
634     switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
635   }
636
637   /**
638    * salt
639    */
640
641   u32 salt_buf0[4];
642
643   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[0];
644   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[1];
645   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[2];
646   salt_buf0[3] = 0;
647
648   const u32 salt_len = salt_bufs[salt_pos].salt_len;
649
650   salt_buf0[0] = sapb_trans (salt_buf0[0]);
651   salt_buf0[1] = sapb_trans (salt_buf0[1]);
652   salt_buf0[2] = sapb_trans (salt_buf0[2]);
653
654   /**
655    * digest
656    */
657
658   const u32 search[4] =
659   {
660     digests_buf[digests_offset].digest_buf[DGST_R0],
661     digests_buf[digests_offset].digest_buf[DGST_R1],
662     digests_buf[digests_offset].digest_buf[DGST_R2],
663     digests_buf[digests_offset].digest_buf[DGST_R3]
664   };
665
666   /**
667    * loop
668    */
669
670   for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
671   {
672     const u32 pw_r_len = combs_buf[il_pos].pw_len;
673
674     const u32 pw_len = pw_l_len + pw_r_len;
675
676     u32 wordr0[4];
677
678     wordr0[0] = combs_buf[il_pos].i[0];
679     wordr0[1] = combs_buf[il_pos].i[1];
680     wordr0[2] = 0;
681     wordr0[3] = 0;
682
683     u32 wordr1[4];
684
685     wordr1[0] = 0;
686     wordr1[1] = 0;
687     wordr1[2] = 0;
688     wordr1[3] = 0;
689
690     u32 wordr2[4];
691
692     wordr2[0] = 0;
693     wordr2[1] = 0;
694     wordr2[2] = 0;
695     wordr2[3] = 0;
696
697     u32 wordr3[4];
698
699     wordr3[0] = 0;
700     wordr3[1] = 0;
701     wordr3[2] = 0;
702     wordr3[3] = 0;
703
704     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
705     {
706       switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
707     }
708
709     u32 w0[4];
710
711     w0[0] = sapb_trans (wordl0[0] | wordr0[0]);
712     w0[1] = sapb_trans (wordl0[1] | wordr0[1]);
713     w0[2] = 0;
714     w0[3] = 0;
715
716     /**
717      * append salt
718      */
719
720     u32 s0[4];
721
722     s0[0] = salt_buf0[0];
723     s0[1] = salt_buf0[1];
724     s0[2] = salt_buf0[2];
725     s0[3] = 0;
726
727     u32 s1[4];
728
729     s1[0] = 0;
730     s1[1] = 0;
731     s1[2] = 0;
732     s1[3] = 0;
733
734     u32 s2[4];
735
736     s2[0] = 0;
737     s2[1] = 0;
738     s2[2] = 0;
739     s2[3] = 0;
740
741     u32 s3[4];
742
743     s3[0] = 0;
744     s3[1] = 0;
745     s3[2] = 0;
746     s3[3] = 0;
747
748     switch_buffer_by_offset (s0, s1, s2, s3, pw_len);
749
750     const u32 pw_salt_len = pw_len + salt_len;
751
752     u32 t[16];
753
754     t[ 0] = s0[0] | w0[0];
755     t[ 1] = s0[1] | w0[1];
756     t[ 2] = s0[2];
757     t[ 3] = s0[3];
758     t[ 4] = s1[0];
759     t[ 5] = 0;
760     t[ 6] = 0;
761     t[ 7] = 0;
762     t[ 8] = 0;
763     t[ 9] = 0;
764     t[10] = 0;
765     t[11] = 0;
766     t[12] = 0;
767     t[13] = 0;
768     t[14] = pw_salt_len * 8;
769     t[15] = 0;
770
771     PUTCHAR (t, pw_salt_len, 0x80);
772
773     /**
774      * md5
775      */
776
777     u32 a = MD5M_A;
778     u32 b = MD5M_B;
779     u32 c = MD5M_C;
780     u32 d = MD5M_D;
781
782     MD5_STEP (MD5_Fo, a, b, c, d, t[ 0], MD5C00, MD5S00);
783     MD5_STEP (MD5_Fo, d, a, b, c, t[ 1], MD5C01, MD5S01);
784     MD5_STEP (MD5_Fo, c, d, a, b, t[ 2], MD5C02, MD5S02);
785     MD5_STEP (MD5_Fo, b, c, d, a, t[ 3], MD5C03, MD5S03);
786     MD5_STEP (MD5_Fo, a, b, c, d, t[ 4], MD5C04, MD5S00);
787     MD5_STEP (MD5_Fo, d, a, b, c, t[ 5], MD5C05, MD5S01);
788     MD5_STEP (MD5_Fo, c, d, a, b, t[ 6], MD5C06, MD5S02);
789     MD5_STEP (MD5_Fo, b, c, d, a, t[ 7], MD5C07, MD5S03);
790     MD5_STEP (MD5_Fo, a, b, c, d, t[ 8], MD5C08, MD5S00);
791     MD5_STEP (MD5_Fo, d, a, b, c, t[ 9], MD5C09, MD5S01);
792     MD5_STEP (MD5_Fo, c, d, a, b, t[10], MD5C0a, MD5S02);
793     MD5_STEP (MD5_Fo, b, c, d, a, t[11], MD5C0b, MD5S03);
794     MD5_STEP (MD5_Fo, a, b, c, d, t[12], MD5C0c, MD5S00);
795     MD5_STEP (MD5_Fo, d, a, b, c, t[13], MD5C0d, MD5S01);
796     MD5_STEP (MD5_Fo, c, d, a, b, t[14], MD5C0e, MD5S02);
797     MD5_STEP (MD5_Fo, b, c, d, a, t[15], MD5C0f, MD5S03);
798
799     MD5_STEP (MD5_Go, a, b, c, d, t[ 1], MD5C10, MD5S10);
800     MD5_STEP (MD5_Go, d, a, b, c, t[ 6], MD5C11, MD5S11);
801     MD5_STEP (MD5_Go, c, d, a, b, t[11], MD5C12, MD5S12);
802     MD5_STEP (MD5_Go, b, c, d, a, t[ 0], MD5C13, MD5S13);
803     MD5_STEP (MD5_Go, a, b, c, d, t[ 5], MD5C14, MD5S10);
804     MD5_STEP (MD5_Go, d, a, b, c, t[10], MD5C15, MD5S11);
805     MD5_STEP (MD5_Go, c, d, a, b, t[15], MD5C16, MD5S12);
806     MD5_STEP (MD5_Go, b, c, d, a, t[ 4], MD5C17, MD5S13);
807     MD5_STEP (MD5_Go, a, b, c, d, t[ 9], MD5C18, MD5S10);
808     MD5_STEP (MD5_Go, d, a, b, c, t[14], MD5C19, MD5S11);
809     MD5_STEP (MD5_Go, c, d, a, b, t[ 3], MD5C1a, MD5S12);
810     MD5_STEP (MD5_Go, b, c, d, a, t[ 8], MD5C1b, MD5S13);
811     MD5_STEP (MD5_Go, a, b, c, d, t[13], MD5C1c, MD5S10);
812     MD5_STEP (MD5_Go, d, a, b, c, t[ 2], MD5C1d, MD5S11);
813     MD5_STEP (MD5_Go, c, d, a, b, t[ 7], MD5C1e, MD5S12);
814     MD5_STEP (MD5_Go, b, c, d, a, t[12], MD5C1f, MD5S13);
815
816     MD5_STEP (MD5_H , a, b, c, d, t[ 5], MD5C20, MD5S20);
817     MD5_STEP (MD5_H , d, a, b, c, t[ 8], MD5C21, MD5S21);
818     MD5_STEP (MD5_H , c, d, a, b, t[11], MD5C22, MD5S22);
819     MD5_STEP (MD5_H , b, c, d, a, t[14], MD5C23, MD5S23);
820     MD5_STEP (MD5_H , a, b, c, d, t[ 1], MD5C24, MD5S20);
821     MD5_STEP (MD5_H , d, a, b, c, t[ 4], MD5C25, MD5S21);
822     MD5_STEP (MD5_H , c, d, a, b, t[ 7], MD5C26, MD5S22);
823     MD5_STEP (MD5_H , b, c, d, a, t[10], MD5C27, MD5S23);
824     MD5_STEP (MD5_H , a, b, c, d, t[13], MD5C28, MD5S20);
825     MD5_STEP (MD5_H , d, a, b, c, t[ 0], MD5C29, MD5S21);
826     MD5_STEP (MD5_H , c, d, a, b, t[ 3], MD5C2a, MD5S22);
827     MD5_STEP (MD5_H , b, c, d, a, t[ 6], MD5C2b, MD5S23);
828     MD5_STEP (MD5_H , a, b, c, d, t[ 9], MD5C2c, MD5S20);
829     MD5_STEP (MD5_H , d, a, b, c, t[12], MD5C2d, MD5S21);
830     MD5_STEP (MD5_H , c, d, a, b, t[15], MD5C2e, MD5S22);
831     MD5_STEP (MD5_H , b, c, d, a, t[ 2], MD5C2f, MD5S23);
832
833     MD5_STEP (MD5_I , a, b, c, d, t[ 0], MD5C30, MD5S30);
834     MD5_STEP (MD5_I , d, a, b, c, t[ 7], MD5C31, MD5S31);
835     MD5_STEP (MD5_I , c, d, a, b, t[14], MD5C32, MD5S32);
836     MD5_STEP (MD5_I , b, c, d, a, t[ 5], MD5C33, MD5S33);
837     MD5_STEP (MD5_I , a, b, c, d, t[12], MD5C34, MD5S30);
838     MD5_STEP (MD5_I , d, a, b, c, t[ 3], MD5C35, MD5S31);
839     MD5_STEP (MD5_I , c, d, a, b, t[10], MD5C36, MD5S32);
840     MD5_STEP (MD5_I , b, c, d, a, t[ 1], MD5C37, MD5S33);
841     MD5_STEP (MD5_I , a, b, c, d, t[ 8], MD5C38, MD5S30);
842     MD5_STEP (MD5_I , d, a, b, c, t[15], MD5C39, MD5S31);
843     MD5_STEP (MD5_I , c, d, a, b, t[ 6], MD5C3a, MD5S32);
844     MD5_STEP (MD5_I , b, c, d, a, t[13], MD5C3b, MD5S33);
845     MD5_STEP (MD5_I , a, b, c, d, t[ 4], MD5C3c, MD5S30);
846     MD5_STEP (MD5_I , d, a, b, c, t[11], MD5C3d, MD5S31);
847     MD5_STEP (MD5_I , c, d, a, b, t[ 2], MD5C3e, MD5S32);
848     MD5_STEP (MD5_I , b, c, d, a, t[ 9], MD5C3f, MD5S33);
849
850     a += MD5M_A;
851     b += MD5M_B;
852     c += MD5M_C;
853     d += MD5M_D;
854
855     const u32 sum20 = walld0rf_magic (w0, pw_len, salt_buf0, salt_len, a, b, c, d, t);
856
857     SETSHIFTEDINT (t, sum20, 0x80);
858
859     t[14] = sum20 * 8;
860
861     a = MD5M_A;
862     b = MD5M_B;
863     c = MD5M_C;
864     d = MD5M_D;
865
866     MD5_STEP (MD5_Fo, a, b, c, d, t[ 0], MD5C00, MD5S00);
867     MD5_STEP (MD5_Fo, d, a, b, c, t[ 1], MD5C01, MD5S01);
868     MD5_STEP (MD5_Fo, c, d, a, b, t[ 2], MD5C02, MD5S02);
869     MD5_STEP (MD5_Fo, b, c, d, a, t[ 3], MD5C03, MD5S03);
870     MD5_STEP (MD5_Fo, a, b, c, d, t[ 4], MD5C04, MD5S00);
871     MD5_STEP (MD5_Fo, d, a, b, c, t[ 5], MD5C05, MD5S01);
872     MD5_STEP (MD5_Fo, c, d, a, b, t[ 6], MD5C06, MD5S02);
873     MD5_STEP (MD5_Fo, b, c, d, a, t[ 7], MD5C07, MD5S03);
874     MD5_STEP (MD5_Fo, a, b, c, d, t[ 8], MD5C08, MD5S00);
875     MD5_STEP (MD5_Fo, d, a, b, c, t[ 9], MD5C09, MD5S01);
876     MD5_STEP (MD5_Fo, c, d, a, b, t[10], MD5C0a, MD5S02);
877     MD5_STEP (MD5_Fo, b, c, d, a, t[11], MD5C0b, MD5S03);
878     MD5_STEP (MD5_Fo, a, b, c, d, t[12], MD5C0c, MD5S00);
879     MD5_STEP (MD5_Fo, d, a, b, c, t[13], MD5C0d, MD5S01);
880     MD5_STEP (MD5_Fo, c, d, a, b, t[14], MD5C0e, MD5S02);
881     MD5_STEP (MD5_Fo, b, c, d, a, t[15], MD5C0f, MD5S03);
882
883     MD5_STEP (MD5_Go, a, b, c, d, t[ 1], MD5C10, MD5S10);
884     MD5_STEP (MD5_Go, d, a, b, c, t[ 6], MD5C11, MD5S11);
885     MD5_STEP (MD5_Go, c, d, a, b, t[11], MD5C12, MD5S12);
886     MD5_STEP (MD5_Go, b, c, d, a, t[ 0], MD5C13, MD5S13);
887     MD5_STEP (MD5_Go, a, b, c, d, t[ 5], MD5C14, MD5S10);
888     MD5_STEP (MD5_Go, d, a, b, c, t[10], MD5C15, MD5S11);
889     MD5_STEP (MD5_Go, c, d, a, b, t[15], MD5C16, MD5S12);
890     MD5_STEP (MD5_Go, b, c, d, a, t[ 4], MD5C17, MD5S13);
891     MD5_STEP (MD5_Go, a, b, c, d, t[ 9], MD5C18, MD5S10);
892     MD5_STEP (MD5_Go, d, a, b, c, t[14], MD5C19, MD5S11);
893     MD5_STEP (MD5_Go, c, d, a, b, t[ 3], MD5C1a, MD5S12);
894     MD5_STEP (MD5_Go, b, c, d, a, t[ 8], MD5C1b, MD5S13);
895     MD5_STEP (MD5_Go, a, b, c, d, t[13], MD5C1c, MD5S10);
896     MD5_STEP (MD5_Go, d, a, b, c, t[ 2], MD5C1d, MD5S11);
897     MD5_STEP (MD5_Go, c, d, a, b, t[ 7], MD5C1e, MD5S12);
898     MD5_STEP (MD5_Go, b, c, d, a, t[12], MD5C1f, MD5S13);
899
900     MD5_STEP (MD5_H , a, b, c, d, t[ 5], MD5C20, MD5S20);
901     MD5_STEP (MD5_H , d, a, b, c, t[ 8], MD5C21, MD5S21);
902     MD5_STEP (MD5_H , c, d, a, b, t[11], MD5C22, MD5S22);
903     MD5_STEP (MD5_H , b, c, d, a, t[14], MD5C23, MD5S23);
904     MD5_STEP (MD5_H , a, b, c, d, t[ 1], MD5C24, MD5S20);
905     MD5_STEP (MD5_H , d, a, b, c, t[ 4], MD5C25, MD5S21);
906     MD5_STEP (MD5_H , c, d, a, b, t[ 7], MD5C26, MD5S22);
907     MD5_STEP (MD5_H , b, c, d, a, t[10], MD5C27, MD5S23);
908     MD5_STEP (MD5_H , a, b, c, d, t[13], MD5C28, MD5S20);
909     MD5_STEP (MD5_H , d, a, b, c, t[ 0], MD5C29, MD5S21);
910     MD5_STEP (MD5_H , c, d, a, b, t[ 3], MD5C2a, MD5S22);
911     MD5_STEP (MD5_H , b, c, d, a, t[ 6], MD5C2b, MD5S23);
912     MD5_STEP (MD5_H , a, b, c, d, t[ 9], MD5C2c, MD5S20);
913     MD5_STEP (MD5_H , d, a, b, c, t[12], MD5C2d, MD5S21);
914     MD5_STEP (MD5_H , c, d, a, b, t[15], MD5C2e, MD5S22);
915     MD5_STEP (MD5_H , b, c, d, a, t[ 2], MD5C2f, MD5S23);
916
917     MD5_STEP (MD5_I , a, b, c, d, t[ 0], MD5C30, MD5S30);
918     MD5_STEP (MD5_I , d, a, b, c, t[ 7], MD5C31, MD5S31);
919     MD5_STEP (MD5_I , c, d, a, b, t[14], MD5C32, MD5S32);
920     MD5_STEP (MD5_I , b, c, d, a, t[ 5], MD5C33, MD5S33);
921     MD5_STEP (MD5_I , a, b, c, d, t[12], MD5C34, MD5S30);
922     MD5_STEP (MD5_I , d, a, b, c, t[ 3], MD5C35, MD5S31);
923     MD5_STEP (MD5_I , c, d, a, b, t[10], MD5C36, MD5S32);
924     MD5_STEP (MD5_I , b, c, d, a, t[ 1], MD5C37, MD5S33);
925     MD5_STEP (MD5_I , a, b, c, d, t[ 8], MD5C38, MD5S30);
926     MD5_STEP (MD5_I , d, a, b, c, t[15], MD5C39, MD5S31);
927     MD5_STEP (MD5_I , c, d, a, b, t[ 6], MD5C3a, MD5S32);
928     MD5_STEP (MD5_I , b, c, d, a, t[13], MD5C3b, MD5S33);
929     MD5_STEP (MD5_I , a, b, c, d, t[ 4], MD5C3c, MD5S30);
930     MD5_STEP (MD5_I , d, a, b, c, t[11], MD5C3d, MD5S31);
931     MD5_STEP (MD5_I , c, d, a, b, t[ 2], MD5C3e, MD5S32);
932     MD5_STEP (MD5_I , b, c, d, a, t[ 9], MD5C3f, MD5S33);
933
934     a += MD5M_A;
935     b += MD5M_B;
936     c += MD5M_C;
937     d += MD5M_D;
938
939     a ^= c;
940     b ^= d;
941
942     const u32 r0 = a;
943     const u32 r1 = b;
944     const u32 r2 = 0;
945     const u32 r3 = 0;
946
947     #include COMPARE_S
948   }
949 }
950
951 __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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
952 {
953 }
954
955 __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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
956 {
957 }