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