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