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