Fix path to includes
[hashcat.git] / OpenCL / m00000_a3.cl
1 /**
2  * Author......: Jens Steube <jens.steube@gmail.com>
3  * License.....: MIT
4  */
5
6 #define _MD5_
7
8 #include "include/constants.h"
9 #include "include/kernel_vendor.h"
10
11 #define DGST_R0 0
12 #define DGST_R1 3
13 #define DGST_R2 2
14 #define DGST_R3 1
15
16 #include "include/kernel_functions.c"
17 #include "OpenCL/types_ocl.c"
18 #include "OpenCL/common.c"
19
20 #define COMPARE_S "OpenCL/check_single_comp4.c"
21 #define COMPARE_M "OpenCL/check_multi_comp4.c"
22
23 #define MD5_STEP_REV(f,a,b,c,d,x,t,s)   \
24 {                                       \
25   a -= b;                               \
26   a  = rotr32 (a, s);                   \
27   a -= f (b, c, d);                     \
28   a -= x;                               \
29   a -= t;                               \
30 }
31
32 #define MD5_STEP_REV1(f,a,b,c,d,x,t,s)  \
33 {                                       \
34   a -= b;                               \
35   a  = rotr32 (a, s);                   \
36   a -= x;                               \
37   a -= t;                               \
38 }
39
40 static void m00000m (u32 w[16], const u32 pw_len, __global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32 * 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)
41 {
42   /**
43    * modifier
44    */
45
46   const u32 gid = get_global_id (0);
47   const u32 lid = get_local_id (0);
48
49   /**
50    * base
51    */
52
53   const u32 F_w0c00 =    0  + MD5C00;
54   const u32 F_w1c01 = w[ 1] + MD5C01;
55   const u32 F_w2c02 = w[ 2] + MD5C02;
56   const u32 F_w3c03 = w[ 3] + MD5C03;
57   const u32 F_w4c04 = w[ 4] + MD5C04;
58   const u32 F_w5c05 = w[ 5] + MD5C05;
59   const u32 F_w6c06 = w[ 6] + MD5C06;
60   const u32 F_w7c07 = w[ 7] + MD5C07;
61   const u32 F_w8c08 = w[ 8] + MD5C08;
62   const u32 F_w9c09 = w[ 9] + MD5C09;
63   const u32 F_wac0a = w[10] + MD5C0a;
64   const u32 F_wbc0b = w[11] + MD5C0b;
65   const u32 F_wcc0c = w[12] + MD5C0c;
66   const u32 F_wdc0d = w[13] + MD5C0d;
67   const u32 F_wec0e = w[14] + MD5C0e;
68   const u32 F_wfc0f = w[15] + MD5C0f;
69
70   const u32 G_w1c10 = w[ 1] + MD5C10;
71   const u32 G_w6c11 = w[ 6] + MD5C11;
72   const u32 G_wbc12 = w[11] + MD5C12;
73   const u32 G_w0c13 =    0  + MD5C13;
74   const u32 G_w5c14 = w[ 5] + MD5C14;
75   const u32 G_wac15 = w[10] + MD5C15;
76   const u32 G_wfc16 = w[15] + MD5C16;
77   const u32 G_w4c17 = w[ 4] + MD5C17;
78   const u32 G_w9c18 = w[ 9] + MD5C18;
79   const u32 G_wec19 = w[14] + MD5C19;
80   const u32 G_w3c1a = w[ 3] + MD5C1a;
81   const u32 G_w8c1b = w[ 8] + MD5C1b;
82   const u32 G_wdc1c = w[13] + MD5C1c;
83   const u32 G_w2c1d = w[ 2] + MD5C1d;
84   const u32 G_w7c1e = w[ 7] + MD5C1e;
85   const u32 G_wcc1f = w[12] + MD5C1f;
86
87   const u32 H_w5c20 = w[ 5] + MD5C20;
88   const u32 H_w8c21 = w[ 8] + MD5C21;
89   const u32 H_wbc22 = w[11] + MD5C22;
90   const u32 H_wec23 = w[14] + MD5C23;
91   const u32 H_w1c24 = w[ 1] + MD5C24;
92   const u32 H_w4c25 = w[ 4] + MD5C25;
93   const u32 H_w7c26 = w[ 7] + MD5C26;
94   const u32 H_wac27 = w[10] + MD5C27;
95   const u32 H_wdc28 = w[13] + MD5C28;
96   const u32 H_w0c29 =    0  + MD5C29;
97   const u32 H_w3c2a = w[ 3] + MD5C2a;
98   const u32 H_w6c2b = w[ 6] + MD5C2b;
99   const u32 H_w9c2c = w[ 9] + MD5C2c;
100   const u32 H_wcc2d = w[12] + MD5C2d;
101   const u32 H_wfc2e = w[15] + MD5C2e;
102   const u32 H_w2c2f = w[ 2] + MD5C2f;
103
104   const u32 I_w0c30 =    0  + MD5C30;
105   const u32 I_w7c31 = w[ 7] + MD5C31;
106   const u32 I_wec32 = w[14] + MD5C32;
107   const u32 I_w5c33 = w[ 5] + MD5C33;
108   const u32 I_wcc34 = w[12] + MD5C34;
109   const u32 I_w3c35 = w[ 3] + MD5C35;
110   const u32 I_wac36 = w[10] + MD5C36;
111   const u32 I_w1c37 = w[ 1] + MD5C37;
112   const u32 I_w8c38 = w[ 8] + MD5C38;
113   const u32 I_wfc39 = w[15] + MD5C39;
114   const u32 I_w6c3a = w[ 6] + MD5C3a;
115   const u32 I_wdc3b = w[13] + MD5C3b;
116   const u32 I_w4c3c = w[ 4] + MD5C3c;
117   const u32 I_wbc3d = w[11] + MD5C3d;
118   const u32 I_w2c3e = w[ 2] + MD5C3e;
119   const u32 I_w9c3f = w[ 9] + MD5C3f;
120
121   /**
122    * loop
123    */
124
125   u32 w0l = w[0];
126
127   for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos++)
128   {
129     const u32 w0r = words_buf_r[il_pos];
130
131     const u32 w0 = w0l | w0r;
132
133     u32 tmp2;
134
135     u32 a = MD5M_A;
136     u32 b = MD5M_B;
137     u32 c = MD5M_C;
138     u32 d = MD5M_D;
139
140     MD5_STEP (MD5_Fo, a, b, c, d, w0, F_w0c00, MD5S00);
141     MD5_STEP0(MD5_Fo, d, a, b, c,     F_w1c01, MD5S01);
142     MD5_STEP0(MD5_Fo, c, d, a, b,     F_w2c02, MD5S02);
143     MD5_STEP0(MD5_Fo, b, c, d, a,     F_w3c03, MD5S03);
144     MD5_STEP0(MD5_Fo, a, b, c, d,     F_w4c04, MD5S00);
145     MD5_STEP0(MD5_Fo, d, a, b, c,     F_w5c05, MD5S01);
146     MD5_STEP0(MD5_Fo, c, d, a, b,     F_w6c06, MD5S02);
147     MD5_STEP0(MD5_Fo, b, c, d, a,     F_w7c07, MD5S03);
148     MD5_STEP0(MD5_Fo, a, b, c, d,     F_w8c08, MD5S00);
149     MD5_STEP0(MD5_Fo, d, a, b, c,     F_w9c09, MD5S01);
150     MD5_STEP0(MD5_Fo, c, d, a, b,     F_wac0a, MD5S02);
151     MD5_STEP0(MD5_Fo, b, c, d, a,     F_wbc0b, MD5S03);
152     MD5_STEP0(MD5_Fo, a, b, c, d,     F_wcc0c, MD5S00);
153     MD5_STEP0(MD5_Fo, d, a, b, c,     F_wdc0d, MD5S01);
154     MD5_STEP0(MD5_Fo, c, d, a, b,     F_wec0e, MD5S02);
155     MD5_STEP0(MD5_Fo, b, c, d, a,     F_wfc0f, MD5S03);
156
157     MD5_STEP0(MD5_Go, a, b, c, d,     G_w1c10, MD5S10);
158     MD5_STEP0(MD5_Go, d, a, b, c,     G_w6c11, MD5S11);
159     MD5_STEP0(MD5_Go, c, d, a, b,     G_wbc12, MD5S12);
160     MD5_STEP (MD5_Go, b, c, d, a, w0, G_w0c13, MD5S13);
161     MD5_STEP0(MD5_Go, a, b, c, d,     G_w5c14, MD5S10);
162     MD5_STEP0(MD5_Go, d, a, b, c,     G_wac15, MD5S11);
163     MD5_STEP0(MD5_Go, c, d, a, b,     G_wfc16, MD5S12);
164     MD5_STEP0(MD5_Go, b, c, d, a,     G_w4c17, MD5S13);
165     MD5_STEP0(MD5_Go, a, b, c, d,     G_w9c18, MD5S10);
166     MD5_STEP0(MD5_Go, d, a, b, c,     G_wec19, MD5S11);
167     MD5_STEP0(MD5_Go, c, d, a, b,     G_w3c1a, MD5S12);
168     MD5_STEP0(MD5_Go, b, c, d, a,     G_w8c1b, MD5S13);
169     MD5_STEP0(MD5_Go, a, b, c, d,     G_wdc1c, MD5S10);
170     MD5_STEP0(MD5_Go, d, a, b, c,     G_w2c1d, MD5S11);
171     MD5_STEP0(MD5_Go, c, d, a, b,     G_w7c1e, MD5S12);
172     MD5_STEP0(MD5_Go, b, c, d, a,     G_wcc1f, MD5S13);
173
174     MD5_STEP0(MD5_H1, a, b, c, d,     H_w5c20, MD5S20);
175     MD5_STEP0(MD5_H2, d, a, b, c,     H_w8c21, MD5S21);
176     MD5_STEP0(MD5_H1, c, d, a, b,     H_wbc22, MD5S22);
177     MD5_STEP0(MD5_H2, b, c, d, a,     H_wec23, MD5S23);
178     MD5_STEP0(MD5_H1, a, b, c, d,     H_w1c24, MD5S20);
179     MD5_STEP0(MD5_H2, d, a, b, c,     H_w4c25, MD5S21);
180     MD5_STEP0(MD5_H1, c, d, a, b,     H_w7c26, MD5S22);
181     MD5_STEP0(MD5_H2, b, c, d, a,     H_wac27, MD5S23);
182     MD5_STEP0(MD5_H1, a, b, c, d,     H_wdc28, MD5S20);
183     MD5_STEP (MD5_H2, d, a, b, c, w0, H_w0c29, MD5S21);
184     MD5_STEP0(MD5_H1, c, d, a, b,     H_w3c2a, MD5S22);
185     MD5_STEP0(MD5_H2, b, c, d, a,     H_w6c2b, MD5S23);
186     MD5_STEP0(MD5_H1, a, b, c, d,     H_w9c2c, MD5S20);
187     MD5_STEP0(MD5_H2, d, a, b, c,     H_wcc2d, MD5S21);
188     MD5_STEP0(MD5_H1, c, d, a, b,     H_wfc2e, MD5S22);
189     MD5_STEP0(MD5_H2, b, c, d, a,     H_w2c2f, MD5S23);
190
191     MD5_STEP (MD5_I , a, b, c, d, w0, I_w0c30, MD5S30);
192     MD5_STEP0(MD5_I , d, a, b, c,     I_w7c31, MD5S31);
193     MD5_STEP0(MD5_I , c, d, a, b,     I_wec32, MD5S32);
194     MD5_STEP0(MD5_I , b, c, d, a,     I_w5c33, MD5S33);
195     MD5_STEP0(MD5_I , a, b, c, d,     I_wcc34, MD5S30);
196     MD5_STEP0(MD5_I , d, a, b, c,     I_w3c35, MD5S31);
197     MD5_STEP0(MD5_I , c, d, a, b,     I_wac36, MD5S32);
198     MD5_STEP0(MD5_I , b, c, d, a,     I_w1c37, MD5S33);
199     MD5_STEP0(MD5_I , a, b, c, d,     I_w8c38, MD5S30);
200     MD5_STEP0(MD5_I , d, a, b, c,     I_wfc39, MD5S31);
201     MD5_STEP0(MD5_I , c, d, a, b,     I_w6c3a, MD5S32);
202     MD5_STEP0(MD5_I , b, c, d, a,     I_wdc3b, MD5S33);
203     MD5_STEP0(MD5_I , a, b, c, d,     I_w4c3c, MD5S30);
204     MD5_STEP0(MD5_I , d, a, b, c,     I_wbc3d, MD5S31);
205     MD5_STEP0(MD5_I , c, d, a, b,     I_w2c3e, MD5S32);
206     MD5_STEP0(MD5_I , b, c, d, a,     I_w9c3f, MD5S33);
207
208
209     const u32 r0 = a;
210     const u32 r1 = d;
211     const u32 r2 = c;
212     const u32 r3 = b;
213
214     #include COMPARE_M
215   }
216 }
217
218 static void m00000s (u32 w[16], const u32 pw_len, __global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32 * 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)
219 {
220   /**
221    * modifier
222    */
223
224   const u32 gid = get_global_id (0);
225   const u32 lid = get_local_id (0);
226
227   /**
228    * base
229    */
230
231   const u32 F_w0c00 =    0  + MD5C00;
232   const u32 F_w1c01 = w[ 1] + MD5C01;
233   const u32 F_w2c02 = w[ 2] + MD5C02;
234   const u32 F_w3c03 = w[ 3] + MD5C03;
235   const u32 F_w4c04 = w[ 4] + MD5C04;
236   const u32 F_w5c05 = w[ 5] + MD5C05;
237   const u32 F_w6c06 = w[ 6] + MD5C06;
238   const u32 F_w7c07 = w[ 7] + MD5C07;
239   const u32 F_w8c08 = w[ 8] + MD5C08;
240   const u32 F_w9c09 = w[ 9] + MD5C09;
241   const u32 F_wac0a = w[10] + MD5C0a;
242   const u32 F_wbc0b = w[11] + MD5C0b;
243   const u32 F_wcc0c = w[12] + MD5C0c;
244   const u32 F_wdc0d = w[13] + MD5C0d;
245   const u32 F_wec0e = w[14] + MD5C0e;
246   const u32 F_wfc0f = w[15] + MD5C0f;
247
248   const u32 G_w1c10 = w[ 1] + MD5C10;
249   const u32 G_w6c11 = w[ 6] + MD5C11;
250   const u32 G_wbc12 = w[11] + MD5C12;
251   const u32 G_w0c13 =    0  + MD5C13;
252   const u32 G_w5c14 = w[ 5] + MD5C14;
253   const u32 G_wac15 = w[10] + MD5C15;
254   const u32 G_wfc16 = w[15] + MD5C16;
255   const u32 G_w4c17 = w[ 4] + MD5C17;
256   const u32 G_w9c18 = w[ 9] + MD5C18;
257   const u32 G_wec19 = w[14] + MD5C19;
258   const u32 G_w3c1a = w[ 3] + MD5C1a;
259   const u32 G_w8c1b = w[ 8] + MD5C1b;
260   const u32 G_wdc1c = w[13] + MD5C1c;
261   const u32 G_w2c1d = w[ 2] + MD5C1d;
262   const u32 G_w7c1e = w[ 7] + MD5C1e;
263   const u32 G_wcc1f = w[12] + MD5C1f;
264
265   const u32 H_w5c20 = w[ 5] + MD5C20;
266   const u32 H_w8c21 = w[ 8] + MD5C21;
267   const u32 H_wbc22 = w[11] + MD5C22;
268   const u32 H_wec23 = w[14] + MD5C23;
269   const u32 H_w1c24 = w[ 1] + MD5C24;
270   const u32 H_w4c25 = w[ 4] + MD5C25;
271   const u32 H_w7c26 = w[ 7] + MD5C26;
272   const u32 H_wac27 = w[10] + MD5C27;
273   const u32 H_wdc28 = w[13] + MD5C28;
274   const u32 H_w0c29 =    0  + MD5C29;
275   const u32 H_w3c2a = w[ 3] + MD5C2a;
276   const u32 H_w6c2b = w[ 6] + MD5C2b;
277   const u32 H_w9c2c = w[ 9] + MD5C2c;
278   const u32 H_wcc2d = w[12] + MD5C2d;
279   const u32 H_wfc2e = w[15] + MD5C2e;
280   const u32 H_w2c2f = w[ 2] + MD5C2f;
281
282   const u32 I_w0c30 =    0  + MD5C30;
283   const u32 I_w7c31 = w[ 7] + MD5C31;
284   const u32 I_wec32 = w[14] + MD5C32;
285   const u32 I_w5c33 = w[ 5] + MD5C33;
286   const u32 I_wcc34 = w[12] + MD5C34;
287   const u32 I_w3c35 = w[ 3] + MD5C35;
288   const u32 I_wac36 = w[10] + MD5C36;
289   const u32 I_w1c37 = w[ 1] + MD5C37;
290   const u32 I_w8c38 = w[ 8] + MD5C38;
291   const u32 I_wfc39 = w[15] + MD5C39;
292   const u32 I_w6c3a = w[ 6] + MD5C3a;
293   const u32 I_wdc3b = w[13] + MD5C3b;
294   const u32 I_w4c3c = w[ 4] + MD5C3c;
295   const u32 I_wbc3d = w[11] + MD5C3d;
296   const u32 I_w2c3e = w[ 2] + MD5C3e;
297   const u32 I_w9c3f = w[ 9] + MD5C3f;
298
299   /**
300    * digest
301    */
302
303   const u32 search[4] =
304   {
305     digests_buf[digests_offset].digest_buf[DGST_R0],
306     digests_buf[digests_offset].digest_buf[DGST_R1],
307     digests_buf[digests_offset].digest_buf[DGST_R2],
308     digests_buf[digests_offset].digest_buf[DGST_R3]
309   };
310
311   /**
312    * reverse
313    */
314
315   u32 a_rev = digests_buf[digests_offset].digest_buf[0];
316   u32 b_rev = digests_buf[digests_offset].digest_buf[1];
317   u32 c_rev = digests_buf[digests_offset].digest_buf[2];
318   u32 d_rev = digests_buf[digests_offset].digest_buf[3];
319
320   MD5_STEP_REV (MD5_I, b_rev, c_rev, d_rev, a_rev, w[ 9], MD5C3f, MD5S33);
321   MD5_STEP_REV (MD5_I, c_rev, d_rev, a_rev, b_rev, w[ 2], MD5C3e, MD5S32);
322   MD5_STEP_REV (MD5_I, d_rev, a_rev, b_rev, c_rev, w[11], MD5C3d, MD5S31);
323   MD5_STEP_REV (MD5_I, a_rev, b_rev, c_rev, d_rev, w[ 4], MD5C3c, MD5S30);
324   MD5_STEP_REV (MD5_I, b_rev, c_rev, d_rev, a_rev, w[13], MD5C3b, MD5S33);
325   MD5_STEP_REV (MD5_I, c_rev, d_rev, a_rev, b_rev, w[ 6], MD5C3a, MD5S32);
326   MD5_STEP_REV (MD5_I, d_rev, a_rev, b_rev, c_rev, w[15], MD5C39, MD5S31);
327   MD5_STEP_REV (MD5_I, a_rev, b_rev, c_rev, d_rev, w[ 8], MD5C38, MD5S30);
328   MD5_STEP_REV (MD5_I, b_rev, c_rev, d_rev, a_rev, w[ 1], MD5C37, MD5S33);
329   MD5_STEP_REV (MD5_I, c_rev, d_rev, a_rev, b_rev, w[10], MD5C36, MD5S32);
330   MD5_STEP_REV (MD5_I, d_rev, a_rev, b_rev, c_rev, w[ 3], MD5C35, MD5S31);
331   MD5_STEP_REV (MD5_I, a_rev, b_rev, c_rev, d_rev, w[12], MD5C34, MD5S30);
332   MD5_STEP_REV (MD5_I, b_rev, c_rev, d_rev, a_rev, w[ 5], MD5C33, MD5S33);
333   MD5_STEP_REV (MD5_I, c_rev, d_rev, a_rev, b_rev, w[14], MD5C32, MD5S32);
334   MD5_STEP_REV (MD5_I, d_rev, a_rev, b_rev, c_rev, w[ 7], MD5C31, MD5S31);
335   MD5_STEP_REV (MD5_I, a_rev, b_rev, c_rev, d_rev,     0, MD5C30, MD5S30);
336
337   const u32 pre_cd = c_rev ^ d_rev;
338
339   MD5_STEP_REV1(MD5_H, b_rev, c_rev, d_rev, a_rev, w[ 2], MD5C2f, MD5S23);
340   MD5_STEP_REV1(MD5_H, c_rev, d_rev, a_rev, b_rev, w[15], MD5C2e, MD5S22);
341
342   /**
343    * loop
344    */
345
346   u32 w0l = w[0];
347
348   for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos++)
349   {
350     const u32 w0r = words_buf_r[il_pos];
351
352     const u32 w0 = w0l | w0r;
353
354     const u32 pre_d = d_rev;
355     const u32 pre_a = a_rev - w0;
356     const u32 pre_b = b_rev - (pre_a ^ pre_cd);
357     const u32 pre_c = c_rev - (pre_a ^ pre_b ^ pre_d);
358
359     u32 tmp2;
360
361     u32 a = MD5M_A;
362     u32 b = MD5M_B;
363     u32 c = MD5M_C;
364     u32 d = MD5M_D;
365
366     MD5_STEP (MD5_Fo, a, b, c, d, w0, F_w0c00, MD5S00);
367     MD5_STEP0(MD5_Fo, d, a, b, c,     F_w1c01, MD5S01);
368     MD5_STEP0(MD5_Fo, c, d, a, b,     F_w2c02, MD5S02);
369     MD5_STEP0(MD5_Fo, b, c, d, a,     F_w3c03, MD5S03);
370     MD5_STEP0(MD5_Fo, a, b, c, d,     F_w4c04, MD5S00);
371     MD5_STEP0(MD5_Fo, d, a, b, c,     F_w5c05, MD5S01);
372     MD5_STEP0(MD5_Fo, c, d, a, b,     F_w6c06, MD5S02);
373     MD5_STEP0(MD5_Fo, b, c, d, a,     F_w7c07, MD5S03);
374     MD5_STEP0(MD5_Fo, a, b, c, d,     F_w8c08, MD5S00);
375     MD5_STEP0(MD5_Fo, d, a, b, c,     F_w9c09, MD5S01);
376     MD5_STEP0(MD5_Fo, c, d, a, b,     F_wac0a, MD5S02);
377     MD5_STEP0(MD5_Fo, b, c, d, a,     F_wbc0b, MD5S03);
378     MD5_STEP0(MD5_Fo, a, b, c, d,     F_wcc0c, MD5S00);
379     MD5_STEP0(MD5_Fo, d, a, b, c,     F_wdc0d, MD5S01);
380     MD5_STEP0(MD5_Fo, c, d, a, b,     F_wec0e, MD5S02);
381     MD5_STEP0(MD5_Fo, b, c, d, a,     F_wfc0f, MD5S03);
382
383     MD5_STEP0(MD5_Go, a, b, c, d,     G_w1c10, MD5S10);
384     MD5_STEP0(MD5_Go, d, a, b, c,     G_w6c11, MD5S11);
385     MD5_STEP0(MD5_Go, c, d, a, b,     G_wbc12, MD5S12);
386     MD5_STEP (MD5_Go, b, c, d, a, w0, G_w0c13, MD5S13);
387     MD5_STEP0(MD5_Go, a, b, c, d,     G_w5c14, MD5S10);
388     MD5_STEP0(MD5_Go, d, a, b, c,     G_wac15, MD5S11);
389     MD5_STEP0(MD5_Go, c, d, a, b,     G_wfc16, MD5S12);
390     MD5_STEP0(MD5_Go, b, c, d, a,     G_w4c17, MD5S13);
391     MD5_STEP0(MD5_Go, a, b, c, d,     G_w9c18, MD5S10);
392     MD5_STEP0(MD5_Go, d, a, b, c,     G_wec19, MD5S11);
393     MD5_STEP0(MD5_Go, c, d, a, b,     G_w3c1a, MD5S12);
394     MD5_STEP0(MD5_Go, b, c, d, a,     G_w8c1b, MD5S13);
395     MD5_STEP0(MD5_Go, a, b, c, d,     G_wdc1c, MD5S10);
396     MD5_STEP0(MD5_Go, d, a, b, c,     G_w2c1d, MD5S11);
397     MD5_STEP0(MD5_Go, c, d, a, b,     G_w7c1e, MD5S12);
398     MD5_STEP0(MD5_Go, b, c, d, a,     G_wcc1f, MD5S13);
399
400     MD5_STEP0(MD5_H1, a, b, c, d,     H_w5c20, MD5S20);
401     MD5_STEP0(MD5_H2, d, a, b, c,     H_w8c21, MD5S21);
402     MD5_STEP0(MD5_H1, c, d, a, b,     H_wbc22, MD5S22);
403     MD5_STEP0(MD5_H2, b, c, d, a,     H_wec23, MD5S23);
404     MD5_STEP0(MD5_H1, a, b, c, d,     H_w1c24, MD5S20);
405     MD5_STEP0(MD5_H2, d, a, b, c,     H_w4c25, MD5S21);
406     MD5_STEP0(MD5_H1, c, d, a, b,     H_w7c26, MD5S22);
407     MD5_STEP0(MD5_H2, b, c, d, a,     H_wac27, MD5S23);
408     MD5_STEP0(MD5_H1, a, b, c, d,     H_wdc28, MD5S20);
409     MD5_STEP (MD5_H2, d, a, b, c, w0, H_w0c29, MD5S21);
410     MD5_STEP0(MD5_H1, c, d, a, b,     H_w3c2a, MD5S22);
411
412     bool q_cond = allx (pre_c != c);
413
414     if (q_cond) continue;
415
416     MD5_STEP0(MD5_H2, b, c, d, a,     H_w6c2b, MD5S23);
417     MD5_STEP0(MD5_H1, a, b, c, d,     H_w9c2c, MD5S20);
418     MD5_STEP0(MD5_H2, d, a, b, c,     H_wcc2d, MD5S21);
419
420     bool q_cond2 = allx (pre_d != d);
421
422     if (q_cond2) continue;
423
424     MD5_STEP0(MD5_H1, c, d, a, b,     H_wfc2e, MD5S22);
425     MD5_STEP0(MD5_H2, b, c, d, a,     H_w2c2f, MD5S23);
426
427     MD5_STEP (MD5_I , a, b, c, d, w0, I_w0c30, MD5S30);
428     MD5_STEP0(MD5_I , d, a, b, c,     I_w7c31, MD5S31);
429     MD5_STEP0(MD5_I , c, d, a, b,     I_wec32, MD5S32);
430     MD5_STEP0(MD5_I , b, c, d, a,     I_w5c33, MD5S33);
431     MD5_STEP0(MD5_I , a, b, c, d,     I_wcc34, MD5S30);
432     MD5_STEP0(MD5_I , d, a, b, c,     I_w3c35, MD5S31);
433     MD5_STEP0(MD5_I , c, d, a, b,     I_wac36, MD5S32);
434     MD5_STEP0(MD5_I , b, c, d, a,     I_w1c37, MD5S33);
435     MD5_STEP0(MD5_I , a, b, c, d,     I_w8c38, MD5S30);
436     MD5_STEP0(MD5_I , d, a, b, c,     I_wfc39, MD5S31);
437     MD5_STEP0(MD5_I , c, d, a, b,     I_w6c3a, MD5S32);
438     MD5_STEP0(MD5_I , b, c, d, a,     I_wdc3b, MD5S33);
439     MD5_STEP0(MD5_I , a, b, c, d,     I_w4c3c, MD5S30);
440     MD5_STEP0(MD5_I , d, a, b, c,     I_wbc3d, MD5S31);
441     MD5_STEP0(MD5_I , c, d, a, b,     I_w2c3e, MD5S32);
442     MD5_STEP0(MD5_I , b, c, d, a,     I_w9c3f, MD5S33);
443
444
445     const u32 r0 = a;
446     const u32 r1 = d;
447     const u32 r2 = c;
448     const u32 r3 = b;
449
450     #include COMPARE_S
451   }
452 }
453
454 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00000_m04 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32 * 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)
455 {
456   /**
457    * base
458    */
459
460   const u32 gid = get_global_id (0);
461
462   if (gid >= gid_max) return;
463
464   u32 w[16];
465
466   w[ 0] = pws[gid].i[ 0];
467   w[ 1] = pws[gid].i[ 1];
468   w[ 2] = pws[gid].i[ 2];
469   w[ 3] = pws[gid].i[ 3];
470   w[ 4] = 0;
471   w[ 5] = 0;
472   w[ 6] = 0;
473   w[ 7] = 0;
474   w[ 8] = 0;
475   w[ 9] = 0;
476   w[10] = 0;
477   w[11] = 0;
478   w[12] = 0;
479   w[13] = 0;
480   w[14] = pws[gid].i[14];
481   w[15] = 0;
482
483   const u32 pw_len = pws[gid].pw_len;
484
485   /**
486    * main
487    */
488
489   m00000m (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);
490 }
491
492 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00000_m08 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32 * 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)
493 {
494   /**
495    * base
496    */
497
498   const u32 gid = get_global_id (0);
499
500   if (gid >= gid_max) return;
501
502   u32 w[16];
503
504   w[ 0] = pws[gid].i[ 0];
505   w[ 1] = pws[gid].i[ 1];
506   w[ 2] = pws[gid].i[ 2];
507   w[ 3] = pws[gid].i[ 3];
508   w[ 4] = pws[gid].i[ 4];
509   w[ 5] = pws[gid].i[ 5];
510   w[ 6] = pws[gid].i[ 6];
511   w[ 7] = pws[gid].i[ 7];
512   w[ 8] = 0;
513   w[ 9] = 0;
514   w[10] = 0;
515   w[11] = 0;
516   w[12] = 0;
517   w[13] = 0;
518   w[14] = pws[gid].i[14];
519   w[15] = 0;
520
521   const u32 pw_len = pws[gid].pw_len;
522
523   /**
524    * main
525    */
526
527   m00000m (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);
528 }
529
530 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00000_m16 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32 * 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)
531 {
532   /**
533    * base
534    */
535
536   const u32 gid = get_global_id (0);
537
538   if (gid >= gid_max) return;
539
540   u32 w[16];
541
542   w[ 0] = pws[gid].i[ 0];
543   w[ 1] = pws[gid].i[ 1];
544   w[ 2] = pws[gid].i[ 2];
545   w[ 3] = pws[gid].i[ 3];
546   w[ 4] = pws[gid].i[ 4];
547   w[ 5] = pws[gid].i[ 5];
548   w[ 6] = pws[gid].i[ 6];
549   w[ 7] = pws[gid].i[ 7];
550   w[ 8] = pws[gid].i[ 8];
551   w[ 9] = pws[gid].i[ 9];
552   w[10] = pws[gid].i[10];
553   w[11] = pws[gid].i[11];
554   w[12] = pws[gid].i[12];
555   w[13] = pws[gid].i[13];
556   w[14] = pws[gid].i[14];
557   w[15] = pws[gid].i[15];
558
559   const u32 pw_len = pws[gid].pw_len;
560
561   /**
562    * main
563    */
564
565   m00000m (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);
566 }
567
568 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00000_s04 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32 * 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)
569 {
570   /**
571    * base
572    */
573
574   const u32 gid = get_global_id (0);
575
576   if (gid >= gid_max) return;
577
578   u32 w[16];
579
580   w[ 0] = pws[gid].i[ 0];
581   w[ 1] = pws[gid].i[ 1];
582   w[ 2] = pws[gid].i[ 2];
583   w[ 3] = pws[gid].i[ 3];
584   w[ 4] = 0;
585   w[ 5] = 0;
586   w[ 6] = 0;
587   w[ 7] = 0;
588   w[ 8] = 0;
589   w[ 9] = 0;
590   w[10] = 0;
591   w[11] = 0;
592   w[12] = 0;
593   w[13] = 0;
594   w[14] = pws[gid].i[14];
595   w[15] = 0;
596
597   const u32 pw_len = pws[gid].pw_len;
598
599   /**
600    * main
601    */
602
603   m00000s (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);
604 }
605
606 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00000_s08 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32 * 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)
607 {
608   /**
609    * base
610    */
611
612   const u32 gid = get_global_id (0);
613
614   if (gid >= gid_max) return;
615
616   u32 w[16];
617
618   w[ 0] = pws[gid].i[ 0];
619   w[ 1] = pws[gid].i[ 1];
620   w[ 2] = pws[gid].i[ 2];
621   w[ 3] = pws[gid].i[ 3];
622   w[ 4] = pws[gid].i[ 4];
623   w[ 5] = pws[gid].i[ 5];
624   w[ 6] = pws[gid].i[ 6];
625   w[ 7] = pws[gid].i[ 7];
626   w[ 8] = 0;
627   w[ 9] = 0;
628   w[10] = 0;
629   w[11] = 0;
630   w[12] = 0;
631   w[13] = 0;
632   w[14] = pws[gid].i[14];
633   w[15] = 0;
634
635   const u32 pw_len = pws[gid].pw_len;
636
637   /**
638    * main
639    */
640
641   m00000s (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);
642 }
643
644 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00000_s16 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32 * 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)
645 {
646   /**
647    * base
648    */
649
650   const u32 gid = get_global_id (0);
651
652   if (gid >= gid_max) return;
653
654   u32 w[16];
655
656   w[ 0] = pws[gid].i[ 0];
657   w[ 1] = pws[gid].i[ 1];
658   w[ 2] = pws[gid].i[ 2];
659   w[ 3] = pws[gid].i[ 3];
660   w[ 4] = pws[gid].i[ 4];
661   w[ 5] = pws[gid].i[ 5];
662   w[ 6] = pws[gid].i[ 6];
663   w[ 7] = pws[gid].i[ 7];
664   w[ 8] = pws[gid].i[ 8];
665   w[ 9] = pws[gid].i[ 9];
666   w[10] = pws[gid].i[10];
667   w[11] = pws[gid].i[11];
668   w[12] = pws[gid].i[12];
669   w[13] = pws[gid].i[13];
670   w[14] = pws[gid].i[14];
671   w[15] = pws[gid].i[15];
672
673   const u32 pw_len = pws[gid].pw_len;
674
675   /**
676    * main
677    */
678
679   m00000s (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);
680 }