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