Converted _a3 kernels, use SIMD for CPU and GPU
[hashcat.git] / OpenCL / m09900_a3.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 "OpenCL/simd.c"
22
23 static void m09900m (u32 w[16], const u32 pw_len, __global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset)
24 {
25   /**
26    * modifier
27    */
28
29   const u32 gid = get_global_id (0);
30   const u32 lid = get_local_id (0);
31
32   /**
33    * base
34    */
35
36   const u32 F_w0c00 =    0  + MD5C00;
37   const u32 F_w1c01 = w[ 1] + MD5C01;
38   const u32 F_w2c02 = w[ 2] + MD5C02;
39   const u32 F_w3c03 = w[ 3] + MD5C03;
40   const u32 F_w4c04 = w[ 4] + MD5C04;
41   const u32 F_w5c05 = w[ 5] + MD5C05;
42   const u32 F_w6c06 = w[ 6] + MD5C06;
43   const u32 F_w7c07 = w[ 7] + MD5C07;
44   const u32 F_w8c08 = w[ 8] + MD5C08;
45   const u32 F_w9c09 = w[ 9] + MD5C09;
46   const u32 F_wac0a = w[10] + MD5C0a;
47   const u32 F_wbc0b = w[11] + MD5C0b;
48   const u32 F_wcc0c = w[12] + MD5C0c;
49   const u32 F_wdc0d = w[13] + MD5C0d;
50   const u32 F_wec0e = w[14] + MD5C0e;
51   const u32 F_wfc0f = w[15] + MD5C0f;
52
53   const u32 G_w1c10 = w[ 1] + MD5C10;
54   const u32 G_w6c11 = w[ 6] + MD5C11;
55   const u32 G_wbc12 = w[11] + MD5C12;
56   const u32 G_w0c13 =    0  + MD5C13;
57   const u32 G_w5c14 = w[ 5] + MD5C14;
58   const u32 G_wac15 = w[10] + MD5C15;
59   const u32 G_wfc16 = w[15] + MD5C16;
60   const u32 G_w4c17 = w[ 4] + MD5C17;
61   const u32 G_w9c18 = w[ 9] + MD5C18;
62   const u32 G_wec19 = w[14] + MD5C19;
63   const u32 G_w3c1a = w[ 3] + MD5C1a;
64   const u32 G_w8c1b = w[ 8] + MD5C1b;
65   const u32 G_wdc1c = w[13] + MD5C1c;
66   const u32 G_w2c1d = w[ 2] + MD5C1d;
67   const u32 G_w7c1e = w[ 7] + MD5C1e;
68   const u32 G_wcc1f = w[12] + MD5C1f;
69
70   const u32 H_w5c20 = w[ 5] + MD5C20;
71   const u32 H_w8c21 = w[ 8] + MD5C21;
72   const u32 H_wbc22 = w[11] + MD5C22;
73   const u32 H_wec23 = w[14] + MD5C23;
74   const u32 H_w1c24 = w[ 1] + MD5C24;
75   const u32 H_w4c25 = w[ 4] + MD5C25;
76   const u32 H_w7c26 = w[ 7] + MD5C26;
77   const u32 H_wac27 = w[10] + MD5C27;
78   const u32 H_wdc28 = w[13] + MD5C28;
79   const u32 H_w0c29 =    0  + MD5C29;
80   const u32 H_w3c2a = w[ 3] + MD5C2a;
81   const u32 H_w6c2b = w[ 6] + MD5C2b;
82   const u32 H_w9c2c = w[ 9] + MD5C2c;
83   const u32 H_wcc2d = w[12] + MD5C2d;
84   const u32 H_wfc2e = w[15] + MD5C2e;
85   const u32 H_w2c2f = w[ 2] + MD5C2f;
86
87   const u32 I_w0c30 =    0  + MD5C30;
88   const u32 I_w7c31 = w[ 7] + MD5C31;
89   const u32 I_wec32 = w[14] + MD5C32;
90   const u32 I_w5c33 = w[ 5] + MD5C33;
91   const u32 I_wcc34 = w[12] + MD5C34;
92   const u32 I_w3c35 = w[ 3] + MD5C35;
93   const u32 I_wac36 = w[10] + MD5C36;
94   const u32 I_w1c37 = w[ 1] + MD5C37;
95   const u32 I_w8c38 = w[ 8] + MD5C38;
96   const u32 I_wfc39 = w[15] + MD5C39;
97   const u32 I_w6c3a = w[ 6] + MD5C3a;
98   const u32 I_wdc3b = w[13] + MD5C3b;
99   const u32 I_w4c3c = w[ 4] + MD5C3c;
100   const u32 I_wbc3d = w[11] + MD5C3d;
101   const u32 I_w2c3e = w[ 2] + MD5C3e;
102   const u32 I_w9c3f = w[ 9] + MD5C3f;
103
104   /**
105    * loop
106    */
107
108   u32 w0l = w[0];
109
110   for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos += VECT_SIZE)
111   {
112     const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
113
114     const u32x w0 = w0l | w0r;
115
116     u32x a = MD5M_A;
117     u32x b = MD5M_B;
118     u32x c = MD5M_C;
119     u32x d = MD5M_D;
120
121     MD5_STEP (MD5_Fo, a, b, c, d, w0, F_w0c00, MD5S00);
122     MD5_STEP0(MD5_Fo, d, a, b, c,     F_w1c01, MD5S01);
123     MD5_STEP0(MD5_Fo, c, d, a, b,     F_w2c02, MD5S02);
124     MD5_STEP0(MD5_Fo, b, c, d, a,     F_w3c03, MD5S03);
125     MD5_STEP0(MD5_Fo, a, b, c, d,     F_w4c04, MD5S00);
126     MD5_STEP0(MD5_Fo, d, a, b, c,     F_w5c05, MD5S01);
127     MD5_STEP0(MD5_Fo, c, d, a, b,     F_w6c06, MD5S02);
128     MD5_STEP0(MD5_Fo, b, c, d, a,     F_w7c07, MD5S03);
129     MD5_STEP0(MD5_Fo, a, b, c, d,     F_w8c08, MD5S00);
130     MD5_STEP0(MD5_Fo, d, a, b, c,     F_w9c09, MD5S01);
131     MD5_STEP0(MD5_Fo, c, d, a, b,     F_wac0a, MD5S02);
132     MD5_STEP0(MD5_Fo, b, c, d, a,     F_wbc0b, MD5S03);
133     MD5_STEP0(MD5_Fo, a, b, c, d,     F_wcc0c, MD5S00);
134     MD5_STEP0(MD5_Fo, d, a, b, c,     F_wdc0d, MD5S01);
135     MD5_STEP0(MD5_Fo, c, d, a, b,     F_wec0e, MD5S02);
136     MD5_STEP0(MD5_Fo, b, c, d, a,     F_wfc0f, MD5S03);
137
138     MD5_STEP0(MD5_Go, a, b, c, d,     G_w1c10, MD5S10);
139     MD5_STEP0(MD5_Go, d, a, b, c,     G_w6c11, MD5S11);
140     MD5_STEP0(MD5_Go, c, d, a, b,     G_wbc12, MD5S12);
141     MD5_STEP (MD5_Go, b, c, d, a, w0, G_w0c13, MD5S13);
142     MD5_STEP0(MD5_Go, a, b, c, d,     G_w5c14, MD5S10);
143     MD5_STEP0(MD5_Go, d, a, b, c,     G_wac15, MD5S11);
144     MD5_STEP0(MD5_Go, c, d, a, b,     G_wfc16, MD5S12);
145     MD5_STEP0(MD5_Go, b, c, d, a,     G_w4c17, MD5S13);
146     MD5_STEP0(MD5_Go, a, b, c, d,     G_w9c18, MD5S10);
147     MD5_STEP0(MD5_Go, d, a, b, c,     G_wec19, MD5S11);
148     MD5_STEP0(MD5_Go, c, d, a, b,     G_w3c1a, MD5S12);
149     MD5_STEP0(MD5_Go, b, c, d, a,     G_w8c1b, MD5S13);
150     MD5_STEP0(MD5_Go, a, b, c, d,     G_wdc1c, MD5S10);
151     MD5_STEP0(MD5_Go, d, a, b, c,     G_w2c1d, MD5S11);
152     MD5_STEP0(MD5_Go, c, d, a, b,     G_w7c1e, MD5S12);
153     MD5_STEP0(MD5_Go, b, c, d, a,     G_wcc1f, MD5S13);
154
155     MD5_STEP0(MD5_H , a, b, c, d,     H_w5c20, MD5S20);
156     MD5_STEP0(MD5_H , d, a, b, c,     H_w8c21, MD5S21);
157     MD5_STEP0(MD5_H , c, d, a, b,     H_wbc22, MD5S22);
158     MD5_STEP0(MD5_H , b, c, d, a,     H_wec23, MD5S23);
159     MD5_STEP0(MD5_H , a, b, c, d,     H_w1c24, MD5S20);
160     MD5_STEP0(MD5_H , d, a, b, c,     H_w4c25, MD5S21);
161     MD5_STEP0(MD5_H , c, d, a, b,     H_w7c26, MD5S22);
162     MD5_STEP0(MD5_H , b, c, d, a,     H_wac27, MD5S23);
163     MD5_STEP0(MD5_H , a, b, c, d,     H_wdc28, MD5S20);
164     MD5_STEP (MD5_H , d, a, b, c, w0, H_w0c29, MD5S21);
165     MD5_STEP0(MD5_H , c, d, a, b,     H_w3c2a, MD5S22);
166     MD5_STEP0(MD5_H , b, c, d, a,     H_w6c2b, MD5S23);
167     MD5_STEP0(MD5_H , a, b, c, d,     H_w9c2c, MD5S20);
168     MD5_STEP0(MD5_H , d, a, b, c,     H_wcc2d, MD5S21);
169     MD5_STEP0(MD5_H , c, d, a, b,     H_wfc2e, MD5S22);
170     MD5_STEP0(MD5_H , b, c, d, a,     H_w2c2f, MD5S23);
171
172     MD5_STEP (MD5_I , a, b, c, d, w0, I_w0c30, MD5S30);
173     MD5_STEP0(MD5_I , d, a, b, c,     I_w7c31, MD5S31);
174     MD5_STEP0(MD5_I , c, d, a, b,     I_wec32, MD5S32);
175     MD5_STEP0(MD5_I , b, c, d, a,     I_w5c33, MD5S33);
176     MD5_STEP0(MD5_I , a, b, c, d,     I_wcc34, MD5S30);
177     MD5_STEP0(MD5_I , d, a, b, c,     I_w3c35, MD5S31);
178     MD5_STEP0(MD5_I , c, d, a, b,     I_wac36, MD5S32);
179     MD5_STEP0(MD5_I , b, c, d, a,     I_w1c37, MD5S33);
180     MD5_STEP0(MD5_I , a, b, c, d,     I_w8c38, MD5S30);
181     MD5_STEP0(MD5_I , d, a, b, c,     I_wfc39, MD5S31);
182     MD5_STEP0(MD5_I , c, d, a, b,     I_w6c3a, MD5S32);
183     MD5_STEP0(MD5_I , b, c, d, a,     I_wdc3b, MD5S33);
184     MD5_STEP0(MD5_I , a, b, c, d,     I_w4c3c, MD5S30);
185     MD5_STEP0(MD5_I , d, a, b, c,     I_wbc3d, MD5S31);
186     MD5_STEP0(MD5_I , c, d, a, b,     I_w2c3e, MD5S32);
187     MD5_STEP0(MD5_I , b, c, d, a,     I_w9c3f, MD5S33);
188
189     a += MD5M_A;
190     b += MD5M_B;
191     c += MD5M_C;
192     d += MD5M_D;
193
194     u32x r_a = a;
195     u32x r_b = b;
196     u32x r_c = c;
197     u32x r_d = d;
198
199     u32x t0[4];
200     u32x t1[4];
201     u32x t2[4];
202     u32x t3[4];
203
204     t0[0] = 0;
205     t0[1] = 0;
206     t0[2] = 0;
207     t0[3] = 0;
208     t1[0] = 0;
209     t1[1] = 0;
210     t1[2] = 0;
211     t1[3] = 0;
212     t2[0] = 0;
213     t2[1] = 0x80;
214     t2[2] = 0;
215     t2[3] = 0;
216     t3[0] = 0;
217     t3[1] = 0;
218     t3[2] = 100 * 8;
219     t3[3] = 0;
220
221     MD5_STEP (MD5_Fo, a, b, c, d, t0[0], MD5C00, MD5S00);
222     MD5_STEP (MD5_Fo, d, a, b, c, t0[1], MD5C01, MD5S01);
223     MD5_STEP (MD5_Fo, c, d, a, b, t0[2], MD5C02, MD5S02);
224     MD5_STEP (MD5_Fo, b, c, d, a, t0[3], MD5C03, MD5S03);
225     MD5_STEP (MD5_Fo, a, b, c, d, t1[0], MD5C04, MD5S00);
226     MD5_STEP (MD5_Fo, d, a, b, c, t1[1], MD5C05, MD5S01);
227     MD5_STEP (MD5_Fo, c, d, a, b, t1[2], MD5C06, MD5S02);
228     MD5_STEP (MD5_Fo, b, c, d, a, t1[3], MD5C07, MD5S03);
229     MD5_STEP (MD5_Fo, a, b, c, d, t2[0], MD5C08, MD5S00);
230     MD5_STEP (MD5_Fo, d, a, b, c, t2[1], MD5C09, MD5S01);
231     MD5_STEP (MD5_Fo, c, d, a, b, t2[2], MD5C0a, MD5S02);
232     MD5_STEP (MD5_Fo, b, c, d, a, t2[3], MD5C0b, MD5S03);
233     MD5_STEP (MD5_Fo, a, b, c, d, t3[0], MD5C0c, MD5S00);
234     MD5_STEP (MD5_Fo, d, a, b, c, t3[1], MD5C0d, MD5S01);
235     MD5_STEP (MD5_Fo, c, d, a, b, t3[2], MD5C0e, MD5S02);
236     MD5_STEP (MD5_Fo, b, c, d, a, t3[3], MD5C0f, MD5S03);
237
238     MD5_STEP (MD5_Go, a, b, c, d, t0[1], MD5C10, MD5S10);
239     MD5_STEP (MD5_Go, d, a, b, c, t1[2], MD5C11, MD5S11);
240     MD5_STEP (MD5_Go, c, d, a, b, t2[3], MD5C12, MD5S12);
241     MD5_STEP (MD5_Go, b, c, d, a, t0[0], MD5C13, MD5S13);
242     MD5_STEP (MD5_Go, a, b, c, d, t1[1], MD5C14, MD5S10);
243     MD5_STEP (MD5_Go, d, a, b, c, t2[2], MD5C15, MD5S11);
244     MD5_STEP (MD5_Go, c, d, a, b, t3[3], MD5C16, MD5S12);
245     MD5_STEP (MD5_Go, b, c, d, a, t1[0], MD5C17, MD5S13);
246     MD5_STEP (MD5_Go, a, b, c, d, t2[1], MD5C18, MD5S10);
247     MD5_STEP (MD5_Go, d, a, b, c, t3[2], MD5C19, MD5S11);
248     MD5_STEP (MD5_Go, c, d, a, b, t0[3], MD5C1a, MD5S12);
249     MD5_STEP (MD5_Go, b, c, d, a, t2[0], MD5C1b, MD5S13);
250     MD5_STEP (MD5_Go, a, b, c, d, t3[1], MD5C1c, MD5S10);
251     MD5_STEP (MD5_Go, d, a, b, c, t0[2], MD5C1d, MD5S11);
252     MD5_STEP (MD5_Go, c, d, a, b, t1[3], MD5C1e, MD5S12);
253     MD5_STEP (MD5_Go, b, c, d, a, t3[0], MD5C1f, MD5S13);
254
255     MD5_STEP (MD5_H , a, b, c, d, t1[1], MD5C20, MD5S20);
256     MD5_STEP (MD5_H , d, a, b, c, t2[0], MD5C21, MD5S21);
257     MD5_STEP (MD5_H , c, d, a, b, t2[3], MD5C22, MD5S22);
258     MD5_STEP (MD5_H , b, c, d, a, t3[2], MD5C23, MD5S23);
259     MD5_STEP (MD5_H , a, b, c, d, t0[1], MD5C24, MD5S20);
260     MD5_STEP (MD5_H , d, a, b, c, t1[0], MD5C25, MD5S21);
261     MD5_STEP (MD5_H , c, d, a, b, t1[3], MD5C26, MD5S22);
262     MD5_STEP (MD5_H , b, c, d, a, t2[2], MD5C27, MD5S23);
263     MD5_STEP (MD5_H , a, b, c, d, t3[1], MD5C28, MD5S20);
264     MD5_STEP (MD5_H , d, a, b, c, t0[0], MD5C29, MD5S21);
265     MD5_STEP (MD5_H , c, d, a, b, t0[3], MD5C2a, MD5S22);
266     MD5_STEP (MD5_H , b, c, d, a, t1[2], MD5C2b, MD5S23);
267     MD5_STEP (MD5_H , a, b, c, d, t2[1], MD5C2c, MD5S20);
268     MD5_STEP (MD5_H , d, a, b, c, t3[0], MD5C2d, MD5S21);
269     MD5_STEP (MD5_H , c, d, a, b, t3[3], MD5C2e, MD5S22);
270     MD5_STEP (MD5_H , b, c, d, a, t0[2], MD5C2f, MD5S23);
271
272     MD5_STEP (MD5_I , a, b, c, d, t0[0], MD5C30, MD5S30);
273     MD5_STEP (MD5_I , d, a, b, c, t1[3], MD5C31, MD5S31);
274     MD5_STEP (MD5_I , c, d, a, b, t3[2], MD5C32, MD5S32);
275     MD5_STEP (MD5_I , b, c, d, a, t1[1], MD5C33, MD5S33);
276     MD5_STEP (MD5_I , a, b, c, d, t3[0], MD5C34, MD5S30);
277     MD5_STEP (MD5_I , d, a, b, c, t0[3], MD5C35, MD5S31);
278     MD5_STEP (MD5_I , c, d, a, b, t2[2], MD5C36, MD5S32);
279     MD5_STEP (MD5_I , b, c, d, a, t0[1], MD5C37, MD5S33);
280     MD5_STEP (MD5_I , a, b, c, d, t2[0], MD5C38, MD5S30);
281     MD5_STEP (MD5_I , d, a, b, c, t3[3], MD5C39, MD5S31);
282     MD5_STEP (MD5_I , c, d, a, b, t1[2], MD5C3a, MD5S32);
283     MD5_STEP (MD5_I , b, c, d, a, t3[1], MD5C3b, MD5S33);
284     MD5_STEP (MD5_I , a, b, c, d, t1[0], MD5C3c, MD5S30);
285     MD5_STEP (MD5_I , d, a, b, c, t2[3], MD5C3d, MD5S31);
286     MD5_STEP (MD5_I , c, d, a, b, t0[2], MD5C3e, MD5S32);
287     MD5_STEP (MD5_I , b, c, d, a, t2[1], MD5C3f, MD5S33);
288
289     a += r_a;
290     b += r_b;
291     c += r_c;
292     d += r_d;
293
294     COMPARE_M_SIMD (a, d, c, b);
295   }
296 }
297
298 static void m09900s (u32 w[16], const u32 pw_len, __global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset)
299 {
300   /**
301    * modifier
302    */
303
304   const u32 gid = get_global_id (0);
305   const u32 lid = get_local_id (0);
306
307   /**
308    * base
309    */
310
311   const u32 F_w0c00 =    0  + MD5C00;
312   const u32 F_w1c01 = w[ 1] + MD5C01;
313   const u32 F_w2c02 = w[ 2] + MD5C02;
314   const u32 F_w3c03 = w[ 3] + MD5C03;
315   const u32 F_w4c04 = w[ 4] + MD5C04;
316   const u32 F_w5c05 = w[ 5] + MD5C05;
317   const u32 F_w6c06 = w[ 6] + MD5C06;
318   const u32 F_w7c07 = w[ 7] + MD5C07;
319   const u32 F_w8c08 = w[ 8] + MD5C08;
320   const u32 F_w9c09 = w[ 9] + MD5C09;
321   const u32 F_wac0a = w[10] + MD5C0a;
322   const u32 F_wbc0b = w[11] + MD5C0b;
323   const u32 F_wcc0c = w[12] + MD5C0c;
324   const u32 F_wdc0d = w[13] + MD5C0d;
325   const u32 F_wec0e = w[14] + MD5C0e;
326   const u32 F_wfc0f = w[15] + MD5C0f;
327
328   const u32 G_w1c10 = w[ 1] + MD5C10;
329   const u32 G_w6c11 = w[ 6] + MD5C11;
330   const u32 G_wbc12 = w[11] + MD5C12;
331   const u32 G_w0c13 =    0  + MD5C13;
332   const u32 G_w5c14 = w[ 5] + MD5C14;
333   const u32 G_wac15 = w[10] + MD5C15;
334   const u32 G_wfc16 = w[15] + MD5C16;
335   const u32 G_w4c17 = w[ 4] + MD5C17;
336   const u32 G_w9c18 = w[ 9] + MD5C18;
337   const u32 G_wec19 = w[14] + MD5C19;
338   const u32 G_w3c1a = w[ 3] + MD5C1a;
339   const u32 G_w8c1b = w[ 8] + MD5C1b;
340   const u32 G_wdc1c = w[13] + MD5C1c;
341   const u32 G_w2c1d = w[ 2] + MD5C1d;
342   const u32 G_w7c1e = w[ 7] + MD5C1e;
343   const u32 G_wcc1f = w[12] + MD5C1f;
344
345   const u32 H_w5c20 = w[ 5] + MD5C20;
346   const u32 H_w8c21 = w[ 8] + MD5C21;
347   const u32 H_wbc22 = w[11] + MD5C22;
348   const u32 H_wec23 = w[14] + MD5C23;
349   const u32 H_w1c24 = w[ 1] + MD5C24;
350   const u32 H_w4c25 = w[ 4] + MD5C25;
351   const u32 H_w7c26 = w[ 7] + MD5C26;
352   const u32 H_wac27 = w[10] + MD5C27;
353   const u32 H_wdc28 = w[13] + MD5C28;
354   const u32 H_w0c29 =    0  + MD5C29;
355   const u32 H_w3c2a = w[ 3] + MD5C2a;
356   const u32 H_w6c2b = w[ 6] + MD5C2b;
357   const u32 H_w9c2c = w[ 9] + MD5C2c;
358   const u32 H_wcc2d = w[12] + MD5C2d;
359   const u32 H_wfc2e = w[15] + MD5C2e;
360   const u32 H_w2c2f = w[ 2] + MD5C2f;
361
362   const u32 I_w0c30 =    0  + MD5C30;
363   const u32 I_w7c31 = w[ 7] + MD5C31;
364   const u32 I_wec32 = w[14] + MD5C32;
365   const u32 I_w5c33 = w[ 5] + MD5C33;
366   const u32 I_wcc34 = w[12] + MD5C34;
367   const u32 I_w3c35 = w[ 3] + MD5C35;
368   const u32 I_wac36 = w[10] + MD5C36;
369   const u32 I_w1c37 = w[ 1] + MD5C37;
370   const u32 I_w8c38 = w[ 8] + MD5C38;
371   const u32 I_wfc39 = w[15] + MD5C39;
372   const u32 I_w6c3a = w[ 6] + MD5C3a;
373   const u32 I_wdc3b = w[13] + MD5C3b;
374   const u32 I_w4c3c = w[ 4] + MD5C3c;
375   const u32 I_wbc3d = w[11] + MD5C3d;
376   const u32 I_w2c3e = w[ 2] + MD5C3e;
377   const u32 I_w9c3f = w[ 9] + MD5C3f;
378
379   /**
380    * digest
381    */
382
383   const u32 search[4] =
384   {
385     digests_buf[digests_offset].digest_buf[DGST_R0],
386     digests_buf[digests_offset].digest_buf[DGST_R1],
387     digests_buf[digests_offset].digest_buf[DGST_R2],
388     digests_buf[digests_offset].digest_buf[DGST_R3]
389   };
390
391   /**
392    * loop
393    */
394
395   u32 w0l = w[0];
396
397   for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos += VECT_SIZE)
398   {
399     const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
400
401     const u32x w0 = w0l | w0r;
402
403     u32x a = MD5M_A;
404     u32x b = MD5M_B;
405     u32x c = MD5M_C;
406     u32x d = MD5M_D;
407
408     MD5_STEP (MD5_Fo, a, b, c, d, w0, F_w0c00, MD5S00);
409     MD5_STEP0(MD5_Fo, d, a, b, c,     F_w1c01, MD5S01);
410     MD5_STEP0(MD5_Fo, c, d, a, b,     F_w2c02, MD5S02);
411     MD5_STEP0(MD5_Fo, b, c, d, a,     F_w3c03, MD5S03);
412     MD5_STEP0(MD5_Fo, a, b, c, d,     F_w4c04, MD5S00);
413     MD5_STEP0(MD5_Fo, d, a, b, c,     F_w5c05, MD5S01);
414     MD5_STEP0(MD5_Fo, c, d, a, b,     F_w6c06, MD5S02);
415     MD5_STEP0(MD5_Fo, b, c, d, a,     F_w7c07, MD5S03);
416     MD5_STEP0(MD5_Fo, a, b, c, d,     F_w8c08, MD5S00);
417     MD5_STEP0(MD5_Fo, d, a, b, c,     F_w9c09, MD5S01);
418     MD5_STEP0(MD5_Fo, c, d, a, b,     F_wac0a, MD5S02);
419     MD5_STEP0(MD5_Fo, b, c, d, a,     F_wbc0b, MD5S03);
420     MD5_STEP0(MD5_Fo, a, b, c, d,     F_wcc0c, MD5S00);
421     MD5_STEP0(MD5_Fo, d, a, b, c,     F_wdc0d, MD5S01);
422     MD5_STEP0(MD5_Fo, c, d, a, b,     F_wec0e, MD5S02);
423     MD5_STEP0(MD5_Fo, b, c, d, a,     F_wfc0f, MD5S03);
424
425     MD5_STEP0(MD5_Go, a, b, c, d,     G_w1c10, MD5S10);
426     MD5_STEP0(MD5_Go, d, a, b, c,     G_w6c11, MD5S11);
427     MD5_STEP0(MD5_Go, c, d, a, b,     G_wbc12, MD5S12);
428     MD5_STEP (MD5_Go, b, c, d, a, w0, G_w0c13, MD5S13);
429     MD5_STEP0(MD5_Go, a, b, c, d,     G_w5c14, MD5S10);
430     MD5_STEP0(MD5_Go, d, a, b, c,     G_wac15, MD5S11);
431     MD5_STEP0(MD5_Go, c, d, a, b,     G_wfc16, MD5S12);
432     MD5_STEP0(MD5_Go, b, c, d, a,     G_w4c17, MD5S13);
433     MD5_STEP0(MD5_Go, a, b, c, d,     G_w9c18, MD5S10);
434     MD5_STEP0(MD5_Go, d, a, b, c,     G_wec19, MD5S11);
435     MD5_STEP0(MD5_Go, c, d, a, b,     G_w3c1a, MD5S12);
436     MD5_STEP0(MD5_Go, b, c, d, a,     G_w8c1b, MD5S13);
437     MD5_STEP0(MD5_Go, a, b, c, d,     G_wdc1c, MD5S10);
438     MD5_STEP0(MD5_Go, d, a, b, c,     G_w2c1d, MD5S11);
439     MD5_STEP0(MD5_Go, c, d, a, b,     G_w7c1e, MD5S12);
440     MD5_STEP0(MD5_Go, b, c, d, a,     G_wcc1f, MD5S13);
441
442     MD5_STEP0(MD5_H , a, b, c, d,     H_w5c20, MD5S20);
443     MD5_STEP0(MD5_H , d, a, b, c,     H_w8c21, MD5S21);
444     MD5_STEP0(MD5_H , c, d, a, b,     H_wbc22, MD5S22);
445     MD5_STEP0(MD5_H , b, c, d, a,     H_wec23, MD5S23);
446     MD5_STEP0(MD5_H , a, b, c, d,     H_w1c24, MD5S20);
447     MD5_STEP0(MD5_H , d, a, b, c,     H_w4c25, MD5S21);
448     MD5_STEP0(MD5_H , c, d, a, b,     H_w7c26, MD5S22);
449     MD5_STEP0(MD5_H , b, c, d, a,     H_wac27, MD5S23);
450     MD5_STEP0(MD5_H , a, b, c, d,     H_wdc28, MD5S20);
451     MD5_STEP (MD5_H , d, a, b, c, w0, H_w0c29, MD5S21);
452     MD5_STEP0(MD5_H , c, d, a, b,     H_w3c2a, MD5S22);
453     MD5_STEP0(MD5_H , b, c, d, a,     H_w6c2b, MD5S23);
454     MD5_STEP0(MD5_H , a, b, c, d,     H_w9c2c, MD5S20);
455     MD5_STEP0(MD5_H , d, a, b, c,     H_wcc2d, MD5S21);
456     MD5_STEP0(MD5_H , c, d, a, b,     H_wfc2e, MD5S22);
457     MD5_STEP0(MD5_H , b, c, d, a,     H_w2c2f, MD5S23);
458
459     MD5_STEP (MD5_I , a, b, c, d, w0, I_w0c30, MD5S30);
460     MD5_STEP0(MD5_I , d, a, b, c,     I_w7c31, MD5S31);
461     MD5_STEP0(MD5_I , c, d, a, b,     I_wec32, MD5S32);
462     MD5_STEP0(MD5_I , b, c, d, a,     I_w5c33, MD5S33);
463     MD5_STEP0(MD5_I , a, b, c, d,     I_wcc34, MD5S30);
464     MD5_STEP0(MD5_I , d, a, b, c,     I_w3c35, MD5S31);
465     MD5_STEP0(MD5_I , c, d, a, b,     I_wac36, MD5S32);
466     MD5_STEP0(MD5_I , b, c, d, a,     I_w1c37, MD5S33);
467     MD5_STEP0(MD5_I , a, b, c, d,     I_w8c38, MD5S30);
468     MD5_STEP0(MD5_I , d, a, b, c,     I_wfc39, MD5S31);
469     MD5_STEP0(MD5_I , c, d, a, b,     I_w6c3a, MD5S32);
470     MD5_STEP0(MD5_I , b, c, d, a,     I_wdc3b, MD5S33);
471     MD5_STEP0(MD5_I , a, b, c, d,     I_w4c3c, MD5S30);
472     MD5_STEP0(MD5_I , d, a, b, c,     I_wbc3d, MD5S31);
473     MD5_STEP0(MD5_I , c, d, a, b,     I_w2c3e, MD5S32);
474     MD5_STEP0(MD5_I , b, c, d, a,     I_w9c3f, MD5S33);
475
476     a += MD5M_A;
477     b += MD5M_B;
478     c += MD5M_C;
479     d += MD5M_D;
480
481     u32x r_a = a;
482     u32x r_b = b;
483     u32x r_c = c;
484     u32x r_d = d;
485
486     u32x t0[4];
487     u32x t1[4];
488     u32x t2[4];
489     u32x t3[4];
490
491     t0[0] = 0;
492     t0[1] = 0;
493     t0[2] = 0;
494     t0[3] = 0;
495     t1[0] = 0;
496     t1[1] = 0;
497     t1[2] = 0;
498     t1[3] = 0;
499     t2[0] = 0;
500     t2[1] = 0x80;
501     t2[2] = 0;
502     t2[3] = 0;
503     t3[0] = 0;
504     t3[1] = 0;
505     t3[2] = 100 * 8;
506     t3[3] = 0;
507
508     MD5_STEP (MD5_Fo, a, b, c, d, t0[0], MD5C00, MD5S00);
509     MD5_STEP (MD5_Fo, d, a, b, c, t0[1], MD5C01, MD5S01);
510     MD5_STEP (MD5_Fo, c, d, a, b, t0[2], MD5C02, MD5S02);
511     MD5_STEP (MD5_Fo, b, c, d, a, t0[3], MD5C03, MD5S03);
512     MD5_STEP (MD5_Fo, a, b, c, d, t1[0], MD5C04, MD5S00);
513     MD5_STEP (MD5_Fo, d, a, b, c, t1[1], MD5C05, MD5S01);
514     MD5_STEP (MD5_Fo, c, d, a, b, t1[2], MD5C06, MD5S02);
515     MD5_STEP (MD5_Fo, b, c, d, a, t1[3], MD5C07, MD5S03);
516     MD5_STEP (MD5_Fo, a, b, c, d, t2[0], MD5C08, MD5S00);
517     MD5_STEP (MD5_Fo, d, a, b, c, t2[1], MD5C09, MD5S01);
518     MD5_STEP (MD5_Fo, c, d, a, b, t2[2], MD5C0a, MD5S02);
519     MD5_STEP (MD5_Fo, b, c, d, a, t2[3], MD5C0b, MD5S03);
520     MD5_STEP (MD5_Fo, a, b, c, d, t3[0], MD5C0c, MD5S00);
521     MD5_STEP (MD5_Fo, d, a, b, c, t3[1], MD5C0d, MD5S01);
522     MD5_STEP (MD5_Fo, c, d, a, b, t3[2], MD5C0e, MD5S02);
523     MD5_STEP (MD5_Fo, b, c, d, a, t3[3], MD5C0f, MD5S03);
524
525     MD5_STEP (MD5_Go, a, b, c, d, t0[1], MD5C10, MD5S10);
526     MD5_STEP (MD5_Go, d, a, b, c, t1[2], MD5C11, MD5S11);
527     MD5_STEP (MD5_Go, c, d, a, b, t2[3], MD5C12, MD5S12);
528     MD5_STEP (MD5_Go, b, c, d, a, t0[0], MD5C13, MD5S13);
529     MD5_STEP (MD5_Go, a, b, c, d, t1[1], MD5C14, MD5S10);
530     MD5_STEP (MD5_Go, d, a, b, c, t2[2], MD5C15, MD5S11);
531     MD5_STEP (MD5_Go, c, d, a, b, t3[3], MD5C16, MD5S12);
532     MD5_STEP (MD5_Go, b, c, d, a, t1[0], MD5C17, MD5S13);
533     MD5_STEP (MD5_Go, a, b, c, d, t2[1], MD5C18, MD5S10);
534     MD5_STEP (MD5_Go, d, a, b, c, t3[2], MD5C19, MD5S11);
535     MD5_STEP (MD5_Go, c, d, a, b, t0[3], MD5C1a, MD5S12);
536     MD5_STEP (MD5_Go, b, c, d, a, t2[0], MD5C1b, MD5S13);
537     MD5_STEP (MD5_Go, a, b, c, d, t3[1], MD5C1c, MD5S10);
538     MD5_STEP (MD5_Go, d, a, b, c, t0[2], MD5C1d, MD5S11);
539     MD5_STEP (MD5_Go, c, d, a, b, t1[3], MD5C1e, MD5S12);
540     MD5_STEP (MD5_Go, b, c, d, a, t3[0], MD5C1f, MD5S13);
541
542     MD5_STEP (MD5_H , a, b, c, d, t1[1], MD5C20, MD5S20);
543     MD5_STEP (MD5_H , d, a, b, c, t2[0], MD5C21, MD5S21);
544     MD5_STEP (MD5_H , c, d, a, b, t2[3], MD5C22, MD5S22);
545     MD5_STEP (MD5_H , b, c, d, a, t3[2], MD5C23, MD5S23);
546     MD5_STEP (MD5_H , a, b, c, d, t0[1], MD5C24, MD5S20);
547     MD5_STEP (MD5_H , d, a, b, c, t1[0], MD5C25, MD5S21);
548     MD5_STEP (MD5_H , c, d, a, b, t1[3], MD5C26, MD5S22);
549     MD5_STEP (MD5_H , b, c, d, a, t2[2], MD5C27, MD5S23);
550     MD5_STEP (MD5_H , a, b, c, d, t3[1], MD5C28, MD5S20);
551     MD5_STEP (MD5_H , d, a, b, c, t0[0], MD5C29, MD5S21);
552     MD5_STEP (MD5_H , c, d, a, b, t0[3], MD5C2a, MD5S22);
553     MD5_STEP (MD5_H , b, c, d, a, t1[2], MD5C2b, MD5S23);
554     MD5_STEP (MD5_H , a, b, c, d, t2[1], MD5C2c, MD5S20);
555     MD5_STEP (MD5_H , d, a, b, c, t3[0], MD5C2d, MD5S21);
556     MD5_STEP (MD5_H , c, d, a, b, t3[3], MD5C2e, MD5S22);
557     MD5_STEP (MD5_H , b, c, d, a, t0[2], MD5C2f, MD5S23);
558
559     MD5_STEP (MD5_I , a, b, c, d, t0[0], MD5C30, MD5S30);
560     MD5_STEP (MD5_I , d, a, b, c, t1[3], MD5C31, MD5S31);
561     MD5_STEP (MD5_I , c, d, a, b, t3[2], MD5C32, MD5S32);
562     MD5_STEP (MD5_I , b, c, d, a, t1[1], MD5C33, MD5S33);
563     MD5_STEP (MD5_I , a, b, c, d, t3[0], MD5C34, MD5S30);
564     MD5_STEP (MD5_I , d, a, b, c, t0[3], MD5C35, MD5S31);
565     MD5_STEP (MD5_I , c, d, a, b, t2[2], MD5C36, MD5S32);
566     MD5_STEP (MD5_I , b, c, d, a, t0[1], MD5C37, MD5S33);
567     MD5_STEP (MD5_I , a, b, c, d, t2[0], MD5C38, MD5S30);
568     MD5_STEP (MD5_I , d, a, b, c, t3[3], MD5C39, MD5S31);
569     MD5_STEP (MD5_I , c, d, a, b, t1[2], MD5C3a, MD5S32);
570     MD5_STEP (MD5_I , b, c, d, a, t3[1], MD5C3b, MD5S33);
571     MD5_STEP (MD5_I , a, b, c, d, t1[0], MD5C3c, MD5S30);
572
573     if (MATCHES_NONE_VS ((a + r_a), search[0])) continue;
574
575     MD5_STEP (MD5_I , d, a, b, c, t2[3], MD5C3d, MD5S31);
576     MD5_STEP (MD5_I , c, d, a, b, t0[2], MD5C3e, MD5S32);
577     MD5_STEP (MD5_I , b, c, d, a, t2[1], MD5C3f, MD5S33);
578
579     a += r_a;
580     b += r_b;
581     c += r_c;
582     d += r_d;
583
584     COMPARE_S_SIMD (a, d, c, b);
585   }
586 }
587
588 __kernel void m09900_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
589 {
590   /**
591    * base
592    */
593
594   const u32 gid = get_global_id (0);
595
596   if (gid >= gid_max) return;
597
598   u32 w[16];
599
600   w[ 0] = pws[gid].i[ 0];
601   w[ 1] = pws[gid].i[ 1];
602   w[ 2] = pws[gid].i[ 2];
603   w[ 3] = pws[gid].i[ 3];
604   w[ 4] = 0;
605   w[ 5] = 0;
606   w[ 6] = 0;
607   w[ 7] = 0;
608   w[ 8] = 0;
609   w[ 9] = 0;
610   w[10] = 0;
611   w[11] = 0;
612   w[12] = 0;
613   w[13] = 0;
614   w[14] = 0;
615   w[15] = 0;
616
617   const u32 pw_len = pws[gid].pw_len;
618
619   /**
620    * main
621    */
622
623   m09900m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
624 }
625
626 __kernel void m09900_m08 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
627 {
628   /**
629    * base
630    */
631
632   const u32 gid = get_global_id (0);
633
634   if (gid >= gid_max) return;
635
636   u32 w[16];
637
638   w[ 0] = pws[gid].i[ 0];
639   w[ 1] = pws[gid].i[ 1];
640   w[ 2] = pws[gid].i[ 2];
641   w[ 3] = pws[gid].i[ 3];
642   w[ 4] = pws[gid].i[ 4];
643   w[ 5] = pws[gid].i[ 5];
644   w[ 6] = pws[gid].i[ 6];
645   w[ 7] = pws[gid].i[ 7];
646   w[ 8] = 0;
647   w[ 9] = 0;
648   w[10] = 0;
649   w[11] = 0;
650   w[12] = 0;
651   w[13] = 0;
652   w[14] = 0;
653   w[15] = 0;
654
655   const u32 pw_len = pws[gid].pw_len;
656
657   /**
658    * main
659    */
660
661   m09900m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
662 }
663
664 __kernel void m09900_m16 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
665 {
666   /**
667    * base
668    */
669
670   const u32 gid = get_global_id (0);
671
672   if (gid >= gid_max) return;
673
674   u32 w[16];
675
676   w[ 0] = pws[gid].i[ 0];
677   w[ 1] = pws[gid].i[ 1];
678   w[ 2] = pws[gid].i[ 2];
679   w[ 3] = pws[gid].i[ 3];
680   w[ 4] = pws[gid].i[ 4];
681   w[ 5] = pws[gid].i[ 5];
682   w[ 6] = pws[gid].i[ 6];
683   w[ 7] = pws[gid].i[ 7];
684   w[ 8] = pws[gid].i[ 8];
685   w[ 9] = pws[gid].i[ 9];
686   w[10] = pws[gid].i[10];
687   w[11] = pws[gid].i[11];
688   w[12] = pws[gid].i[12];
689   w[13] = pws[gid].i[13];
690   w[14] = pws[gid].i[14];
691   w[15] = pws[gid].i[15];
692
693   const u32 pw_len = pws[gid].pw_len;
694
695   /**
696    * main
697    */
698
699   m09900m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
700 }
701
702 __kernel void m09900_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
703 {
704   /**
705    * base
706    */
707
708   const u32 gid = get_global_id (0);
709
710   if (gid >= gid_max) return;
711
712   u32 w[16];
713
714   w[ 0] = pws[gid].i[ 0];
715   w[ 1] = pws[gid].i[ 1];
716   w[ 2] = pws[gid].i[ 2];
717   w[ 3] = pws[gid].i[ 3];
718   w[ 4] = 0;
719   w[ 5] = 0;
720   w[ 6] = 0;
721   w[ 7] = 0;
722   w[ 8] = 0;
723   w[ 9] = 0;
724   w[10] = 0;
725   w[11] = 0;
726   w[12] = 0;
727   w[13] = 0;
728   w[14] = 0;
729   w[15] = 0;
730
731   const u32 pw_len = pws[gid].pw_len;
732
733   /**
734    * main
735    */
736
737   m09900s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
738 }
739
740 __kernel void m09900_s08 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
741 {
742   /**
743    * base
744    */
745
746   const u32 gid = get_global_id (0);
747
748   if (gid >= gid_max) return;
749
750   u32 w[16];
751
752   w[ 0] = pws[gid].i[ 0];
753   w[ 1] = pws[gid].i[ 1];
754   w[ 2] = pws[gid].i[ 2];
755   w[ 3] = pws[gid].i[ 3];
756   w[ 4] = pws[gid].i[ 4];
757   w[ 5] = pws[gid].i[ 5];
758   w[ 6] = pws[gid].i[ 6];
759   w[ 7] = pws[gid].i[ 7];
760   w[ 8] = 0;
761   w[ 9] = 0;
762   w[10] = 0;
763   w[11] = 0;
764   w[12] = 0;
765   w[13] = 0;
766   w[14] = 0;
767   w[15] = 0;
768
769   const u32 pw_len = pws[gid].pw_len;
770
771   /**
772    * main
773    */
774
775   m09900s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
776 }
777
778 __kernel void m09900_s16 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
779 {
780   /**
781    * base
782    */
783
784   const u32 gid = get_global_id (0);
785
786   if (gid >= gid_max) return;
787
788   u32 w[16];
789
790   w[ 0] = pws[gid].i[ 0];
791   w[ 1] = pws[gid].i[ 1];
792   w[ 2] = pws[gid].i[ 2];
793   w[ 3] = pws[gid].i[ 3];
794   w[ 4] = pws[gid].i[ 4];
795   w[ 5] = pws[gid].i[ 5];
796   w[ 6] = pws[gid].i[ 6];
797   w[ 7] = pws[gid].i[ 7];
798   w[ 8] = pws[gid].i[ 8];
799   w[ 9] = pws[gid].i[ 9];
800   w[10] = pws[gid].i[10];
801   w[11] = pws[gid].i[11];
802   w[12] = pws[gid].i[12];
803   w[13] = pws[gid].i[13];
804   w[14] = pws[gid].i[14];
805   w[15] = pws[gid].i[15];
806
807   const u32 pw_len = pws[gid].pw_len;
808
809   /**
810    * main
811    */
812
813   m09900s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
814 }