Merge pull request #241 from philsmd/master
[hashcat.git] / OpenCL / m03800_a0.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 "include/constants.h"
11 #include "include/kernel_vendor.h"
12
13 #define DGST_R0 0
14 #define DGST_R1 3
15 #define DGST_R2 2
16 #define DGST_R3 1
17
18 #include "include/kernel_functions.c"
19 #include "OpenCL/types_ocl.c"
20 #include "OpenCL/common.c"
21 #include "include/rp_kernel.h"
22 #include "OpenCL/rp.c"
23 #include "OpenCL/simd.c"
24
25 __kernel void m03800_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)
26 {
27   /**
28    * modifier
29    */
30
31   const u32 gid = get_global_id (0);
32   const u32 lid = get_local_id (0);
33   const u32 lsz = get_local_size (0);
34
35   /**
36    * base
37    */
38
39   u32 pw_buf0[4];
40
41   pw_buf0[0] = pws[gid].i[ 0];
42   pw_buf0[1] = pws[gid].i[ 1];
43   pw_buf0[2] = pws[gid].i[ 2];
44   pw_buf0[3] = pws[gid].i[ 3];
45
46   u32 pw_buf1[4];
47
48   pw_buf1[0] = pws[gid].i[ 4];
49   pw_buf1[1] = pws[gid].i[ 5];
50   pw_buf1[2] = pws[gid].i[ 6];
51   pw_buf1[3] = pws[gid].i[ 7];
52
53   const u32 pw_len = pws[gid].pw_len;
54
55   /**
56    * salt
57    */
58
59   u32 salt_buf0[4];
60
61   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
62   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
63   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
64   salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
65
66   u32 salt_buf1[4];
67
68   salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
69   salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
70   salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
71   salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
72
73   u32 salt_buf2[4];
74
75   salt_buf2[0] = 0;
76   salt_buf2[1] = 0;
77   salt_buf2[2] = 0;
78   salt_buf2[3] = 0;
79
80   u32 salt_buf3[4];
81
82   salt_buf3[0] = 0;
83   salt_buf3[1] = 0;
84   salt_buf3[2] = 0;
85   salt_buf3[3] = 0;
86
87   const u32 salt_len = salt_bufs[salt_pos].salt_len;
88
89   /**
90    * loop
91    */
92
93   for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
94   {
95     u32x w0[4] = { 0 };
96     u32x w1[4] = { 0 };
97     u32x w2[4] = { 0 };
98     u32x w3[4] = { 0 };
99
100     const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
101
102     u32x w0_t[4];
103
104     w0_t[0] = w0[0];
105     w0_t[1] = w0[1];
106     w0_t[2] = w0[2];
107     w0_t[3] = w0[3];
108
109     u32x w1_t[4];
110
111     w1_t[0] = w1[0];
112     w1_t[1] = w1[1];
113     w1_t[2] = w1[2];
114     w1_t[3] = w1[3];
115
116     u32x w2_t[4];
117
118     w2_t[0] = w2[0];
119     w2_t[1] = w2[1];
120     w2_t[2] = w2[2];
121     w2_t[3] = w2[3];
122
123     u32x w3_t[4];
124
125     w3_t[0] = w3[0];
126     w3_t[1] = w3[1];
127     w3_t[2] = w3[2];
128     w3_t[3] = w3[3];
129
130     /**
131      * prepend salt
132      */
133
134     switch_buffer_by_offset_le (w0_t, w1_t, w2_t, w3_t, salt_len);
135
136     w0_t[0] |= salt_buf0[0];
137     w0_t[1] |= salt_buf0[1];
138     w0_t[2] |= salt_buf0[2];
139     w0_t[3] |= salt_buf0[3];
140     w1_t[0] |= salt_buf1[0];
141     w1_t[1] |= salt_buf1[1];
142     w1_t[2] |= salt_buf1[2];
143     w1_t[3] |= salt_buf1[3];
144     w2_t[0] |= salt_buf2[0];
145     w2_t[1] |= salt_buf2[1];
146     w2_t[2] |= salt_buf2[2];
147     w2_t[3] |= salt_buf2[3];
148     w3_t[0] |= salt_buf3[0];
149     w3_t[1] |= salt_buf3[1];
150     w3_t[2] |= salt_buf3[2];
151     w3_t[3] |= salt_buf3[3];
152
153     /**
154      * append salt
155      */
156
157     u32x s0[4];
158
159     s0[0] = salt_buf0[0];
160     s0[1] = salt_buf0[1];
161     s0[2] = salt_buf0[2];
162     s0[3] = salt_buf0[3];
163
164     u32x s1[4];
165
166     s1[0] = salt_buf1[0];
167     s1[1] = salt_buf1[1];
168     s1[2] = salt_buf1[2];
169     s1[3] = salt_buf1[3];
170
171     u32x s2[4];
172
173     s2[0] = 0;
174     s2[1] = 0;
175     s2[2] = 0;
176     s2[3] = 0;
177
178     u32x s3[4];
179
180     s3[0] = 0;
181     s3[1] = 0;
182     s3[2] = 0;
183     s3[3] = 0;
184
185     switch_buffer_by_offset_le_VV (s0, s1, s2, s3, salt_len + out_len);
186
187     w0_t[0] |= s0[0];
188     w0_t[1] |= s0[1];
189     w0_t[2] |= s0[2];
190     w0_t[3] |= s0[3];
191     w1_t[0] |= s1[0];
192     w1_t[1] |= s1[1];
193     w1_t[2] |= s1[2];
194     w1_t[3] |= s1[3];
195     w2_t[0] |= s2[0];
196     w2_t[1] |= s2[1];
197     w2_t[2] |= s2[2];
198     w2_t[3] |= s2[3];
199     w3_t[0] |= s3[0];
200     w3_t[1] |= s3[1];
201     w3_t[2] |= s3[2];
202     w3_t[3] |= s3[3];
203
204     const u32x pw_salt_len = salt_len + out_len + salt_len;
205
206     append_0x80_4x4_VV (w0_t, w1_t, w2_t, w3_t, pw_salt_len);
207
208     w3_t[2] = pw_salt_len * 8;
209
210     /**
211      * md5
212      */
213
214     u32x a = MD5M_A;
215     u32x b = MD5M_B;
216     u32x c = MD5M_C;
217     u32x d = MD5M_D;
218
219     MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
220     MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
221     MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
222     MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
223     MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
224     MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
225     MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
226     MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
227     MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
228     MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
229     MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
230     MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
231     MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
232     MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
233     MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
234     MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
235
236     MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
237     MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
238     MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
239     MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
240     MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
241     MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
242     MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
243     MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
244     MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
245     MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
246     MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
247     MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
248     MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
249     MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
250     MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
251     MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
252
253     MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
254     MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
255     MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
256     MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
257     MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
258     MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
259     MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
260     MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
261     MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
262     MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
263     MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
264     MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
265     MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
266     MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
267     MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
268     MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
269
270     MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
271     MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
272     MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
273     MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
274     MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
275     MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
276     MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
277     MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
278     MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
279     MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
280     MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
281     MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
282     MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
283     MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
284     MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
285     MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
286
287     COMPARE_M_SIMD (a, d, c, b);
288   }
289 }
290
291 __kernel void m03800_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)
292 {
293 }
294
295 __kernel void m03800_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)
296 {
297 }
298
299 __kernel void m03800_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)
300 {
301   /**
302    * modifier
303    */
304
305   const u32 gid = get_global_id (0);
306   const u32 lid = get_local_id (0);
307   const u32 lsz = get_local_size (0);
308
309   /**
310    * base
311    */
312
313   u32 pw_buf0[4];
314
315   pw_buf0[0] = pws[gid].i[ 0];
316   pw_buf0[1] = pws[gid].i[ 1];
317   pw_buf0[2] = pws[gid].i[ 2];
318   pw_buf0[3] = pws[gid].i[ 3];
319
320   u32 pw_buf1[4];
321
322   pw_buf1[0] = pws[gid].i[ 4];
323   pw_buf1[1] = pws[gid].i[ 5];
324   pw_buf1[2] = pws[gid].i[ 6];
325   pw_buf1[3] = pws[gid].i[ 7];
326
327   const u32 pw_len = pws[gid].pw_len;
328
329   /**
330    * salt
331    */
332
333   u32 salt_buf0[4];
334
335   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
336   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
337   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
338   salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
339
340   u32 salt_buf1[4];
341
342   salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
343   salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
344   salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
345   salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
346
347   u32 salt_buf2[4];
348
349   salt_buf2[0] = 0;
350   salt_buf2[1] = 0;
351   salt_buf2[2] = 0;
352   salt_buf2[3] = 0;
353
354   u32 salt_buf3[4];
355
356   salt_buf3[0] = 0;
357   salt_buf3[1] = 0;
358   salt_buf3[2] = 0;
359   salt_buf3[3] = 0;
360
361   const u32 salt_len = salt_bufs[salt_pos].salt_len;
362
363   /**
364    * digest
365    */
366
367   const u32 search[4] =
368   {
369     digests_buf[digests_offset].digest_buf[DGST_R0],
370     digests_buf[digests_offset].digest_buf[DGST_R1],
371     digests_buf[digests_offset].digest_buf[DGST_R2],
372     digests_buf[digests_offset].digest_buf[DGST_R3]
373   };
374
375   /**
376    * loop
377    */
378
379   for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
380   {
381     u32x w0[4] = { 0 };
382     u32x w1[4] = { 0 };
383     u32x w2[4] = { 0 };
384     u32x w3[4] = { 0 };
385
386     const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
387
388     u32x w0_t[4];
389
390     w0_t[0] = w0[0];
391     w0_t[1] = w0[1];
392     w0_t[2] = w0[2];
393     w0_t[3] = w0[3];
394
395     u32x w1_t[4];
396
397     w1_t[0] = w1[0];
398     w1_t[1] = w1[1];
399     w1_t[2] = w1[2];
400     w1_t[3] = w1[3];
401
402     u32x w2_t[4];
403
404     w2_t[0] = w2[0];
405     w2_t[1] = w2[1];
406     w2_t[2] = w2[2];
407     w2_t[3] = w2[3];
408
409     u32x w3_t[4];
410
411     w3_t[0] = w3[0];
412     w3_t[1] = w3[1];
413     w3_t[2] = w3[2];
414     w3_t[3] = w3[3];
415
416     /**
417      * prepend salt
418      */
419
420     switch_buffer_by_offset_le (w0_t, w1_t, w2_t, w3_t, salt_len);
421
422     w0_t[0] |= salt_buf0[0];
423     w0_t[1] |= salt_buf0[1];
424     w0_t[2] |= salt_buf0[2];
425     w0_t[3] |= salt_buf0[3];
426     w1_t[0] |= salt_buf1[0];
427     w1_t[1] |= salt_buf1[1];
428     w1_t[2] |= salt_buf1[2];
429     w1_t[3] |= salt_buf1[3];
430     w2_t[0] |= salt_buf2[0];
431     w2_t[1] |= salt_buf2[1];
432     w2_t[2] |= salt_buf2[2];
433     w2_t[3] |= salt_buf2[3];
434     w3_t[0] |= salt_buf3[0];
435     w3_t[1] |= salt_buf3[1];
436     w3_t[2] |= salt_buf3[2];
437     w3_t[3] |= salt_buf3[3];
438
439     /**
440      * append salt
441      */
442
443     u32x s0[4];
444
445     s0[0] = salt_buf0[0];
446     s0[1] = salt_buf0[1];
447     s0[2] = salt_buf0[2];
448     s0[3] = salt_buf0[3];
449
450     u32x s1[4];
451
452     s1[0] = salt_buf1[0];
453     s1[1] = salt_buf1[1];
454     s1[2] = salt_buf1[2];
455     s1[3] = salt_buf1[3];
456
457     u32x s2[4];
458
459     s2[0] = 0;
460     s2[1] = 0;
461     s2[2] = 0;
462     s2[3] = 0;
463
464     u32x s3[4];
465
466     s3[0] = 0;
467     s3[1] = 0;
468     s3[2] = 0;
469     s3[3] = 0;
470
471     switch_buffer_by_offset_le_VV (s0, s1, s2, s3, salt_len + out_len);
472
473     w0_t[0] |= s0[0];
474     w0_t[1] |= s0[1];
475     w0_t[2] |= s0[2];
476     w0_t[3] |= s0[3];
477     w1_t[0] |= s1[0];
478     w1_t[1] |= s1[1];
479     w1_t[2] |= s1[2];
480     w1_t[3] |= s1[3];
481     w2_t[0] |= s2[0];
482     w2_t[1] |= s2[1];
483     w2_t[2] |= s2[2];
484     w2_t[3] |= s2[3];
485     w3_t[0] |= s3[0];
486     w3_t[1] |= s3[1];
487     w3_t[2] |= s3[2];
488     w3_t[3] |= s3[3];
489
490     const u32x pw_salt_len = salt_len + out_len + salt_len;
491
492     append_0x80_4x4_VV (w0_t, w1_t, w2_t, w3_t, pw_salt_len);
493
494     w3_t[2] = pw_salt_len * 8;
495
496     /**
497      * md5
498      */
499
500     u32x a = MD5M_A;
501     u32x b = MD5M_B;
502     u32x c = MD5M_C;
503     u32x d = MD5M_D;
504
505     MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
506     MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
507     MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
508     MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
509     MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
510     MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
511     MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
512     MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
513     MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
514     MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
515     MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
516     MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
517     MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
518     MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
519     MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
520     MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
521
522     MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
523     MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
524     MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
525     MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
526     MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
527     MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
528     MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
529     MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
530     MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
531     MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
532     MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
533     MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
534     MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
535     MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
536     MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
537     MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
538
539     MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
540     MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
541     MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
542     MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
543     MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
544     MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
545     MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
546     MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
547     MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
548     MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
549     MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
550     MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
551     MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
552     MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
553     MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
554     MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
555
556     MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
557     MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
558     MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
559     MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
560     MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
561     MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
562     MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
563     MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
564     MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
565     MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
566     MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
567     MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
568     MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
569     MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
570     MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
571     MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
572
573     COMPARE_S_SIMD (a, d, c, b);
574   }
575 }
576
577 __kernel void m03800_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)
578 {
579 }
580
581 __kernel void m03800_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)
582 {
583 }