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