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