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