Initial commit
[hashcat.git] / amd / m00060_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))) m00060_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   /**
280    * pads
281    */
282
283   u32x w0_t[4];
284
285   w0_t[0] = salt_buf0[0];
286   w0_t[1] = salt_buf0[1];
287   w0_t[2] = salt_buf0[2];
288   w0_t[3] = salt_buf0[3];
289
290   u32x w1_t[4];
291
292   w1_t[0] = salt_buf1[0];
293   w1_t[1] = salt_buf1[1];
294   w1_t[2] = salt_buf1[2];
295   w1_t[3] = salt_buf1[3];
296
297   u32x w2_t[4];
298
299   w2_t[0] = 0;
300   w2_t[1] = 0;
301   w2_t[2] = 0;
302   w2_t[3] = 0;
303
304   u32x w3_t[4];
305
306   w3_t[0] = 0;
307   w3_t[1] = 0;
308   w3_t[2] = 0;
309   w3_t[3] = 0;
310
311   u32x ipad[4];
312   u32x opad[4];
313
314   hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
315
316   /**
317    * loop
318    */
319
320   for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
321   {
322     u32x w0[4];
323
324     w0[0] = pw_buf0[0];
325     w0[1] = pw_buf0[1];
326     w0[2] = pw_buf0[2];
327     w0[3] = pw_buf0[3];
328
329     u32x w1[4];
330
331     w1[0] = pw_buf1[0];
332     w1[1] = pw_buf1[1];
333     w1[2] = pw_buf1[2];
334     w1[3] = pw_buf1[3];
335
336     u32x w2[4];
337
338     w2[0] = 0;
339     w2[1] = 0;
340     w2[2] = 0;
341     w2[3] = 0;
342
343     u32x w3[4];
344
345     w3[0] = 0;
346     w3[1] = 0;
347     w3[2] = 0;
348     w3[3] = 0;
349
350     const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
351
352     append_0x80_2 (w0, w1, out_len);
353
354     w0_t[0] = w0[0];
355     w0_t[1] = w0[1];
356     w0_t[2] = w0[2];
357     w0_t[3] = w0[3];
358     w1_t[0] = w1[0];
359     w1_t[1] = w1[1];
360     w1_t[2] = w1[2];
361     w1_t[3] = w1[3];
362     w2_t[0] = 0;
363     w2_t[1] = 0;
364     w2_t[2] = 0;
365     w2_t[3] = 0;
366     w3_t[0] = 0;
367     w3_t[1] = 0;
368     w3_t[2] = (64 + out_len) * 8;
369     w3_t[3] = 0;
370
371     u32x digest[4];
372
373     hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
374
375     const u32x r0 = digest[0];
376     const u32x r1 = digest[3];
377     const u32x r2 = digest[2];
378     const u32x r3 = digest[1];
379
380     #include VECT_COMPARE_M
381   }
382 }
383
384 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00060_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)
385 {
386 }
387
388 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00060_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)
389 {
390 }
391
392 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00060_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)
393 {
394   /**
395    * modifier
396    */
397
398   const u32 lid = get_local_id (0);
399
400   /**
401    * base
402    */
403
404   const u32 gid = get_global_id (0);
405
406   if (gid >= gid_max) return;
407
408   u32x pw_buf0[4];
409
410   pw_buf0[0] = pws[gid].i[ 0];
411   pw_buf0[1] = pws[gid].i[ 1];
412   pw_buf0[2] = pws[gid].i[ 2];
413   pw_buf0[3] = pws[gid].i[ 3];
414
415   u32x pw_buf1[4];
416
417   pw_buf1[0] = pws[gid].i[ 4];
418   pw_buf1[1] = pws[gid].i[ 5];
419   pw_buf1[2] = pws[gid].i[ 6];
420   pw_buf1[3] = pws[gid].i[ 7];
421
422   const u32 pw_len = pws[gid].pw_len;
423
424   /**
425    * salt
426    */
427
428   u32 salt_buf0[4];
429
430   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
431   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
432   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
433   salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
434
435   u32 salt_buf1[4];
436
437   salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
438   salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
439   salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
440   salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
441
442   /**
443    * pads
444    */
445
446   u32x w0_t[4];
447
448   w0_t[0] = salt_buf0[0];
449   w0_t[1] = salt_buf0[1];
450   w0_t[2] = salt_buf0[2];
451   w0_t[3] = salt_buf0[3];
452
453   u32x w1_t[4];
454
455   w1_t[0] = salt_buf1[0];
456   w1_t[1] = salt_buf1[1];
457   w1_t[2] = salt_buf1[2];
458   w1_t[3] = salt_buf1[3];
459
460   u32x w2_t[4];
461
462   w2_t[0] = 0;
463   w2_t[1] = 0;
464   w2_t[2] = 0;
465   w2_t[3] = 0;
466
467   u32x w3_t[4];
468
469   w3_t[0] = 0;
470   w3_t[1] = 0;
471   w3_t[2] = 0;
472   w3_t[3] = 0;
473
474   u32x ipad[4];
475   u32x opad[4];
476
477   hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
478
479   /**
480    * digest
481    */
482
483   const u32 search[4] =
484   {
485     digests_buf[digests_offset].digest_buf[DGST_R0],
486     digests_buf[digests_offset].digest_buf[DGST_R1],
487     digests_buf[digests_offset].digest_buf[DGST_R2],
488     digests_buf[digests_offset].digest_buf[DGST_R3]
489   };
490
491   /**
492    * loop
493    */
494
495   for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
496   {
497     u32x w0[4];
498
499     w0[0] = pw_buf0[0];
500     w0[1] = pw_buf0[1];
501     w0[2] = pw_buf0[2];
502     w0[3] = pw_buf0[3];
503
504     u32x w1[4];
505
506     w1[0] = pw_buf1[0];
507     w1[1] = pw_buf1[1];
508     w1[2] = pw_buf1[2];
509     w1[3] = pw_buf1[3];
510
511     u32x w2[4];
512
513     w2[0] = 0;
514     w2[1] = 0;
515     w2[2] = 0;
516     w2[3] = 0;
517
518     u32x w3[4];
519
520     w3[0] = 0;
521     w3[1] = 0;
522     w3[2] = 0;
523     w3[3] = 0;
524
525     const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
526
527     append_0x80_2 (w0, w1, out_len);
528
529     w0_t[0] = w0[0];
530     w0_t[1] = w0[1];
531     w0_t[2] = w0[2];
532     w0_t[3] = w0[3];
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     w2_t[0] = 0;
538     w2_t[1] = 0;
539     w2_t[2] = 0;
540     w2_t[3] = 0;
541     w3_t[0] = 0;
542     w3_t[1] = 0;
543     w3_t[2] = (64 + out_len) * 8;
544     w3_t[3] = 0;
545
546     u32x digest[4];
547
548     hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
549
550     const u32x r0 = digest[0];
551     const u32x r1 = digest[3];
552     const u32x r2 = digest[2];
553     const u32x r3 = digest[1];
554
555     #include VECT_COMPARE_S
556   }
557 }
558
559 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00060_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)
560 {
561 }
562
563 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00060_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)
564 {
565 }