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