Initial commit
[hashcat.git] / amd / m08600_a3.cl
1 /**
2  * Author......: Jens Steube <jens.steube@gmail.com>
3  * License.....: MIT
4  */
5
6 #define _LOTUS5_
7 #define _SCALAR_
8
9 #include "include/constants.h"
10 #include "include/kernel_vendor.h"
11
12 #ifdef  VLIW1
13 #define VECT_SIZE1
14 #endif
15
16 #ifdef  VLIW4
17 #define VECT_SIZE4
18 #endif
19
20 #ifdef  VLIW5
21 #define VECT_SIZE4
22 #endif
23
24 #define DGST_R0 0
25 #define DGST_R1 1
26 #define DGST_R2 2
27 #define DGST_R3 3
28
29 #include "include/kernel_functions.c"
30 #include "types_amd.c"
31 #include "common_amd.c"
32
33 #ifdef  VECT_SIZE1
34 #define VECT_COMPARE_S "check_single_vect1_comp4_warp.c"
35 #define VECT_COMPARE_M "check_multi_vect1_comp4_warp.c"
36 #endif
37
38 #ifdef  VECT_SIZE2
39 #define VECT_COMPARE_S "check_single_vect2_comp4_warp.c"
40 #define VECT_COMPARE_M "check_multi_vect2_comp4_warp.c"
41 #endif
42
43 #ifdef  VECT_SIZE4
44 #define VECT_COMPARE_S "check_single_vect4_comp4_warp.c"
45 #define VECT_COMPARE_M "check_multi_vect4_comp4_warp.c"
46 #endif
47
48 __constant u32 lotus_magic_table[256] =
49 {
50   0xbd, 0x56, 0xea, 0xf2, 0xa2, 0xf1, 0xac, 0x2a,
51   0xb0, 0x93, 0xd1, 0x9c, 0x1b, 0x33, 0xfd, 0xd0,
52   0x30, 0x04, 0xb6, 0xdc, 0x7d, 0xdf, 0x32, 0x4b,
53   0xf7, 0xcb, 0x45, 0x9b, 0x31, 0xbb, 0x21, 0x5a,
54   0x41, 0x9f, 0xe1, 0xd9, 0x4a, 0x4d, 0x9e, 0xda,
55   0xa0, 0x68, 0x2c, 0xc3, 0x27, 0x5f, 0x80, 0x36,
56   0x3e, 0xee, 0xfb, 0x95, 0x1a, 0xfe, 0xce, 0xa8,
57   0x34, 0xa9, 0x13, 0xf0, 0xa6, 0x3f, 0xd8, 0x0c,
58   0x78, 0x24, 0xaf, 0x23, 0x52, 0xc1, 0x67, 0x17,
59   0xf5, 0x66, 0x90, 0xe7, 0xe8, 0x07, 0xb8, 0x60,
60   0x48, 0xe6, 0x1e, 0x53, 0xf3, 0x92, 0xa4, 0x72,
61   0x8c, 0x08, 0x15, 0x6e, 0x86, 0x00, 0x84, 0xfa,
62   0xf4, 0x7f, 0x8a, 0x42, 0x19, 0xf6, 0xdb, 0xcd,
63   0x14, 0x8d, 0x50, 0x12, 0xba, 0x3c, 0x06, 0x4e,
64   0xec, 0xb3, 0x35, 0x11, 0xa1, 0x88, 0x8e, 0x2b,
65   0x94, 0x99, 0xb7, 0x71, 0x74, 0xd3, 0xe4, 0xbf,
66   0x3a, 0xde, 0x96, 0x0e, 0xbc, 0x0a, 0xed, 0x77,
67   0xfc, 0x37, 0x6b, 0x03, 0x79, 0x89, 0x62, 0xc6,
68   0xd7, 0xc0, 0xd2, 0x7c, 0x6a, 0x8b, 0x22, 0xa3,
69   0x5b, 0x05, 0x5d, 0x02, 0x75, 0xd5, 0x61, 0xe3,
70   0x18, 0x8f, 0x55, 0x51, 0xad, 0x1f, 0x0b, 0x5e,
71   0x85, 0xe5, 0xc2, 0x57, 0x63, 0xca, 0x3d, 0x6c,
72   0xb4, 0xc5, 0xcc, 0x70, 0xb2, 0x91, 0x59, 0x0d,
73   0x47, 0x20, 0xc8, 0x4f, 0x58, 0xe0, 0x01, 0xe2,
74   0x16, 0x38, 0xc4, 0x6f, 0x3b, 0x0f, 0x65, 0x46,
75   0xbe, 0x7e, 0x2d, 0x7b, 0x82, 0xf9, 0x40, 0xb5,
76   0x1d, 0x73, 0xf8, 0xeb, 0x26, 0xc7, 0x87, 0x97,
77   0x25, 0x54, 0xb1, 0x28, 0xaa, 0x98, 0x9d, 0xa5,
78   0x64, 0x6d, 0x7a, 0xd4, 0x10, 0x81, 0x44, 0xef,
79   0x49, 0xd6, 0xae, 0x2e, 0xdd, 0x76, 0x5c, 0x2f,
80   0xa7, 0x1c, 0xc9, 0x09, 0x69, 0x9a, 0x83, 0xcf,
81   0x29, 0x39, 0xb9, 0xe9, 0x4c, 0xff, 0x43, 0xab,
82 };
83
84 #ifdef VECT_SIZE1
85 #define BOX(S,i) u32x ((S)[(i)])
86 #endif
87
88 #ifdef VECT_SIZE2
89 #define BOX(S,i) u32x ((S)[(i).s0], (S)[(i).s1])
90 #endif
91
92 #ifdef VECT_SIZE4
93 #define BOX(S,i) u32x ((S)[(i).s0], (S)[(i).s1], (S)[(i).s2], (S)[(i).s3])
94 #endif
95
96 static void lotus_mix (u32x *in, __local u32 s_lotus_magic_table[256])
97 {
98   u32x p = 0;
99
100   for (int i = 0; i < 18; i++)
101   {
102     u32 s = 48;
103
104     #pragma unroll 12
105     for (int j = 0; j < 12; j++)
106     {
107       u32x tmp_in = in[j];
108       u32x tmp_out = 0;
109
110       p = (p + s--) & 0xff; p = ((tmp_in >>  0) & 0xff) ^ BOX (s_lotus_magic_table, p); tmp_out |= p <<  0;
111       p = (p + s--) & 0xff; p = ((tmp_in >>  8) & 0xff) ^ BOX (s_lotus_magic_table, p); tmp_out |= p <<  8;
112       p = (p + s--) & 0xff; p = ((tmp_in >> 16) & 0xff) ^ BOX (s_lotus_magic_table, p); tmp_out |= p << 16;
113       p = (p + s--) & 0xff; p = ((tmp_in >> 24) & 0xff) ^ BOX (s_lotus_magic_table, p); tmp_out |= p << 24;
114
115       in[j] = tmp_out;
116     }
117   }
118 }
119
120 static void lotus_transform_password (u32x *in, u32x *out, __local u32 s_lotus_magic_table[256])
121 {
122   u32x t = out[3] >> 24;
123
124   u32x c;
125
126   #pragma unroll 4
127   for (int i = 0; i < 4; i++)
128   {
129     t ^= (in[i] >>  0) & 0xff; c = BOX (s_lotus_magic_table, t); out[i] ^= c <<  0; t = ((out[i] >>  0) & 0xff);
130     t ^= (in[i] >>  8) & 0xff; c = BOX (s_lotus_magic_table, t); out[i] ^= c <<  8; t = ((out[i] >>  8) & 0xff);
131     t ^= (in[i] >> 16) & 0xff; c = BOX (s_lotus_magic_table, t); out[i] ^= c << 16; t = ((out[i] >> 16) & 0xff);
132     t ^= (in[i] >> 24) & 0xff; c = BOX (s_lotus_magic_table, t); out[i] ^= c << 24; t = ((out[i] >> 24) & 0xff);
133   }
134 }
135
136 static void pad (u32 w[4], const u32 len)
137 {
138   const u32 val = 16 - len;
139
140   const u32 mask1 = val << 24;
141
142   const u32 mask2 = val << 16
143                    | val << 24;
144
145   const u32 mask3 = val <<  8
146                    | val << 16
147                    | val << 24;
148
149   const u32 mask4 = val <<  0
150                    | val <<  8
151                    | val << 16
152                    | val << 24;
153
154   switch (len)
155   {
156     case  0:  w[0]  = mask4;
157               w[1]  = mask4;
158               w[2]  = mask4;
159               w[3]  = mask4;
160               break;
161     case  1:  w[0] |= mask3;
162               w[1]  = mask4;
163               w[2]  = mask4;
164               w[3]  = mask4;
165               break;
166     case  2:  w[0] |= mask2;
167               w[1]  = mask4;
168               w[2]  = mask4;
169               w[3]  = mask4;
170               break;
171     case  3:  w[0] |= mask1;
172               w[1]  = mask4;
173               w[2]  = mask4;
174               w[3]  = mask4;
175               break;
176     case  4:  w[1]  = mask4;
177               w[2]  = mask4;
178               w[3]  = mask4;
179               break;
180     case  5:  w[1] |= mask3;
181               w[2]  = mask4;
182               w[3]  = mask4;
183               break;
184     case  6:  w[1] |= mask2;
185               w[2]  = mask4;
186               w[3]  = mask4;
187               break;
188     case  7:  w[1] |= mask1;
189               w[2]  = mask4;
190               w[3]  = mask4;
191               break;
192     case  8:  w[2]  = mask4;
193               w[3]  = mask4;
194               break;
195     case  9:  w[2] |= mask3;
196               w[3]  = mask4;
197               break;
198     case 10:  w[2] |= mask2;
199               w[3]  = mask4;
200               break;
201     case 11:  w[2] |= mask1;
202               w[3]  = mask4;
203               break;
204     case 12:  w[3]  = mask4;
205               break;
206     case 13:  w[3] |= mask3;
207               break;
208     case 14:  w[3] |= mask2;
209               break;
210     case 15:  w[3] |= mask1;
211               break;
212   }
213 }
214
215 static void mdtransform_norecalc (u32x state[4], u32x block[4], __local u32 s_lotus_magic_table[256])
216 {
217         u32x x[12];
218
219   x[ 0] = state[0];
220   x[ 1] = state[1];
221   x[ 2] = state[2];
222   x[ 3] = state[3];
223   x[ 4] = block[0];
224   x[ 5] = block[1];
225   x[ 6] = block[2];
226   x[ 7] = block[3];
227   x[ 8] = state[0] ^ block[0];
228   x[ 9] = state[1] ^ block[1];
229   x[10] = state[2] ^ block[2];
230   x[11] = state[3] ^ block[3];
231
232   lotus_mix (x, s_lotus_magic_table);
233
234   state[0] = x[0];
235   state[1] = x[1];
236   state[2] = x[2];
237   state[3] = x[3];
238 }
239
240 static void mdtransform (u32x state[4], u32x checksum[4], u32x block[4], __local u32 s_lotus_magic_table[256])
241 {
242   mdtransform_norecalc (state, block, s_lotus_magic_table);
243
244   lotus_transform_password (block, checksum, s_lotus_magic_table);
245 }
246
247 static void domino_big_md (const u32x saved_key[16], const u32 size, u32x state[4], __local u32 s_lotus_magic_table[256])
248 {
249         u32x checksum[4];
250
251   checksum[0] = 0;
252   checksum[1] = 0;
253   checksum[2] = 0;
254   checksum[3] = 0;
255
256         u32x block[4];
257
258   block[0] = saved_key[0];
259   block[1] = saved_key[1];
260   block[2] = saved_key[2];
261   block[3] = saved_key[3];
262
263   mdtransform (state, checksum, block, s_lotus_magic_table);
264
265         mdtransform_norecalc (state, checksum, s_lotus_magic_table);
266 }
267
268 static void m08600m (__local u32 s_lotus_magic_table[256], u32 w[16], const u32 pw_len, __global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32x * words_buf_r, __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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset)
269 {
270   /**
271    * modifier
272    */
273
274   const u32 gid = get_global_id (0);
275   const u32 lid = get_local_id (0);
276
277   /**
278    * padding
279    */
280
281   if (pw_len < 16)
282   {
283     pad (&w[ 0], pw_len & 0xf);
284   }
285   else if (pw_len < 32)
286   {
287     pad (&w[ 4], pw_len & 0xf);
288   }
289   else if (pw_len < 48)
290   {
291     pad (&w[ 8], pw_len & 0xf);
292   }
293   else if (pw_len < 64)
294   {
295     pad (&w[12], pw_len & 0xf);
296   }
297
298   /**
299    * loop
300    */
301
302   const u32 bf_loops = ceil ((float) bfs_cnt / VECT_DIV);
303
304   u32x w0l = w[0];
305
306   for (u32 il_pos = 0; il_pos < bf_loops; il_pos++)
307   {
308     const u32x w0r = words_buf_r[il_pos];
309
310     const u32x w0 = w0l | w0r;
311
312     u32x w_tmp[16];
313
314     w_tmp[ 0] = w0;
315     w_tmp[ 1] = w[ 1];
316     w_tmp[ 2] = w[ 2];
317     w_tmp[ 3] = w[ 3];
318     w_tmp[ 4] = w[ 4];
319     w_tmp[ 5] = w[ 5];
320     w_tmp[ 6] = w[ 6];
321     w_tmp[ 7] = w[ 7];
322     w_tmp[ 8] = w[ 8];
323     w_tmp[ 9] = w[ 9];
324     w_tmp[10] = w[10];
325     w_tmp[11] = w[11];
326     w_tmp[12] = w[12];
327     w_tmp[13] = w[13];
328     w_tmp[14] = w[14];
329     w_tmp[15] = w[15];
330
331     u32x state[4];
332
333     state[0] = 0;
334     state[1] = 0;
335     state[2] = 0;
336     state[3] = 0;
337
338     domino_big_md (w_tmp, pw_len, state, s_lotus_magic_table);
339
340     const u32x r0 = state[0];
341     const u32x r1 = state[1];
342     const u32x r2 = state[2];
343     const u32x r3 = state[3];
344
345     #include VECT_COMPARE_M
346   }
347 }
348
349 static void m08600s (__local u32 s_lotus_magic_table[256], u32 w[16], const u32 pw_len, __global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32x * words_buf_r, __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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset)
350 {
351   /**
352    * modifier
353    */
354
355   const u32 gid = get_global_id (0);
356   const u32 lid = get_local_id (0);
357
358   /**
359    * base
360    */
361
362   if (pw_len < 16)
363   {
364     pad (&w[ 0], pw_len & 0xf);
365   }
366   else if (pw_len < 32)
367   {
368     pad (&w[ 4], pw_len & 0xf);
369   }
370   else if (pw_len < 48)
371   {
372     pad (&w[ 8], pw_len & 0xf);
373   }
374   else if (pw_len < 64)
375   {
376     pad (&w[12], pw_len & 0xf);
377   }
378
379   /**
380    * digest
381    */
382
383   const u32 search[4] =
384   {
385     digests_buf[digests_offset].digest_buf[DGST_R0],
386     digests_buf[digests_offset].digest_buf[DGST_R1],
387     digests_buf[digests_offset].digest_buf[DGST_R2],
388     digests_buf[digests_offset].digest_buf[DGST_R3]
389   };
390
391   /**
392    * loop
393    */
394
395   const u32 bf_loops = ceil ((float) bfs_cnt / VECT_DIV);
396
397   u32x w0l = w[0];
398
399   for (u32 il_pos = 0; il_pos < bf_loops; il_pos++)
400   {
401     const u32x w0r = words_buf_r[il_pos];
402
403     const u32x w0 = w0l | w0r;
404
405     u32x w_tmp[16];
406
407     w_tmp[ 0] = w0;
408     w_tmp[ 1] = w[ 1];
409     w_tmp[ 2] = w[ 2];
410     w_tmp[ 3] = w[ 3];
411     w_tmp[ 4] = w[ 4];
412     w_tmp[ 5] = w[ 5];
413     w_tmp[ 6] = w[ 6];
414     w_tmp[ 7] = w[ 7];
415     w_tmp[ 8] = w[ 8];
416     w_tmp[ 9] = w[ 9];
417     w_tmp[10] = w[10];
418     w_tmp[11] = w[11];
419     w_tmp[12] = w[12];
420     w_tmp[13] = w[13];
421     w_tmp[14] = w[14];
422     w_tmp[15] = w[15];
423
424     u32x state[4];
425
426     state[0] = 0;
427     state[1] = 0;
428     state[2] = 0;
429     state[3] = 0;
430
431     domino_big_md (w_tmp, pw_len, state, s_lotus_magic_table);
432
433     const u32x r0 = state[0];
434     const u32x r1 = state[1];
435     const u32x r2 = state[2];
436     const u32x r3 = state[3];
437
438     #include VECT_COMPARE_S
439   }
440 }
441
442 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m08600_m04 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32x * words_buf_r, __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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
443 {
444   /**
445    * base
446    */
447
448   const u32 gid = get_global_id (0);
449   const u32 lid = get_local_id (0);
450
451   u32 w[16];
452
453   w[ 0] = pws[gid].i[ 0];
454   w[ 1] = pws[gid].i[ 1];
455   w[ 2] = pws[gid].i[ 2];
456   w[ 3] = pws[gid].i[ 3];
457   w[ 4] = 0;
458   w[ 5] = 0;
459   w[ 6] = 0;
460   w[ 7] = 0;
461   w[ 8] = 0;
462   w[ 9] = 0;
463   w[10] = 0;
464   w[11] = 0;
465   w[12] = 0;
466   w[13] = 0;
467   w[14] = 0;
468   w[15] = 0;
469
470   const u32 pw_len = pws[gid].pw_len;
471
472   /**
473    * sbox
474    */
475
476   const u32 lid4 = lid * 4;
477
478   __local u32 s_lotus_magic_table[256];
479
480   s_lotus_magic_table[lid4 + 0] = lotus_magic_table[lid4 + 0];
481   s_lotus_magic_table[lid4 + 1] = lotus_magic_table[lid4 + 1];
482   s_lotus_magic_table[lid4 + 2] = lotus_magic_table[lid4 + 2];
483   s_lotus_magic_table[lid4 + 3] = lotus_magic_table[lid4 + 3];
484
485   barrier (CLK_LOCAL_MEM_FENCE);
486
487   if (gid >= gid_max) return;
488
489   /**
490    * main
491    */
492
493   m08600m (s_lotus_magic_table, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, 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, bfs_cnt, digests_cnt, digests_offset);
494 }
495
496 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m08600_m08 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32x * words_buf_r, __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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
497 {
498   /**
499    * base
500    */
501
502   const u32 gid = get_global_id (0);
503   const u32 lid = get_local_id (0);
504
505   u32 w[16];
506
507   w[ 0] = pws[gid].i[ 0];
508   w[ 1] = pws[gid].i[ 1];
509   w[ 2] = pws[gid].i[ 2];
510   w[ 3] = pws[gid].i[ 3];
511   w[ 4] = pws[gid].i[ 4];
512   w[ 5] = pws[gid].i[ 5];
513   w[ 6] = pws[gid].i[ 6];
514   w[ 7] = pws[gid].i[ 7];
515   w[ 8] = 0;
516   w[ 9] = 0;
517   w[10] = 0;
518   w[11] = 0;
519   w[12] = 0;
520   w[13] = 0;
521   w[14] = 0;
522   w[15] = 0;
523
524   const u32 pw_len = pws[gid].pw_len;
525
526   /**
527    * sbox
528    */
529
530   const u32 lid4 = lid * 4;
531
532   __local u32 s_lotus_magic_table[256];
533
534   s_lotus_magic_table[lid4 + 0] = lotus_magic_table[lid4 + 0];
535   s_lotus_magic_table[lid4 + 1] = lotus_magic_table[lid4 + 1];
536   s_lotus_magic_table[lid4 + 2] = lotus_magic_table[lid4 + 2];
537   s_lotus_magic_table[lid4 + 3] = lotus_magic_table[lid4 + 3];
538
539   barrier (CLK_LOCAL_MEM_FENCE);
540
541   if (gid >= gid_max) return;
542
543   /**
544    * main
545    */
546
547   m08600m (s_lotus_magic_table, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, 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, bfs_cnt, digests_cnt, digests_offset);
548 }
549
550 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m08600_m16 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32x * words_buf_r, __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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
551 {
552   /**
553    * base
554    */
555
556   const u32 gid = get_global_id (0);
557   const u32 lid = get_local_id (0);
558
559   u32 w[16];
560
561   w[ 0] = pws[gid].i[ 0];
562   w[ 1] = pws[gid].i[ 1];
563   w[ 2] = pws[gid].i[ 2];
564   w[ 3] = pws[gid].i[ 3];
565   w[ 4] = pws[gid].i[ 4];
566   w[ 5] = pws[gid].i[ 5];
567   w[ 6] = pws[gid].i[ 6];
568   w[ 7] = pws[gid].i[ 7];
569   w[ 8] = pws[gid].i[ 8];
570   w[ 9] = pws[gid].i[ 9];
571   w[10] = pws[gid].i[10];
572   w[11] = pws[gid].i[11];
573   w[12] = pws[gid].i[12];
574   w[13] = pws[gid].i[13];
575   w[14] = pws[gid].i[14];
576   w[15] = pws[gid].i[15];
577
578   const u32 pw_len = pws[gid].pw_len;
579
580   /**
581    * sbox
582    */
583
584   const u32 lid4 = lid * 4;
585
586   __local u32 s_lotus_magic_table[256];
587
588   s_lotus_magic_table[lid4 + 0] = lotus_magic_table[lid4 + 0];
589   s_lotus_magic_table[lid4 + 1] = lotus_magic_table[lid4 + 1];
590   s_lotus_magic_table[lid4 + 2] = lotus_magic_table[lid4 + 2];
591   s_lotus_magic_table[lid4 + 3] = lotus_magic_table[lid4 + 3];
592
593   barrier (CLK_LOCAL_MEM_FENCE);
594
595   if (gid >= gid_max) return;
596
597   /**
598    * main
599    */
600
601   m08600m (s_lotus_magic_table, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, 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, bfs_cnt, digests_cnt, digests_offset);
602 }
603
604 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m08600_s04 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32x * words_buf_r, __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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
605 {
606   /**
607    * base
608    */
609
610   const u32 gid = get_global_id (0);
611   const u32 lid = get_local_id (0);
612
613   u32 w[16];
614
615   w[ 0] = pws[gid].i[ 0];
616   w[ 1] = pws[gid].i[ 1];
617   w[ 2] = pws[gid].i[ 2];
618   w[ 3] = pws[gid].i[ 3];
619   w[ 4] = 0;
620   w[ 5] = 0;
621   w[ 6] = 0;
622   w[ 7] = 0;
623   w[ 8] = 0;
624   w[ 9] = 0;
625   w[10] = 0;
626   w[11] = 0;
627   w[12] = 0;
628   w[13] = 0;
629   w[14] = 0;
630   w[15] = 0;
631
632   const u32 pw_len = pws[gid].pw_len;
633
634   /**
635    * sbox
636    */
637
638   const u32 lid4 = lid * 4;
639
640   __local u32 s_lotus_magic_table[256];
641
642   s_lotus_magic_table[lid4 + 0] = lotus_magic_table[lid4 + 0];
643   s_lotus_magic_table[lid4 + 1] = lotus_magic_table[lid4 + 1];
644   s_lotus_magic_table[lid4 + 2] = lotus_magic_table[lid4 + 2];
645   s_lotus_magic_table[lid4 + 3] = lotus_magic_table[lid4 + 3];
646
647   barrier (CLK_LOCAL_MEM_FENCE);
648
649   if (gid >= gid_max) return;
650
651   /**
652    * main
653    */
654
655   m08600s (s_lotus_magic_table, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, 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, bfs_cnt, digests_cnt, digests_offset);
656 }
657
658 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m08600_s08 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32x * words_buf_r, __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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
659 {
660   /**
661    * base
662    */
663
664   const u32 gid = get_global_id (0);
665   const u32 lid = get_local_id (0);
666
667   u32 w[16];
668
669   w[ 0] = pws[gid].i[ 0];
670   w[ 1] = pws[gid].i[ 1];
671   w[ 2] = pws[gid].i[ 2];
672   w[ 3] = pws[gid].i[ 3];
673   w[ 4] = pws[gid].i[ 4];
674   w[ 5] = pws[gid].i[ 5];
675   w[ 6] = pws[gid].i[ 6];
676   w[ 7] = pws[gid].i[ 7];
677   w[ 8] = 0;
678   w[ 9] = 0;
679   w[10] = 0;
680   w[11] = 0;
681   w[12] = 0;
682   w[13] = 0;
683   w[14] = 0;
684   w[15] = 0;
685
686   const u32 pw_len = pws[gid].pw_len;
687
688   /**
689    * sbox
690    */
691
692   const u32 lid4 = lid * 4;
693
694   __local u32 s_lotus_magic_table[256];
695
696   s_lotus_magic_table[lid4 + 0] = lotus_magic_table[lid4 + 0];
697   s_lotus_magic_table[lid4 + 1] = lotus_magic_table[lid4 + 1];
698   s_lotus_magic_table[lid4 + 2] = lotus_magic_table[lid4 + 2];
699   s_lotus_magic_table[lid4 + 3] = lotus_magic_table[lid4 + 3];
700
701   barrier (CLK_LOCAL_MEM_FENCE);
702
703   if (gid >= gid_max) return;
704
705   /**
706    * main
707    */
708
709   m08600s (s_lotus_magic_table, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, 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, bfs_cnt, digests_cnt, digests_offset);
710 }
711
712 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m08600_s16 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32x * words_buf_r, __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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
713 {
714   /**
715    * base
716    */
717
718   const u32 gid = get_global_id (0);
719   const u32 lid = get_local_id (0);
720
721   u32 w[16];
722
723   w[ 0] = pws[gid].i[ 0];
724   w[ 1] = pws[gid].i[ 1];
725   w[ 2] = pws[gid].i[ 2];
726   w[ 3] = pws[gid].i[ 3];
727   w[ 4] = pws[gid].i[ 4];
728   w[ 5] = pws[gid].i[ 5];
729   w[ 6] = pws[gid].i[ 6];
730   w[ 7] = pws[gid].i[ 7];
731   w[ 8] = pws[gid].i[ 8];
732   w[ 9] = pws[gid].i[ 9];
733   w[10] = pws[gid].i[10];
734   w[11] = pws[gid].i[11];
735   w[12] = pws[gid].i[12];
736   w[13] = pws[gid].i[13];
737   w[14] = pws[gid].i[14];
738   w[15] = pws[gid].i[15];
739
740   const u32 pw_len = pws[gid].pw_len;
741
742   /**
743    * sbox
744    */
745
746   const u32 lid4 = lid * 4;
747
748   __local u32 s_lotus_magic_table[256];
749
750   s_lotus_magic_table[lid4 + 0] = lotus_magic_table[lid4 + 0];
751   s_lotus_magic_table[lid4 + 1] = lotus_magic_table[lid4 + 1];
752   s_lotus_magic_table[lid4 + 2] = lotus_magic_table[lid4 + 2];
753   s_lotus_magic_table[lid4 + 3] = lotus_magic_table[lid4 + 3];
754
755   barrier (CLK_LOCAL_MEM_FENCE);
756
757   if (gid >= gid_max) return;
758
759   /**
760    * main
761    */
762
763   m08600s (s_lotus_magic_table, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, 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, bfs_cnt, digests_cnt, digests_offset);
764 }