Initial commit
[hashcat.git] / amd / m01000_a3.cl
1 /**
2  * Author......: Jens Steube <jens.steube@gmail.com>
3  * License.....: MIT
4  */
5
6 #define _MD4_
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 3
26 #define DGST_R2 2
27 #define DGST_R3 1
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 #define MD4_STEP_REV(f,a,b,c,d,x,t,s)   \
49 {                                       \
50   a  = rotr32 (a, s);                   \
51   a -= f (b, c, d);                     \
52   a -= x;                               \
53   a -= t;                               \
54 }
55
56 #define MD4_STEP_REV1(f,a,b,c,d,x,t,s)  \
57 {                                       \
58   a  = rotr32 (a, s);                   \
59   a -= x;                               \
60   a -= t;                               \
61 }
62
63 static void m01000m (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)
64 {
65   /**
66    * modifier
67    */
68
69   const u32 gid = get_global_id (0);
70   const u32 lid = get_local_id (0);
71
72   /**
73    * base
74    */
75
76   const u32 F_w0c00 =     0 + MD4C00;
77   const u32 F_w1c00 = w[ 1] + MD4C00;
78   const u32 F_w2c00 = w[ 2] + MD4C00;
79   const u32 F_w3c00 = w[ 3] + MD4C00;
80   const u32 F_w4c00 = w[ 4] + MD4C00;
81   const u32 F_w5c00 = w[ 5] + MD4C00;
82   const u32 F_w6c00 = w[ 6] + MD4C00;
83   const u32 F_w7c00 = w[ 7] + MD4C00;
84   const u32 F_w8c00 = w[ 8] + MD4C00;
85   const u32 F_w9c00 = w[ 9] + MD4C00;
86   const u32 F_wac00 = w[10] + MD4C00;
87   const u32 F_wbc00 = w[11] + MD4C00;
88   const u32 F_wcc00 = w[12] + MD4C00;
89   const u32 F_wdc00 = w[13] + MD4C00;
90   const u32 F_wec00 = w[14] + MD4C00;
91   const u32 F_wfc00 = w[15] + MD4C00;
92
93   const u32 G_w0c01 =     0 + MD4C01;
94   const u32 G_w4c01 = w[ 4] + MD4C01;
95   const u32 G_w8c01 = w[ 8] + MD4C01;
96   const u32 G_wcc01 = w[12] + MD4C01;
97   const u32 G_w1c01 = w[ 1] + MD4C01;
98   const u32 G_w5c01 = w[ 5] + MD4C01;
99   const u32 G_w9c01 = w[ 9] + MD4C01;
100   const u32 G_wdc01 = w[13] + MD4C01;
101   const u32 G_w2c01 = w[ 2] + MD4C01;
102   const u32 G_w6c01 = w[ 6] + MD4C01;
103   const u32 G_wac01 = w[10] + MD4C01;
104   const u32 G_wec01 = w[14] + MD4C01;
105   const u32 G_w3c01 = w[ 3] + MD4C01;
106   const u32 G_w7c01 = w[ 7] + MD4C01;
107   const u32 G_wbc01 = w[11] + MD4C01;
108   const u32 G_wfc01 = w[15] + MD4C01;
109
110   const u32 H_w0c02 =     0 + MD4C02;
111   const u32 H_w8c02 = w[ 8] + MD4C02;
112   const u32 H_w4c02 = w[ 4] + MD4C02;
113   const u32 H_wcc02 = w[12] + MD4C02;
114   const u32 H_w2c02 = w[ 2] + MD4C02;
115   const u32 H_wac02 = w[10] + MD4C02;
116   const u32 H_w6c02 = w[ 6] + MD4C02;
117   const u32 H_wec02 = w[14] + MD4C02;
118   const u32 H_w1c02 = w[ 1] + MD4C02;
119   const u32 H_w9c02 = w[ 9] + MD4C02;
120   const u32 H_w5c02 = w[ 5] + MD4C02;
121   const u32 H_wdc02 = w[13] + MD4C02;
122   const u32 H_w3c02 = w[ 3] + MD4C02;
123   const u32 H_wbc02 = w[11] + MD4C02;
124   const u32 H_w7c02 = w[ 7] + MD4C02;
125   const u32 H_wfc02 = w[15] + MD4C02;
126
127   /**
128    * loop
129    */
130
131   const u32 bf_loops = ceil ((float) bfs_cnt / VECT_DIV);
132
133   u32x w0l = w[0];
134
135   for (u32 il_pos = 0; il_pos < bf_loops; il_pos++)
136   {
137     const u32x w0r = words_buf_r[il_pos];
138
139     const u32x w0 = w0l | w0r;
140
141     u32x tmp2;
142
143     u32x a = MD4M_A;
144     u32x b = MD4M_B;
145     u32x c = MD4M_C;
146     u32x d = MD4M_D;
147
148     MD4_STEP (MD4_Fo, a, b, c, d, w0, F_w0c00, MD4S00);
149     MD4_STEP0(MD4_Fo, d, a, b, c,     F_w1c00, MD4S01);
150     MD4_STEP0(MD4_Fo, c, d, a, b,     F_w2c00, MD4S02);
151     MD4_STEP0(MD4_Fo, b, c, d, a,     F_w3c00, MD4S03);
152     MD4_STEP0(MD4_Fo, a, b, c, d,     F_w4c00, MD4S00);
153     MD4_STEP0(MD4_Fo, d, a, b, c,     F_w5c00, MD4S01);
154     MD4_STEP0(MD4_Fo, c, d, a, b,     F_w6c00, MD4S02);
155     MD4_STEP0(MD4_Fo, b, c, d, a,     F_w7c00, MD4S03);
156     MD4_STEP0(MD4_Fo, a, b, c, d,     F_w8c00, MD4S00);
157     MD4_STEP0(MD4_Fo, d, a, b, c,     F_w9c00, MD4S01);
158     MD4_STEP0(MD4_Fo, c, d, a, b,     F_wac00, MD4S02);
159     MD4_STEP0(MD4_Fo, b, c, d, a,     F_wbc00, MD4S03);
160     MD4_STEP0(MD4_Fo, a, b, c, d,     F_wcc00, MD4S00);
161     MD4_STEP0(MD4_Fo, d, a, b, c,     F_wdc00, MD4S01);
162     MD4_STEP0(MD4_Fo, c, d, a, b,     F_wec00, MD4S02);
163     MD4_STEP0(MD4_Fo, b, c, d, a,     F_wfc00, MD4S03);
164
165     MD4_STEP (MD4_Go, a, b, c, d, w0, G_w0c01, MD4S10);
166     MD4_STEP0(MD4_Go, d, a, b, c,     G_w4c01, MD4S11);
167     MD4_STEP0(MD4_Go, c, d, a, b,     G_w8c01, MD4S12);
168     MD4_STEP0(MD4_Go, b, c, d, a,     G_wcc01, MD4S13);
169     MD4_STEP0(MD4_Go, a, b, c, d,     G_w1c01, MD4S10);
170     MD4_STEP0(MD4_Go, d, a, b, c,     G_w5c01, MD4S11);
171     MD4_STEP0(MD4_Go, c, d, a, b,     G_w9c01, MD4S12);
172     MD4_STEP0(MD4_Go, b, c, d, a,     G_wdc01, MD4S13);
173     MD4_STEP0(MD4_Go, a, b, c, d,     G_w2c01, MD4S10);
174     MD4_STEP0(MD4_Go, d, a, b, c,     G_w6c01, MD4S11);
175     MD4_STEP0(MD4_Go, c, d, a, b,     G_wac01, MD4S12);
176     MD4_STEP0(MD4_Go, b, c, d, a,     G_wec01, MD4S13);
177     MD4_STEP0(MD4_Go, a, b, c, d,     G_w3c01, MD4S10);
178     MD4_STEP0(MD4_Go, d, a, b, c,     G_w7c01, MD4S11);
179     MD4_STEP0(MD4_Go, c, d, a, b,     G_wbc01, MD4S12);
180     MD4_STEP0(MD4_Go, b, c, d, a,     G_wfc01, MD4S13);
181
182     MD4_STEP (MD4_H1, a, b, c, d, w0, H_w0c02, MD4S20);
183     MD4_STEP0(MD4_H2, d, a, b, c,     H_w8c02, MD4S21);
184     MD4_STEP0(MD4_H1, c, d, a, b,     H_w4c02, MD4S22);
185     MD4_STEP0(MD4_H2, b, c, d, a,     H_wcc02, MD4S23);
186     MD4_STEP0(MD4_H1, a, b, c, d,     H_w2c02, MD4S20);
187     MD4_STEP0(MD4_H2, d, a, b, c,     H_wac02, MD4S21);
188     MD4_STEP0(MD4_H1, c, d, a, b,     H_w6c02, MD4S22);
189     MD4_STEP0(MD4_H2, b, c, d, a,     H_wec02, MD4S23);
190     MD4_STEP0(MD4_H1, a, b, c, d,     H_w1c02, MD4S20);
191     MD4_STEP0(MD4_H2, d, a, b, c,     H_w9c02, MD4S21);
192     MD4_STEP0(MD4_H1, c, d, a, b,     H_w5c02, MD4S22);
193     MD4_STEP0(MD4_H2, b, c, d, a,     H_wdc02, MD4S23);
194     MD4_STEP0(MD4_H1, a, b, c, d,     H_w3c02, MD4S20);
195     MD4_STEP0(MD4_H2, d, a, b, c,     H_wbc02, MD4S21);
196     MD4_STEP0(MD4_H1, c, d, a, b,     H_w7c02, MD4S22);
197     MD4_STEP0(MD4_H2, b, c, d, a,     H_wfc02, MD4S23);
198
199     const u32x r0 = a;
200     const u32x r1 = d;
201     const u32x r2 = c;
202     const u32x r3 = b;
203
204     #include VECT_COMPARE_M
205   }
206 }
207
208 static void m01000s (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)
209 {
210   /**
211    * modifier
212    */
213
214   const u32 gid = get_global_id (0);
215   const u32 lid = get_local_id (0);
216
217   /**
218    * base
219    */
220
221   const u32 F_w0c00 =     0 + MD4C00;
222   const u32 F_w1c00 = w[ 1] + MD4C00;
223   const u32 F_w2c00 = w[ 2] + MD4C00;
224   const u32 F_w3c00 = w[ 3] + MD4C00;
225   const u32 F_w4c00 = w[ 4] + MD4C00;
226   const u32 F_w5c00 = w[ 5] + MD4C00;
227   const u32 F_w6c00 = w[ 6] + MD4C00;
228   const u32 F_w7c00 = w[ 7] + MD4C00;
229   const u32 F_w8c00 = w[ 8] + MD4C00;
230   const u32 F_w9c00 = w[ 9] + MD4C00;
231   const u32 F_wac00 = w[10] + MD4C00;
232   const u32 F_wbc00 = w[11] + MD4C00;
233   const u32 F_wcc00 = w[12] + MD4C00;
234   const u32 F_wdc00 = w[13] + MD4C00;
235   const u32 F_wec00 = w[14] + MD4C00;
236   const u32 F_wfc00 = w[15] + MD4C00;
237
238   const u32 G_w0c01 =     0 + MD4C01;
239   const u32 G_w4c01 = w[ 4] + MD4C01;
240   const u32 G_w8c01 = w[ 8] + MD4C01;
241   const u32 G_wcc01 = w[12] + MD4C01;
242   const u32 G_w1c01 = w[ 1] + MD4C01;
243   const u32 G_w5c01 = w[ 5] + MD4C01;
244   const u32 G_w9c01 = w[ 9] + MD4C01;
245   const u32 G_wdc01 = w[13] + MD4C01;
246   const u32 G_w2c01 = w[ 2] + MD4C01;
247   const u32 G_w6c01 = w[ 6] + MD4C01;
248   const u32 G_wac01 = w[10] + MD4C01;
249   const u32 G_wec01 = w[14] + MD4C01;
250   const u32 G_w3c01 = w[ 3] + MD4C01;
251   const u32 G_w7c01 = w[ 7] + MD4C01;
252   const u32 G_wbc01 = w[11] + MD4C01;
253   const u32 G_wfc01 = w[15] + MD4C01;
254
255   const u32 H_w0c02 =     0 + MD4C02;
256   const u32 H_w8c02 = w[ 8] + MD4C02;
257   const u32 H_w4c02 = w[ 4] + MD4C02;
258   const u32 H_wcc02 = w[12] + MD4C02;
259   const u32 H_w2c02 = w[ 2] + MD4C02;
260   const u32 H_wac02 = w[10] + MD4C02;
261   const u32 H_w6c02 = w[ 6] + MD4C02;
262   const u32 H_wec02 = w[14] + MD4C02;
263   const u32 H_w1c02 = w[ 1] + MD4C02;
264   const u32 H_w9c02 = w[ 9] + MD4C02;
265   const u32 H_w5c02 = w[ 5] + MD4C02;
266   const u32 H_wdc02 = w[13] + MD4C02;
267   const u32 H_w3c02 = w[ 3] + MD4C02;
268   const u32 H_wbc02 = w[11] + MD4C02;
269   const u32 H_w7c02 = w[ 7] + MD4C02;
270   const u32 H_wfc02 = w[15] + MD4C02;
271
272   /**
273    * digest
274    */
275
276   const u32 search[4] =
277   {
278     digests_buf[digests_offset].digest_buf[DGST_R0],
279     digests_buf[digests_offset].digest_buf[DGST_R1],
280     digests_buf[digests_offset].digest_buf[DGST_R2],
281     digests_buf[digests_offset].digest_buf[DGST_R3]
282   };
283
284   /**
285    * reverse
286    */
287
288   u32 a_rev = digests_buf[digests_offset].digest_buf[0];
289   u32 b_rev = digests_buf[digests_offset].digest_buf[1];
290   u32 c_rev = digests_buf[digests_offset].digest_buf[2];
291   u32 d_rev = digests_buf[digests_offset].digest_buf[3];
292
293   MD4_STEP_REV (MD4_H, b_rev, c_rev, d_rev, a_rev, w[15], MD4C02, MD4S23);
294   MD4_STEP_REV (MD4_H, c_rev, d_rev, a_rev, b_rev, w[ 7], MD4C02, MD4S22);
295   MD4_STEP_REV (MD4_H, d_rev, a_rev, b_rev, c_rev, w[11], MD4C02, MD4S21);
296   MD4_STEP_REV (MD4_H, a_rev, b_rev, c_rev, d_rev, w[ 3], MD4C02, MD4S20);
297   MD4_STEP_REV (MD4_H, b_rev, c_rev, d_rev, a_rev, w[13], MD4C02, MD4S23);
298   MD4_STEP_REV (MD4_H, c_rev, d_rev, a_rev, b_rev, w[ 5], MD4C02, MD4S22);
299   MD4_STEP_REV (MD4_H, d_rev, a_rev, b_rev, c_rev, w[ 9], MD4C02, MD4S21);
300   MD4_STEP_REV (MD4_H, a_rev, b_rev, c_rev, d_rev, w[ 1], MD4C02, MD4S20);
301   MD4_STEP_REV (MD4_H, b_rev, c_rev, d_rev, a_rev, w[14], MD4C02, MD4S23);
302   MD4_STEP_REV (MD4_H, c_rev, d_rev, a_rev, b_rev, w[ 6], MD4C02, MD4S22);
303   MD4_STEP_REV (MD4_H, d_rev, a_rev, b_rev, c_rev, w[10], MD4C02, MD4S21);
304   MD4_STEP_REV (MD4_H, a_rev, b_rev, c_rev, d_rev, w[ 2], MD4C02, MD4S20);
305   MD4_STEP_REV (MD4_H, b_rev, c_rev, d_rev, a_rev, w[12], MD4C02, MD4S23);
306   MD4_STEP_REV (MD4_H, c_rev, d_rev, a_rev, b_rev, w[ 4], MD4C02, MD4S22);
307   MD4_STEP_REV (MD4_H, d_rev, a_rev, b_rev, c_rev, w[ 8], MD4C02, MD4S21);
308   MD4_STEP_REV (MD4_H, a_rev, b_rev, c_rev, d_rev,     0, MD4C02, MD4S20);
309
310   const u32x sav_c = c_rev;
311   const u32x sav_d = d_rev;
312
313   MD4_STEP_REV1(MD4_G, b_rev, c_rev, d_rev, a_rev, w[15], MD4C01, MD4S13);
314   MD4_STEP_REV1(MD4_G, c_rev, d_rev, a_rev, b_rev, w[11], MD4C01, MD4S12);
315
316   /**
317    * loop
318    */
319
320   const u32 bf_loops = ceil ((float) bfs_cnt / VECT_DIV);
321
322   u32x w0l = w[0];
323
324   for (u32 il_pos = 0; il_pos < bf_loops; il_pos++)
325   {
326     const u32x w0r = words_buf_r[il_pos];
327
328     const u32x w0 = w0l | w0r;
329
330     u32x pre_a = a_rev;
331     u32x pre_b = b_rev;
332     u32x pre_c = c_rev;
333
334     pre_a = pre_a - w0;
335     pre_b = pre_b - MD4_G (sav_c, sav_d, pre_a);
336     pre_c = pre_c - MD4_G (sav_d, pre_a, pre_b);
337
338     u32x tmp2;
339
340     u32x a = MD4M_A;
341     u32x b = MD4M_B;
342     u32x c = MD4M_C;
343     u32x d = MD4M_D;
344
345     MD4_STEP (MD4_Fo, a, b, c, d, w0, F_w0c00, MD4S00);
346     MD4_STEP0(MD4_Fo, d, a, b, c,     F_w1c00, MD4S01);
347     MD4_STEP0(MD4_Fo, c, d, a, b,     F_w2c00, MD4S02);
348     MD4_STEP0(MD4_Fo, b, c, d, a,     F_w3c00, MD4S03);
349     MD4_STEP0(MD4_Fo, a, b, c, d,     F_w4c00, MD4S00);
350     MD4_STEP0(MD4_Fo, d, a, b, c,     F_w5c00, MD4S01);
351     MD4_STEP0(MD4_Fo, c, d, a, b,     F_w6c00, MD4S02);
352     MD4_STEP0(MD4_Fo, b, c, d, a,     F_w7c00, MD4S03);
353     MD4_STEP0(MD4_Fo, a, b, c, d,     F_w8c00, MD4S00);
354     MD4_STEP0(MD4_Fo, d, a, b, c,     F_w9c00, MD4S01);
355     MD4_STEP0(MD4_Fo, c, d, a, b,     F_wac00, MD4S02);
356     MD4_STEP0(MD4_Fo, b, c, d, a,     F_wbc00, MD4S03);
357     MD4_STEP0(MD4_Fo, a, b, c, d,     F_wcc00, MD4S00);
358     MD4_STEP0(MD4_Fo, d, a, b, c,     F_wdc00, MD4S01);
359     MD4_STEP0(MD4_Fo, c, d, a, b,     F_wec00, MD4S02);
360     MD4_STEP0(MD4_Fo, b, c, d, a,     F_wfc00, MD4S03);
361
362     MD4_STEP (MD4_Go, a, b, c, d, w0, G_w0c01, MD4S10);
363     MD4_STEP0(MD4_Go, d, a, b, c,     G_w4c01, MD4S11);
364     MD4_STEP0(MD4_Go, c, d, a, b,     G_w8c01, MD4S12);
365     MD4_STEP0(MD4_Go, b, c, d, a,     G_wcc01, MD4S13);
366     MD4_STEP0(MD4_Go, a, b, c, d,     G_w1c01, MD4S10);
367     MD4_STEP0(MD4_Go, d, a, b, c,     G_w5c01, MD4S11);
368     MD4_STEP0(MD4_Go, c, d, a, b,     G_w9c01, MD4S12);
369     MD4_STEP0(MD4_Go, b, c, d, a,     G_wdc01, MD4S13);
370     MD4_STEP0(MD4_Go, a, b, c, d,     G_w2c01, MD4S10);
371     MD4_STEP0(MD4_Go, d, a, b, c,     G_w6c01, MD4S11);
372     MD4_STEP0(MD4_Go, c, d, a, b,     G_wac01, MD4S12);
373
374     bool q_cond = allx (pre_c != c);
375
376     if (q_cond) continue;
377
378     MD4_STEP0(MD4_Go, b, c, d, a,     G_wec01, MD4S13);
379     MD4_STEP0(MD4_Go, a, b, c, d,     G_w3c01, MD4S10);
380
381     bool q_cond2 = allx (pre_a != a);
382
383     if (q_cond2) continue;
384
385     MD4_STEP0(MD4_Go, d, a, b, c,     G_w7c01, MD4S11);
386     MD4_STEP0(MD4_Go, c, d, a, b,     G_wbc01, MD4S12);
387     MD4_STEP0(MD4_Go, b, c, d, a,     G_wfc01, MD4S13);
388
389     MD4_STEP (MD4_H1, a, b, c, d, w0, H_w0c02, MD4S20);
390     MD4_STEP0(MD4_H2, d, a, b, c,     H_w8c02, MD4S21);
391     MD4_STEP0(MD4_H1, c, d, a, b,     H_w4c02, MD4S22);
392     MD4_STEP0(MD4_H2, b, c, d, a,     H_wcc02, MD4S23);
393     MD4_STEP0(MD4_H1, a, b, c, d,     H_w2c02, MD4S20);
394     MD4_STEP0(MD4_H2, d, a, b, c,     H_wac02, MD4S21);
395     MD4_STEP0(MD4_H1, c, d, a, b,     H_w6c02, MD4S22);
396     MD4_STEP0(MD4_H2, b, c, d, a,     H_wec02, MD4S23);
397     MD4_STEP0(MD4_H1, a, b, c, d,     H_w1c02, MD4S20);
398     MD4_STEP0(MD4_H2, d, a, b, c,     H_w9c02, MD4S21);
399     MD4_STEP0(MD4_H1, c, d, a, b,     H_w5c02, MD4S22);
400     MD4_STEP0(MD4_H2, b, c, d, a,     H_wdc02, MD4S23);
401     MD4_STEP0(MD4_H1, a, b, c, d,     H_w3c02, MD4S20);
402     MD4_STEP0(MD4_H2, d, a, b, c,     H_wbc02, MD4S21);
403     MD4_STEP0(MD4_H1, c, d, a, b,     H_w7c02, MD4S22);
404     MD4_STEP0(MD4_H2, b, c, d, a,     H_wfc02, MD4S23);
405
406     const u32x r0 = a;
407     const u32x r1 = d;
408     const u32x r2 = c;
409     const u32x r3 = b;
410
411     #include VECT_COMPARE_S
412   }
413 }
414
415 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m01000_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)
416 {
417   /**
418    * base
419    */
420
421   const u32 gid = get_global_id (0);
422
423   if (gid >= gid_max) return;
424
425   u32 w[16];
426
427   w[ 0] = pws[gid].i[ 0];
428   w[ 1] = pws[gid].i[ 1];
429   w[ 2] = pws[gid].i[ 2];
430   w[ 3] = pws[gid].i[ 3];
431   w[ 4] = 0;
432   w[ 5] = 0;
433   w[ 6] = 0;
434   w[ 7] = 0;
435   w[ 8] = 0;
436   w[ 9] = 0;
437   w[10] = 0;
438   w[11] = 0;
439   w[12] = 0;
440   w[13] = 0;
441   w[14] = pws[gid].i[14];
442   w[15] = 0;
443
444   const u32 pw_len = pws[gid].pw_len;
445
446   /**
447    * main
448    */
449
450   m01000m (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);
451 }
452
453 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m01000_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)
454 {
455   /**
456    * base
457    */
458
459   const u32 gid = get_global_id (0);
460
461   if (gid >= gid_max) return;
462
463   u32 w[16];
464
465   w[ 0] = pws[gid].i[ 0];
466   w[ 1] = pws[gid].i[ 1];
467   w[ 2] = pws[gid].i[ 2];
468   w[ 3] = pws[gid].i[ 3];
469   w[ 4] = pws[gid].i[ 4];
470   w[ 5] = pws[gid].i[ 5];
471   w[ 6] = pws[gid].i[ 6];
472   w[ 7] = pws[gid].i[ 7];
473   w[ 8] = 0;
474   w[ 9] = 0;
475   w[10] = 0;
476   w[11] = 0;
477   w[12] = 0;
478   w[13] = 0;
479   w[14] = pws[gid].i[14];
480   w[15] = 0;
481
482   const u32 pw_len = pws[gid].pw_len;
483
484   /**
485    * main
486    */
487
488   m01000m (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);
489 }
490
491 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m01000_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)
492 {
493   /**
494    * base
495    */
496
497   const u32 gid = get_global_id (0);
498
499   if (gid >= gid_max) return;
500
501   u32 w[16];
502
503   w[ 0] = pws[gid].i[ 0];
504   w[ 1] = pws[gid].i[ 1];
505   w[ 2] = pws[gid].i[ 2];
506   w[ 3] = pws[gid].i[ 3];
507   w[ 4] = pws[gid].i[ 4];
508   w[ 5] = pws[gid].i[ 5];
509   w[ 6] = pws[gid].i[ 6];
510   w[ 7] = pws[gid].i[ 7];
511   w[ 8] = pws[gid].i[ 8];
512   w[ 9] = pws[gid].i[ 9];
513   w[10] = pws[gid].i[10];
514   w[11] = pws[gid].i[11];
515   w[12] = pws[gid].i[12];
516   w[13] = pws[gid].i[13];
517   w[14] = pws[gid].i[14];
518   w[15] = pws[gid].i[15];
519
520   const u32 pw_len = pws[gid].pw_len;
521
522   /**
523    * main
524    */
525
526   m01000m (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);
527 }
528
529 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m01000_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)
530 {
531   /**
532    * base
533    */
534
535   const u32 gid = get_global_id (0);
536
537   if (gid >= gid_max) return;
538
539   u32 w[16];
540
541   w[ 0] = pws[gid].i[ 0];
542   w[ 1] = pws[gid].i[ 1];
543   w[ 2] = pws[gid].i[ 2];
544   w[ 3] = pws[gid].i[ 3];
545   w[ 4] = 0;
546   w[ 5] = 0;
547   w[ 6] = 0;
548   w[ 7] = 0;
549   w[ 8] = 0;
550   w[ 9] = 0;
551   w[10] = 0;
552   w[11] = 0;
553   w[12] = 0;
554   w[13] = 0;
555   w[14] = pws[gid].i[14];
556   w[15] = 0;
557
558   const u32 pw_len = pws[gid].pw_len;
559
560   /**
561    * main
562    */
563
564   m01000s (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);
565 }
566
567 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m01000_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)
568 {
569   /**
570    * base
571    */
572
573   const u32 gid = get_global_id (0);
574
575   if (gid >= gid_max) return;
576
577   u32 w[16];
578
579   w[ 0] = pws[gid].i[ 0];
580   w[ 1] = pws[gid].i[ 1];
581   w[ 2] = pws[gid].i[ 2];
582   w[ 3] = pws[gid].i[ 3];
583   w[ 4] = pws[gid].i[ 4];
584   w[ 5] = pws[gid].i[ 5];
585   w[ 6] = pws[gid].i[ 6];
586   w[ 7] = pws[gid].i[ 7];
587   w[ 8] = 0;
588   w[ 9] = 0;
589   w[10] = 0;
590   w[11] = 0;
591   w[12] = 0;
592   w[13] = 0;
593   w[14] = pws[gid].i[14];
594   w[15] = 0;
595
596   const u32 pw_len = pws[gid].pw_len;
597
598   /**
599    * main
600    */
601
602   m01000s (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);
603 }
604
605 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m01000_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)
606 {
607   /**
608    * base
609    */
610
611   const u32 gid = get_global_id (0);
612
613   if (gid >= gid_max) return;
614
615   u32 w[16];
616
617   w[ 0] = pws[gid].i[ 0];
618   w[ 1] = pws[gid].i[ 1];
619   w[ 2] = pws[gid].i[ 2];
620   w[ 3] = pws[gid].i[ 3];
621   w[ 4] = pws[gid].i[ 4];
622   w[ 5] = pws[gid].i[ 5];
623   w[ 6] = pws[gid].i[ 6];
624   w[ 7] = pws[gid].i[ 7];
625   w[ 8] = pws[gid].i[ 8];
626   w[ 9] = pws[gid].i[ 9];
627   w[10] = pws[gid].i[10];
628   w[11] = pws[gid].i[11];
629   w[12] = pws[gid].i[12];
630   w[13] = pws[gid].i[13];
631   w[14] = pws[gid].i[14];
632   w[15] = pws[gid].i[15];
633
634   const u32 pw_len = pws[gid].pw_len;
635
636   /**
637    * main
638    */
639
640   m01000s (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);
641 }