293cc496d70cbcf4fed36d2db388c96e5d88d8f3
[hashcat.git] / OpenCL / m07700_a3.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 void m07700m (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_len, __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)
221 {
222   /**
223    * modifier
224    */
225
226   const u32 gid = get_global_id (0);
227   const u32 lid = get_local_id (0);
228
229   w0[0] = sapb_trans (w0[0]);
230   w0[1] = sapb_trans (w0[1]);
231
232   /**
233    * salt
234    */
235
236   u32 salt_buf0[3];
237
238   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[0];
239   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[1];
240   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[2];
241
242   salt_buf0[0] = sapb_trans (salt_buf0[0]);
243   salt_buf0[1] = sapb_trans (salt_buf0[1]);
244   salt_buf0[2] = sapb_trans (salt_buf0[2]);
245
246   const u32 salt_len = salt_bufs[salt_pos].salt_len;
247
248   u32 s0[4];
249   u32 s1[4];
250   u32 s2[4];
251   u32 s3[4];
252
253   s0[0] = salt_buf0[0];
254   s0[1] = salt_buf0[1];
255   s0[2] = salt_buf0[2];
256   s0[3] = 0;
257   s1[0] = 0;
258   s1[1] = 0;
259   s1[2] = 0;
260   s1[3] = 0;
261   s2[0] = 0;
262   s2[1] = 0;
263   s2[2] = 0;
264   s2[3] = 0;
265   s3[0] = 0;
266   s3[1] = 0;
267   s3[2] = 0;
268   s3[3] = 0;
269
270   switch_buffer_by_offset_le (s0, s1, s2, s3, pw_len);
271
272   const u32 pw_salt_len = pw_len + salt_len;
273
274   /**
275    * loop
276    */
277
278   u32 w0l = w0[0];
279
280   for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
281   {
282     const u32x w0r = sapb_trans (ix_create_bft (bfs_buf, il_pos));
283
284     const u32x w0lr = w0l | w0r;
285
286     w0[0] = w0lr;
287
288     u32 t[16];
289
290     t[ 0] = s0[0] | w0[0];
291     t[ 1] = s0[1] | w0[1];
292     t[ 2] = s0[2];
293     t[ 3] = s0[3];
294     t[ 4] = s1[0];
295     t[ 5] = 0;
296     t[ 6] = 0;
297     t[ 7] = 0;
298     t[ 8] = 0;
299     t[ 9] = 0;
300     t[10] = 0;
301     t[11] = 0;
302     t[12] = 0;
303     t[13] = 0;
304     t[14] = pw_salt_len * 8;
305     t[15] = 0;
306
307     PUTCHAR (t, pw_salt_len, 0x80);
308
309     /**
310      * md5
311      */
312
313     u32 a = MD5M_A;
314     u32 b = MD5M_B;
315     u32 c = MD5M_C;
316     u32 d = MD5M_D;
317
318     MD5_STEP (MD5_Fo, a, b, c, d, t[ 0], MD5C00, MD5S00);
319     MD5_STEP (MD5_Fo, d, a, b, c, t[ 1], MD5C01, MD5S01);
320     MD5_STEP (MD5_Fo, c, d, a, b, t[ 2], MD5C02, MD5S02);
321     MD5_STEP (MD5_Fo, b, c, d, a, t[ 3], MD5C03, MD5S03);
322     MD5_STEP (MD5_Fo, a, b, c, d, t[ 4], MD5C04, MD5S00);
323     MD5_STEP (MD5_Fo, d, a, b, c, t[ 5], MD5C05, MD5S01);
324     MD5_STEP (MD5_Fo, c, d, a, b, t[ 6], MD5C06, MD5S02);
325     MD5_STEP (MD5_Fo, b, c, d, a, t[ 7], MD5C07, MD5S03);
326     MD5_STEP (MD5_Fo, a, b, c, d, t[ 8], MD5C08, MD5S00);
327     MD5_STEP (MD5_Fo, d, a, b, c, t[ 9], MD5C09, MD5S01);
328     MD5_STEP (MD5_Fo, c, d, a, b, t[10], MD5C0a, MD5S02);
329     MD5_STEP (MD5_Fo, b, c, d, a, t[11], MD5C0b, MD5S03);
330     MD5_STEP (MD5_Fo, a, b, c, d, t[12], MD5C0c, MD5S00);
331     MD5_STEP (MD5_Fo, d, a, b, c, t[13], MD5C0d, MD5S01);
332     MD5_STEP (MD5_Fo, c, d, a, b, t[14], MD5C0e, MD5S02);
333     MD5_STEP (MD5_Fo, b, c, d, a, t[15], MD5C0f, MD5S03);
334
335     MD5_STEP (MD5_Go, a, b, c, d, t[ 1], MD5C10, MD5S10);
336     MD5_STEP (MD5_Go, d, a, b, c, t[ 6], MD5C11, MD5S11);
337     MD5_STEP (MD5_Go, c, d, a, b, t[11], MD5C12, MD5S12);
338     MD5_STEP (MD5_Go, b, c, d, a, t[ 0], MD5C13, MD5S13);
339     MD5_STEP (MD5_Go, a, b, c, d, t[ 5], MD5C14, MD5S10);
340     MD5_STEP (MD5_Go, d, a, b, c, t[10], MD5C15, MD5S11);
341     MD5_STEP (MD5_Go, c, d, a, b, t[15], MD5C16, MD5S12);
342     MD5_STEP (MD5_Go, b, c, d, a, t[ 4], MD5C17, MD5S13);
343     MD5_STEP (MD5_Go, a, b, c, d, t[ 9], MD5C18, MD5S10);
344     MD5_STEP (MD5_Go, d, a, b, c, t[14], MD5C19, MD5S11);
345     MD5_STEP (MD5_Go, c, d, a, b, t[ 3], MD5C1a, MD5S12);
346     MD5_STEP (MD5_Go, b, c, d, a, t[ 8], MD5C1b, MD5S13);
347     MD5_STEP (MD5_Go, a, b, c, d, t[13], MD5C1c, MD5S10);
348     MD5_STEP (MD5_Go, d, a, b, c, t[ 2], MD5C1d, MD5S11);
349     MD5_STEP (MD5_Go, c, d, a, b, t[ 7], MD5C1e, MD5S12);
350     MD5_STEP (MD5_Go, b, c, d, a, t[12], MD5C1f, MD5S13);
351
352     MD5_STEP (MD5_H , a, b, c, d, t[ 5], MD5C20, MD5S20);
353     MD5_STEP (MD5_H , d, a, b, c, t[ 8], MD5C21, MD5S21);
354     MD5_STEP (MD5_H , c, d, a, b, t[11], MD5C22, MD5S22);
355     MD5_STEP (MD5_H , b, c, d, a, t[14], MD5C23, MD5S23);
356     MD5_STEP (MD5_H , a, b, c, d, t[ 1], MD5C24, MD5S20);
357     MD5_STEP (MD5_H , d, a, b, c, t[ 4], MD5C25, MD5S21);
358     MD5_STEP (MD5_H , c, d, a, b, t[ 7], MD5C26, MD5S22);
359     MD5_STEP (MD5_H , b, c, d, a, t[10], MD5C27, MD5S23);
360     MD5_STEP (MD5_H , a, b, c, d, t[13], MD5C28, MD5S20);
361     MD5_STEP (MD5_H , d, a, b, c, t[ 0], MD5C29, MD5S21);
362     MD5_STEP (MD5_H , c, d, a, b, t[ 3], MD5C2a, MD5S22);
363     MD5_STEP (MD5_H , b, c, d, a, t[ 6], MD5C2b, MD5S23);
364     MD5_STEP (MD5_H , a, b, c, d, t[ 9], MD5C2c, MD5S20);
365     MD5_STEP (MD5_H , d, a, b, c, t[12], MD5C2d, MD5S21);
366     MD5_STEP (MD5_H , c, d, a, b, t[15], MD5C2e, MD5S22);
367     MD5_STEP (MD5_H , b, c, d, a, t[ 2], MD5C2f, MD5S23);
368
369     MD5_STEP (MD5_I , a, b, c, d, t[ 0], MD5C30, MD5S30);
370     MD5_STEP (MD5_I , d, a, b, c, t[ 7], MD5C31, MD5S31);
371     MD5_STEP (MD5_I , c, d, a, b, t[14], MD5C32, MD5S32);
372     MD5_STEP (MD5_I , b, c, d, a, t[ 5], MD5C33, MD5S33);
373     MD5_STEP (MD5_I , a, b, c, d, t[12], MD5C34, MD5S30);
374     MD5_STEP (MD5_I , d, a, b, c, t[ 3], MD5C35, MD5S31);
375     MD5_STEP (MD5_I , c, d, a, b, t[10], MD5C36, MD5S32);
376     MD5_STEP (MD5_I , b, c, d, a, t[ 1], MD5C37, MD5S33);
377     MD5_STEP (MD5_I , a, b, c, d, t[ 8], MD5C38, MD5S30);
378     MD5_STEP (MD5_I , d, a, b, c, t[15], MD5C39, MD5S31);
379     MD5_STEP (MD5_I , c, d, a, b, t[ 6], MD5C3a, MD5S32);
380     MD5_STEP (MD5_I , b, c, d, a, t[13], MD5C3b, MD5S33);
381     MD5_STEP (MD5_I , a, b, c, d, t[ 4], MD5C3c, MD5S30);
382     MD5_STEP (MD5_I , d, a, b, c, t[11], MD5C3d, MD5S31);
383     MD5_STEP (MD5_I , c, d, a, b, t[ 2], MD5C3e, MD5S32);
384     MD5_STEP (MD5_I , b, c, d, a, t[ 9], MD5C3f, MD5S33);
385
386     a += MD5M_A;
387     b += MD5M_B;
388     c += MD5M_C;
389     d += MD5M_D;
390
391     const u32 sum20 = walld0rf_magic (w0, pw_len, salt_buf0, salt_len, a, b, c, d, t);
392
393     SETSHIFTEDINT (t, sum20, 0x80);
394
395     t[14] = sum20 * 8;
396
397     a = MD5M_A;
398     b = MD5M_B;
399     c = MD5M_C;
400     d = MD5M_D;
401
402     MD5_STEP (MD5_Fo, a, b, c, d, t[ 0], MD5C00, MD5S00);
403     MD5_STEP (MD5_Fo, d, a, b, c, t[ 1], MD5C01, MD5S01);
404     MD5_STEP (MD5_Fo, c, d, a, b, t[ 2], MD5C02, MD5S02);
405     MD5_STEP (MD5_Fo, b, c, d, a, t[ 3], MD5C03, MD5S03);
406     MD5_STEP (MD5_Fo, a, b, c, d, t[ 4], MD5C04, MD5S00);
407     MD5_STEP (MD5_Fo, d, a, b, c, t[ 5], MD5C05, MD5S01);
408     MD5_STEP (MD5_Fo, c, d, a, b, t[ 6], MD5C06, MD5S02);
409     MD5_STEP (MD5_Fo, b, c, d, a, t[ 7], MD5C07, MD5S03);
410     MD5_STEP (MD5_Fo, a, b, c, d, t[ 8], MD5C08, MD5S00);
411     MD5_STEP (MD5_Fo, d, a, b, c, t[ 9], MD5C09, MD5S01);
412     MD5_STEP (MD5_Fo, c, d, a, b, t[10], MD5C0a, MD5S02);
413     MD5_STEP (MD5_Fo, b, c, d, a, t[11], MD5C0b, MD5S03);
414     MD5_STEP (MD5_Fo, a, b, c, d, t[12], MD5C0c, MD5S00);
415     MD5_STEP (MD5_Fo, d, a, b, c, t[13], MD5C0d, MD5S01);
416     MD5_STEP (MD5_Fo, c, d, a, b, t[14], MD5C0e, MD5S02);
417     MD5_STEP (MD5_Fo, b, c, d, a, t[15], MD5C0f, MD5S03);
418
419     MD5_STEP (MD5_Go, a, b, c, d, t[ 1], MD5C10, MD5S10);
420     MD5_STEP (MD5_Go, d, a, b, c, t[ 6], MD5C11, MD5S11);
421     MD5_STEP (MD5_Go, c, d, a, b, t[11], MD5C12, MD5S12);
422     MD5_STEP (MD5_Go, b, c, d, a, t[ 0], MD5C13, MD5S13);
423     MD5_STEP (MD5_Go, a, b, c, d, t[ 5], MD5C14, MD5S10);
424     MD5_STEP (MD5_Go, d, a, b, c, t[10], MD5C15, MD5S11);
425     MD5_STEP (MD5_Go, c, d, a, b, t[15], MD5C16, MD5S12);
426     MD5_STEP (MD5_Go, b, c, d, a, t[ 4], MD5C17, MD5S13);
427     MD5_STEP (MD5_Go, a, b, c, d, t[ 9], MD5C18, MD5S10);
428     MD5_STEP (MD5_Go, d, a, b, c, t[14], MD5C19, MD5S11);
429     MD5_STEP (MD5_Go, c, d, a, b, t[ 3], MD5C1a, MD5S12);
430     MD5_STEP (MD5_Go, b, c, d, a, t[ 8], MD5C1b, MD5S13);
431     MD5_STEP (MD5_Go, a, b, c, d, t[13], MD5C1c, MD5S10);
432     MD5_STEP (MD5_Go, d, a, b, c, t[ 2], MD5C1d, MD5S11);
433     MD5_STEP (MD5_Go, c, d, a, b, t[ 7], MD5C1e, MD5S12);
434     MD5_STEP (MD5_Go, b, c, d, a, t[12], MD5C1f, MD5S13);
435
436     MD5_STEP (MD5_H , a, b, c, d, t[ 5], MD5C20, MD5S20);
437     MD5_STEP (MD5_H , d, a, b, c, t[ 8], MD5C21, MD5S21);
438     MD5_STEP (MD5_H , c, d, a, b, t[11], MD5C22, MD5S22);
439     MD5_STEP (MD5_H , b, c, d, a, t[14], MD5C23, MD5S23);
440     MD5_STEP (MD5_H , a, b, c, d, t[ 1], MD5C24, MD5S20);
441     MD5_STEP (MD5_H , d, a, b, c, t[ 4], MD5C25, MD5S21);
442     MD5_STEP (MD5_H , c, d, a, b, t[ 7], MD5C26, MD5S22);
443     MD5_STEP (MD5_H , b, c, d, a, t[10], MD5C27, MD5S23);
444     MD5_STEP (MD5_H , a, b, c, d, t[13], MD5C28, MD5S20);
445     MD5_STEP (MD5_H , d, a, b, c, t[ 0], MD5C29, MD5S21);
446     MD5_STEP (MD5_H , c, d, a, b, t[ 3], MD5C2a, MD5S22);
447     MD5_STEP (MD5_H , b, c, d, a, t[ 6], MD5C2b, MD5S23);
448     MD5_STEP (MD5_H , a, b, c, d, t[ 9], MD5C2c, MD5S20);
449     MD5_STEP (MD5_H , d, a, b, c, t[12], MD5C2d, MD5S21);
450     MD5_STEP (MD5_H , c, d, a, b, t[15], MD5C2e, MD5S22);
451     MD5_STEP (MD5_H , b, c, d, a, t[ 2], MD5C2f, MD5S23);
452
453     MD5_STEP (MD5_I , a, b, c, d, t[ 0], MD5C30, MD5S30);
454     MD5_STEP (MD5_I , d, a, b, c, t[ 7], MD5C31, MD5S31);
455     MD5_STEP (MD5_I , c, d, a, b, t[14], MD5C32, MD5S32);
456     MD5_STEP (MD5_I , b, c, d, a, t[ 5], MD5C33, MD5S33);
457     MD5_STEP (MD5_I , a, b, c, d, t[12], MD5C34, MD5S30);
458     MD5_STEP (MD5_I , d, a, b, c, t[ 3], MD5C35, MD5S31);
459     MD5_STEP (MD5_I , c, d, a, b, t[10], MD5C36, MD5S32);
460     MD5_STEP (MD5_I , b, c, d, a, t[ 1], MD5C37, MD5S33);
461     MD5_STEP (MD5_I , a, b, c, d, t[ 8], MD5C38, MD5S30);
462     MD5_STEP (MD5_I , d, a, b, c, t[15], MD5C39, MD5S31);
463     MD5_STEP (MD5_I , c, d, a, b, t[ 6], MD5C3a, MD5S32);
464     MD5_STEP (MD5_I , b, c, d, a, t[13], MD5C3b, MD5S33);
465     MD5_STEP (MD5_I , a, b, c, d, t[ 4], MD5C3c, MD5S30);
466     MD5_STEP (MD5_I , d, a, b, c, t[11], MD5C3d, MD5S31);
467     MD5_STEP (MD5_I , c, d, a, b, t[ 2], MD5C3e, MD5S32);
468     MD5_STEP (MD5_I , b, c, d, a, t[ 9], MD5C3f, MD5S33);
469
470     a += MD5M_A;
471     b += MD5M_B;
472     c += MD5M_C;
473     d += MD5M_D;
474
475     a ^= c;
476     b ^= d;
477     c  = 0;
478     d  = 0;
479
480     COMPARE_M_SIMD (a, b, c, d);
481   }
482 }
483
484 void m07700s (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_len, __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)
485 {
486   /**
487    * modifier
488    */
489
490   const u32 gid = get_global_id (0);
491   const u32 lid = get_local_id (0);
492
493   w0[0] = sapb_trans (w0[0]);
494   w0[1] = sapb_trans (w0[1]);
495
496   /**
497    * salt
498    */
499
500   u32 salt_buf0[3];
501
502   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[0];
503   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[1];
504   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[2];
505
506   salt_buf0[0] = sapb_trans (salt_buf0[0]);
507   salt_buf0[1] = sapb_trans (salt_buf0[1]);
508   salt_buf0[2] = sapb_trans (salt_buf0[2]);
509
510   const u32 salt_len = salt_bufs[salt_pos].salt_len;
511
512   u32 s0[4];
513   u32 s1[4];
514   u32 s2[4];
515   u32 s3[4];
516
517   s0[0] = salt_buf0[0];
518   s0[1] = salt_buf0[1];
519   s0[2] = salt_buf0[2];
520   s0[3] = 0;
521   s1[0] = 0;
522   s1[1] = 0;
523   s1[2] = 0;
524   s1[3] = 0;
525   s2[0] = 0;
526   s2[1] = 0;
527   s2[2] = 0;
528   s2[3] = 0;
529   s3[0] = 0;
530   s3[1] = 0;
531   s3[2] = 0;
532   s3[3] = 0;
533
534   switch_buffer_by_offset_le (s0, s1, s2, s3, pw_len);
535
536   const u32 pw_salt_len = pw_len + salt_len;
537
538   /**
539    * digest
540    */
541
542   const u32 search[4] =
543   {
544     digests_buf[digests_offset].digest_buf[DGST_R0],
545     digests_buf[digests_offset].digest_buf[DGST_R1],
546     0,
547     0
548   };
549
550   /**
551    * loop
552    */
553
554   u32 w0l = w0[0];
555
556   for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
557   {
558     const u32x w0r = sapb_trans (ix_create_bft (bfs_buf, il_pos));
559
560     const u32x w0lr = w0l | w0r;
561
562     w0[0] = w0lr;
563
564     u32 t[16];
565
566     t[ 0] = s0[0] | w0[0];
567     t[ 1] = s0[1] | w0[1];
568     t[ 2] = s0[2];
569     t[ 3] = s0[3];
570     t[ 4] = s1[0];
571     t[ 5] = 0;
572     t[ 6] = 0;
573     t[ 7] = 0;
574     t[ 8] = 0;
575     t[ 9] = 0;
576     t[10] = 0;
577     t[11] = 0;
578     t[12] = 0;
579     t[13] = 0;
580     t[14] = pw_salt_len * 8;
581     t[15] = 0;
582
583     PUTCHAR (t, pw_salt_len, 0x80);
584
585     /**
586      * md5
587      */
588
589     u32 a = MD5M_A;
590     u32 b = MD5M_B;
591     u32 c = MD5M_C;
592     u32 d = MD5M_D;
593
594     MD5_STEP (MD5_Fo, a, b, c, d, t[ 0], MD5C00, MD5S00);
595     MD5_STEP (MD5_Fo, d, a, b, c, t[ 1], MD5C01, MD5S01);
596     MD5_STEP (MD5_Fo, c, d, a, b, t[ 2], MD5C02, MD5S02);
597     MD5_STEP (MD5_Fo, b, c, d, a, t[ 3], MD5C03, MD5S03);
598     MD5_STEP (MD5_Fo, a, b, c, d, t[ 4], MD5C04, MD5S00);
599     MD5_STEP (MD5_Fo, d, a, b, c, t[ 5], MD5C05, MD5S01);
600     MD5_STEP (MD5_Fo, c, d, a, b, t[ 6], MD5C06, MD5S02);
601     MD5_STEP (MD5_Fo, b, c, d, a, t[ 7], MD5C07, MD5S03);
602     MD5_STEP (MD5_Fo, a, b, c, d, t[ 8], MD5C08, MD5S00);
603     MD5_STEP (MD5_Fo, d, a, b, c, t[ 9], MD5C09, MD5S01);
604     MD5_STEP (MD5_Fo, c, d, a, b, t[10], MD5C0a, MD5S02);
605     MD5_STEP (MD5_Fo, b, c, d, a, t[11], MD5C0b, MD5S03);
606     MD5_STEP (MD5_Fo, a, b, c, d, t[12], MD5C0c, MD5S00);
607     MD5_STEP (MD5_Fo, d, a, b, c, t[13], MD5C0d, MD5S01);
608     MD5_STEP (MD5_Fo, c, d, a, b, t[14], MD5C0e, MD5S02);
609     MD5_STEP (MD5_Fo, b, c, d, a, t[15], MD5C0f, MD5S03);
610
611     MD5_STEP (MD5_Go, a, b, c, d, t[ 1], MD5C10, MD5S10);
612     MD5_STEP (MD5_Go, d, a, b, c, t[ 6], MD5C11, MD5S11);
613     MD5_STEP (MD5_Go, c, d, a, b, t[11], MD5C12, MD5S12);
614     MD5_STEP (MD5_Go, b, c, d, a, t[ 0], MD5C13, MD5S13);
615     MD5_STEP (MD5_Go, a, b, c, d, t[ 5], MD5C14, MD5S10);
616     MD5_STEP (MD5_Go, d, a, b, c, t[10], MD5C15, MD5S11);
617     MD5_STEP (MD5_Go, c, d, a, b, t[15], MD5C16, MD5S12);
618     MD5_STEP (MD5_Go, b, c, d, a, t[ 4], MD5C17, MD5S13);
619     MD5_STEP (MD5_Go, a, b, c, d, t[ 9], MD5C18, MD5S10);
620     MD5_STEP (MD5_Go, d, a, b, c, t[14], MD5C19, MD5S11);
621     MD5_STEP (MD5_Go, c, d, a, b, t[ 3], MD5C1a, MD5S12);
622     MD5_STEP (MD5_Go, b, c, d, a, t[ 8], MD5C1b, MD5S13);
623     MD5_STEP (MD5_Go, a, b, c, d, t[13], MD5C1c, MD5S10);
624     MD5_STEP (MD5_Go, d, a, b, c, t[ 2], MD5C1d, MD5S11);
625     MD5_STEP (MD5_Go, c, d, a, b, t[ 7], MD5C1e, MD5S12);
626     MD5_STEP (MD5_Go, b, c, d, a, t[12], MD5C1f, MD5S13);
627
628     MD5_STEP (MD5_H , a, b, c, d, t[ 5], MD5C20, MD5S20);
629     MD5_STEP (MD5_H , d, a, b, c, t[ 8], MD5C21, MD5S21);
630     MD5_STEP (MD5_H , c, d, a, b, t[11], MD5C22, MD5S22);
631     MD5_STEP (MD5_H , b, c, d, a, t[14], MD5C23, MD5S23);
632     MD5_STEP (MD5_H , a, b, c, d, t[ 1], MD5C24, MD5S20);
633     MD5_STEP (MD5_H , d, a, b, c, t[ 4], MD5C25, MD5S21);
634     MD5_STEP (MD5_H , c, d, a, b, t[ 7], MD5C26, MD5S22);
635     MD5_STEP (MD5_H , b, c, d, a, t[10], MD5C27, MD5S23);
636     MD5_STEP (MD5_H , a, b, c, d, t[13], MD5C28, MD5S20);
637     MD5_STEP (MD5_H , d, a, b, c, t[ 0], MD5C29, MD5S21);
638     MD5_STEP (MD5_H , c, d, a, b, t[ 3], MD5C2a, MD5S22);
639     MD5_STEP (MD5_H , b, c, d, a, t[ 6], MD5C2b, MD5S23);
640     MD5_STEP (MD5_H , a, b, c, d, t[ 9], MD5C2c, MD5S20);
641     MD5_STEP (MD5_H , d, a, b, c, t[12], MD5C2d, MD5S21);
642     MD5_STEP (MD5_H , c, d, a, b, t[15], MD5C2e, MD5S22);
643     MD5_STEP (MD5_H , b, c, d, a, t[ 2], MD5C2f, MD5S23);
644
645     MD5_STEP (MD5_I , a, b, c, d, t[ 0], MD5C30, MD5S30);
646     MD5_STEP (MD5_I , d, a, b, c, t[ 7], MD5C31, MD5S31);
647     MD5_STEP (MD5_I , c, d, a, b, t[14], MD5C32, MD5S32);
648     MD5_STEP (MD5_I , b, c, d, a, t[ 5], MD5C33, MD5S33);
649     MD5_STEP (MD5_I , a, b, c, d, t[12], MD5C34, MD5S30);
650     MD5_STEP (MD5_I , d, a, b, c, t[ 3], MD5C35, MD5S31);
651     MD5_STEP (MD5_I , c, d, a, b, t[10], MD5C36, MD5S32);
652     MD5_STEP (MD5_I , b, c, d, a, t[ 1], MD5C37, MD5S33);
653     MD5_STEP (MD5_I , a, b, c, d, t[ 8], MD5C38, MD5S30);
654     MD5_STEP (MD5_I , d, a, b, c, t[15], MD5C39, MD5S31);
655     MD5_STEP (MD5_I , c, d, a, b, t[ 6], MD5C3a, MD5S32);
656     MD5_STEP (MD5_I , b, c, d, a, t[13], MD5C3b, MD5S33);
657     MD5_STEP (MD5_I , a, b, c, d, t[ 4], MD5C3c, MD5S30);
658     MD5_STEP (MD5_I , d, a, b, c, t[11], MD5C3d, MD5S31);
659     MD5_STEP (MD5_I , c, d, a, b, t[ 2], MD5C3e, MD5S32);
660     MD5_STEP (MD5_I , b, c, d, a, t[ 9], MD5C3f, MD5S33);
661
662     a += MD5M_A;
663     b += MD5M_B;
664     c += MD5M_C;
665     d += MD5M_D;
666
667     const u32 sum20 = walld0rf_magic (w0, pw_len, salt_buf0, salt_len, a, b, c, d, t);
668
669     SETSHIFTEDINT (t, sum20, 0x80);
670
671     t[14] = sum20 * 8;
672
673     a = MD5M_A;
674     b = MD5M_B;
675     c = MD5M_C;
676     d = MD5M_D;
677
678     MD5_STEP (MD5_Fo, a, b, c, d, t[ 0], MD5C00, MD5S00);
679     MD5_STEP (MD5_Fo, d, a, b, c, t[ 1], MD5C01, MD5S01);
680     MD5_STEP (MD5_Fo, c, d, a, b, t[ 2], MD5C02, MD5S02);
681     MD5_STEP (MD5_Fo, b, c, d, a, t[ 3], MD5C03, MD5S03);
682     MD5_STEP (MD5_Fo, a, b, c, d, t[ 4], MD5C04, MD5S00);
683     MD5_STEP (MD5_Fo, d, a, b, c, t[ 5], MD5C05, MD5S01);
684     MD5_STEP (MD5_Fo, c, d, a, b, t[ 6], MD5C06, MD5S02);
685     MD5_STEP (MD5_Fo, b, c, d, a, t[ 7], MD5C07, MD5S03);
686     MD5_STEP (MD5_Fo, a, b, c, d, t[ 8], MD5C08, MD5S00);
687     MD5_STEP (MD5_Fo, d, a, b, c, t[ 9], MD5C09, MD5S01);
688     MD5_STEP (MD5_Fo, c, d, a, b, t[10], MD5C0a, MD5S02);
689     MD5_STEP (MD5_Fo, b, c, d, a, t[11], MD5C0b, MD5S03);
690     MD5_STEP (MD5_Fo, a, b, c, d, t[12], MD5C0c, MD5S00);
691     MD5_STEP (MD5_Fo, d, a, b, c, t[13], MD5C0d, MD5S01);
692     MD5_STEP (MD5_Fo, c, d, a, b, t[14], MD5C0e, MD5S02);
693     MD5_STEP (MD5_Fo, b, c, d, a, t[15], MD5C0f, MD5S03);
694
695     MD5_STEP (MD5_Go, a, b, c, d, t[ 1], MD5C10, MD5S10);
696     MD5_STEP (MD5_Go, d, a, b, c, t[ 6], MD5C11, MD5S11);
697     MD5_STEP (MD5_Go, c, d, a, b, t[11], MD5C12, MD5S12);
698     MD5_STEP (MD5_Go, b, c, d, a, t[ 0], MD5C13, MD5S13);
699     MD5_STEP (MD5_Go, a, b, c, d, t[ 5], MD5C14, MD5S10);
700     MD5_STEP (MD5_Go, d, a, b, c, t[10], MD5C15, MD5S11);
701     MD5_STEP (MD5_Go, c, d, a, b, t[15], MD5C16, MD5S12);
702     MD5_STEP (MD5_Go, b, c, d, a, t[ 4], MD5C17, MD5S13);
703     MD5_STEP (MD5_Go, a, b, c, d, t[ 9], MD5C18, MD5S10);
704     MD5_STEP (MD5_Go, d, a, b, c, t[14], MD5C19, MD5S11);
705     MD5_STEP (MD5_Go, c, d, a, b, t[ 3], MD5C1a, MD5S12);
706     MD5_STEP (MD5_Go, b, c, d, a, t[ 8], MD5C1b, MD5S13);
707     MD5_STEP (MD5_Go, a, b, c, d, t[13], MD5C1c, MD5S10);
708     MD5_STEP (MD5_Go, d, a, b, c, t[ 2], MD5C1d, MD5S11);
709     MD5_STEP (MD5_Go, c, d, a, b, t[ 7], MD5C1e, MD5S12);
710     MD5_STEP (MD5_Go, b, c, d, a, t[12], MD5C1f, MD5S13);
711
712     MD5_STEP (MD5_H , a, b, c, d, t[ 5], MD5C20, MD5S20);
713     MD5_STEP (MD5_H , d, a, b, c, t[ 8], MD5C21, MD5S21);
714     MD5_STEP (MD5_H , c, d, a, b, t[11], MD5C22, MD5S22);
715     MD5_STEP (MD5_H , b, c, d, a, t[14], MD5C23, MD5S23);
716     MD5_STEP (MD5_H , a, b, c, d, t[ 1], MD5C24, MD5S20);
717     MD5_STEP (MD5_H , d, a, b, c, t[ 4], MD5C25, MD5S21);
718     MD5_STEP (MD5_H , c, d, a, b, t[ 7], MD5C26, MD5S22);
719     MD5_STEP (MD5_H , b, c, d, a, t[10], MD5C27, MD5S23);
720     MD5_STEP (MD5_H , a, b, c, d, t[13], MD5C28, MD5S20);
721     MD5_STEP (MD5_H , d, a, b, c, t[ 0], MD5C29, MD5S21);
722     MD5_STEP (MD5_H , c, d, a, b, t[ 3], MD5C2a, MD5S22);
723     MD5_STEP (MD5_H , b, c, d, a, t[ 6], MD5C2b, MD5S23);
724     MD5_STEP (MD5_H , a, b, c, d, t[ 9], MD5C2c, MD5S20);
725     MD5_STEP (MD5_H , d, a, b, c, t[12], MD5C2d, MD5S21);
726     MD5_STEP (MD5_H , c, d, a, b, t[15], MD5C2e, MD5S22);
727     MD5_STEP (MD5_H , b, c, d, a, t[ 2], MD5C2f, MD5S23);
728
729     MD5_STEP (MD5_I , a, b, c, d, t[ 0], MD5C30, MD5S30);
730     MD5_STEP (MD5_I , d, a, b, c, t[ 7], MD5C31, MD5S31);
731     MD5_STEP (MD5_I , c, d, a, b, t[14], MD5C32, MD5S32);
732     MD5_STEP (MD5_I , b, c, d, a, t[ 5], MD5C33, MD5S33);
733     MD5_STEP (MD5_I , a, b, c, d, t[12], MD5C34, MD5S30);
734     MD5_STEP (MD5_I , d, a, b, c, t[ 3], MD5C35, MD5S31);
735     MD5_STEP (MD5_I , c, d, a, b, t[10], MD5C36, MD5S32);
736     MD5_STEP (MD5_I , b, c, d, a, t[ 1], MD5C37, MD5S33);
737     MD5_STEP (MD5_I , a, b, c, d, t[ 8], MD5C38, MD5S30);
738     MD5_STEP (MD5_I , d, a, b, c, t[15], MD5C39, MD5S31);
739     MD5_STEP (MD5_I , c, d, a, b, t[ 6], MD5C3a, MD5S32);
740     MD5_STEP (MD5_I , b, c, d, a, t[13], MD5C3b, MD5S33);
741     MD5_STEP (MD5_I , a, b, c, d, t[ 4], MD5C3c, MD5S30);
742     MD5_STEP (MD5_I , d, a, b, c, t[11], MD5C3d, MD5S31);
743     MD5_STEP (MD5_I , c, d, a, b, t[ 2], MD5C3e, MD5S32);
744     MD5_STEP (MD5_I , b, c, d, a, t[ 9], MD5C3f, MD5S33);
745
746     a += MD5M_A;
747     b += MD5M_B;
748     c += MD5M_C;
749     d += MD5M_D;
750
751     a ^= c;
752     b ^= d;
753     c  = 0;
754     d  = 0;
755
756     COMPARE_S_SIMD (a, b, c, d);
757   }
758 }
759
760 __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)
761 {
762   /**
763    * base
764    */
765
766   const u32 gid = get_global_id (0);
767
768   if (gid >= gid_max) return;
769
770   /**
771    * modifier
772    */
773
774   //const u32 lid = get_local_id (0);
775
776   u32 w0[4];
777
778   w0[0] = pws[gid].i[ 0];
779   w0[1] = pws[gid].i[ 1];
780   w0[2] = pws[gid].i[ 2];
781   w0[3] = pws[gid].i[ 3];
782
783   u32 w1[4];
784
785   w1[0] = 0;
786   w1[1] = 0;
787   w1[2] = 0;
788   w1[3] = 0;
789
790   u32 w2[4];
791
792   w2[0] = 0;
793   w2[1] = 0;
794   w2[2] = 0;
795   w2[3] = 0;
796
797   u32 w3[4];
798
799   w3[0] = 0;
800   w3[1] = 0;
801   w3[2] = 0;
802   w3[3] = 0;
803
804   const u32 pw_len = pws[gid].pw_len;
805
806   /**
807    * main
808    */
809
810   m07700m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset);
811 }
812
813 __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)
814 {
815   /**
816    * base
817    */
818
819   const u32 gid = get_global_id (0);
820
821   if (gid >= gid_max) return;
822
823   /**
824    * modifier
825    */
826
827   //const u32 lid = get_local_id (0);
828
829   u32 w0[4];
830
831   w0[0] = pws[gid].i[ 0];
832   w0[1] = pws[gid].i[ 1];
833   w0[2] = pws[gid].i[ 2];
834   w0[3] = pws[gid].i[ 3];
835
836   u32 w1[4];
837
838   w1[0] = pws[gid].i[ 4];
839   w1[1] = pws[gid].i[ 5];
840   w1[2] = pws[gid].i[ 6];
841   w1[3] = pws[gid].i[ 7];
842
843   u32 w2[4];
844
845   w2[0] = 0;
846   w2[1] = 0;
847   w2[2] = 0;
848   w2[3] = 0;
849
850   u32 w3[4];
851
852   w3[0] = 0;
853   w3[1] = 0;
854   w3[2] = 0;
855   w3[3] = 0;
856
857   const u32 pw_len = pws[gid].pw_len;
858
859   /**
860    * main
861    */
862
863   m07700m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset);
864 }
865
866 __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)
867 {
868 }
869
870 __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)
871 {
872   /**
873    * base
874    */
875
876   const u32 gid = get_global_id (0);
877
878   if (gid >= gid_max) return;
879
880   /**
881    * modifier
882    */
883
884   //const u32 lid = get_local_id (0);
885
886   u32 w0[4];
887
888   w0[0] = pws[gid].i[ 0];
889   w0[1] = pws[gid].i[ 1];
890   w0[2] = pws[gid].i[ 2];
891   w0[3] = pws[gid].i[ 3];
892
893   u32 w1[4];
894
895   w1[0] = 0;
896   w1[1] = 0;
897   w1[2] = 0;
898   w1[3] = 0;
899
900   u32 w2[4];
901
902   w2[0] = 0;
903   w2[1] = 0;
904   w2[2] = 0;
905   w2[3] = 0;
906
907   u32 w3[4];
908
909   w3[0] = 0;
910   w3[1] = 0;
911   w3[2] = 0;
912   w3[3] = 0;
913
914   const u32 pw_len = pws[gid].pw_len;
915
916   /**
917    * main
918    */
919
920   m07700s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset);
921 }
922
923 __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)
924 {
925   /**
926    * base
927    */
928
929   const u32 gid = get_global_id (0);
930
931   if (gid >= gid_max) return;
932
933   /**
934    * modifier
935    */
936
937   //const u32 lid = get_local_id (0);
938
939   u32 w0[4];
940
941   w0[0] = pws[gid].i[ 0];
942   w0[1] = pws[gid].i[ 1];
943   w0[2] = pws[gid].i[ 2];
944   w0[3] = pws[gid].i[ 3];
945
946   u32 w1[4];
947
948   w1[0] = pws[gid].i[ 4];
949   w1[1] = pws[gid].i[ 5];
950   w1[2] = pws[gid].i[ 6];
951   w1[3] = pws[gid].i[ 7];
952
953   u32 w2[4];
954
955   w2[0] = 0;
956   w2[1] = 0;
957   w2[2] = 0;
958   w2[3] = 0;
959
960   u32 w3[4];
961
962   w3[0] = 0;
963   w3[1] = 0;
964   w3[2] = 0;
965   w3[3] = 0;
966
967   const u32 pw_len = pws[gid].pw_len;
968
969   /**
970    * main
971    */
972
973   m07700s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset);
974 }
975
976 __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)
977 {
978 }