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