Initial commit
[hashcat.git] / nv / m01450_a0.cu
1 /**
2  * Author......: Jens Steube <jens.steube@gmail.com>
3  * License.....: MIT
4  */
5
6 #define _SHA256_
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  VLIW2
16 #define VECT_SIZE1
17 #endif
18
19 #define DGST_R0 3
20 #define DGST_R1 7
21 #define DGST_R2 2
22 #define DGST_R3 6
23
24 #include "include/kernel_functions.c"
25 #include "types_nv.c"
26 #include "common_nv.c"
27 #include "include/rp_gpu.h"
28 #include "rp_nv.c"
29
30 #ifdef  VECT_SIZE1
31 #define VECT_COMPARE_S "check_single_vect1_comp4.c"
32 #define VECT_COMPARE_M "check_multi_vect1_comp4.c"
33 #endif
34
35 #ifdef  VECT_SIZE2
36 #define VECT_COMPARE_S "check_single_vect2_comp4.c"
37 #define VECT_COMPARE_M "check_multi_vect2_comp4.c"
38 #endif
39
40 #ifdef  VECT_SIZE4
41 #define VECT_COMPARE_S "check_single_vect4_comp4.c"
42 #define VECT_COMPARE_M "check_multi_vect4_comp4.c"
43 #endif
44
45 __device__ __constant__ u32 k_sha256[64] =
46 {
47   SHA256C00, SHA256C01, SHA256C02, SHA256C03,
48   SHA256C04, SHA256C05, SHA256C06, SHA256C07,
49   SHA256C08, SHA256C09, SHA256C0a, SHA256C0b,
50   SHA256C0c, SHA256C0d, SHA256C0e, SHA256C0f,
51   SHA256C10, SHA256C11, SHA256C12, SHA256C13,
52   SHA256C14, SHA256C15, SHA256C16, SHA256C17,
53   SHA256C18, SHA256C19, SHA256C1a, SHA256C1b,
54   SHA256C1c, SHA256C1d, SHA256C1e, SHA256C1f,
55   SHA256C20, SHA256C21, SHA256C22, SHA256C23,
56   SHA256C24, SHA256C25, SHA256C26, SHA256C27,
57   SHA256C28, SHA256C29, SHA256C2a, SHA256C2b,
58   SHA256C2c, SHA256C2d, SHA256C2e, SHA256C2f,
59   SHA256C30, SHA256C31, SHA256C32, SHA256C33,
60   SHA256C34, SHA256C35, SHA256C36, SHA256C37,
61   SHA256C38, SHA256C39, SHA256C3a, SHA256C3b,
62   SHA256C3c, SHA256C3d, SHA256C3e, SHA256C3f,
63 };
64
65 __device__ __constant__ gpu_rule_t c_rules[1024];
66
67 __device__ static void sha256_transform (const u32x w0[4], const u32x w1[4], const u32x w2[4], const u32x w3[4], u32x digest[8])
68 {
69   u32x a = digest[0];
70   u32x b = digest[1];
71   u32x c = digest[2];
72   u32x d = digest[3];
73   u32x e = digest[4];
74   u32x f = digest[5];
75   u32x g = digest[6];
76   u32x h = digest[7];
77
78   u32x w0_t = w0[0];
79   u32x w1_t = w0[1];
80   u32x w2_t = w0[2];
81   u32x w3_t = w0[3];
82   u32x w4_t = w1[0];
83   u32x w5_t = w1[1];
84   u32x w6_t = w1[2];
85   u32x w7_t = w1[3];
86   u32x w8_t = w2[0];
87   u32x w9_t = w2[1];
88   u32x wa_t = w2[2];
89   u32x wb_t = w2[3];
90   u32x wc_t = w3[0];
91   u32x wd_t = w3[1];
92   u32x we_t = w3[2];
93   u32x wf_t = w3[3];
94
95   #define ROUND_EXPAND()                            \
96   {                                                 \
97     w0_t = SHA256_EXPAND (we_t, w9_t, w1_t, w0_t);  \
98     w1_t = SHA256_EXPAND (wf_t, wa_t, w2_t, w1_t);  \
99     w2_t = SHA256_EXPAND (w0_t, wb_t, w3_t, w2_t);  \
100     w3_t = SHA256_EXPAND (w1_t, wc_t, w4_t, w3_t);  \
101     w4_t = SHA256_EXPAND (w2_t, wd_t, w5_t, w4_t);  \
102     w5_t = SHA256_EXPAND (w3_t, we_t, w6_t, w5_t);  \
103     w6_t = SHA256_EXPAND (w4_t, wf_t, w7_t, w6_t);  \
104     w7_t = SHA256_EXPAND (w5_t, w0_t, w8_t, w7_t);  \
105     w8_t = SHA256_EXPAND (w6_t, w1_t, w9_t, w8_t);  \
106     w9_t = SHA256_EXPAND (w7_t, w2_t, wa_t, w9_t);  \
107     wa_t = SHA256_EXPAND (w8_t, w3_t, wb_t, wa_t);  \
108     wb_t = SHA256_EXPAND (w9_t, w4_t, wc_t, wb_t);  \
109     wc_t = SHA256_EXPAND (wa_t, w5_t, wd_t, wc_t);  \
110     wd_t = SHA256_EXPAND (wb_t, w6_t, we_t, wd_t);  \
111     we_t = SHA256_EXPAND (wc_t, w7_t, wf_t, we_t);  \
112     wf_t = SHA256_EXPAND (wd_t, w8_t, w0_t, wf_t);  \
113   }
114
115   #define ROUND_STEP(i)                                                                   \
116   {                                                                                       \
117     SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w0_t, k_sha256[i +  0]); \
118     SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w1_t, k_sha256[i +  1]); \
119     SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, w2_t, k_sha256[i +  2]); \
120     SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, w3_t, k_sha256[i +  3]); \
121     SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, w4_t, k_sha256[i +  4]); \
122     SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, w5_t, k_sha256[i +  5]); \
123     SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, w6_t, k_sha256[i +  6]); \
124     SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, w7_t, k_sha256[i +  7]); \
125     SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w8_t, k_sha256[i +  8]); \
126     SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w9_t, k_sha256[i +  9]); \
127     SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, wa_t, k_sha256[i + 10]); \
128     SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, wb_t, k_sha256[i + 11]); \
129     SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, wc_t, k_sha256[i + 12]); \
130     SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, wd_t, k_sha256[i + 13]); \
131     SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, we_t, k_sha256[i + 14]); \
132     SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, wf_t, k_sha256[i + 15]); \
133   }
134
135   ROUND_STEP (0);
136
137   for (int i = 16; i < 64; i += 16)
138   {
139     ROUND_EXPAND (); ROUND_STEP (i);
140   }
141
142   digest[0] += a;
143   digest[1] += b;
144   digest[2] += c;
145   digest[3] += d;
146   digest[4] += e;
147   digest[5] += f;
148   digest[6] += g;
149   digest[7] += h;
150 }
151
152 __device__ static void hmac_sha256_pad (u32x w0[4], u32x w1[4], u32x w2[4], u32x w3[4], u32x ipad[8], u32x opad[8])
153 {
154   w0[0] = w0[0] ^ 0x36363636;
155   w0[1] = w0[1] ^ 0x36363636;
156   w0[2] = w0[2] ^ 0x36363636;
157   w0[3] = w0[3] ^ 0x36363636;
158   w1[0] = w1[0] ^ 0x36363636;
159   w1[1] = w1[1] ^ 0x36363636;
160   w1[2] = w1[2] ^ 0x36363636;
161   w1[3] = w1[3] ^ 0x36363636;
162   w2[0] = w2[0] ^ 0x36363636;
163   w2[1] = w2[1] ^ 0x36363636;
164   w2[2] = w2[2] ^ 0x36363636;
165   w2[3] = w2[3] ^ 0x36363636;
166   w3[0] = w3[0] ^ 0x36363636;
167   w3[1] = w3[1] ^ 0x36363636;
168   w3[2] = w3[2] ^ 0x36363636;
169   w3[3] = w3[3] ^ 0x36363636;
170
171   ipad[0] = SHA256M_A;
172   ipad[1] = SHA256M_B;
173   ipad[2] = SHA256M_C;
174   ipad[3] = SHA256M_D;
175   ipad[4] = SHA256M_E;
176   ipad[5] = SHA256M_F;
177   ipad[6] = SHA256M_G;
178   ipad[7] = SHA256M_H;
179
180   sha256_transform (w0, w1, w2, w3, ipad);
181
182   w0[0] = w0[0] ^ 0x6a6a6a6a;
183   w0[1] = w0[1] ^ 0x6a6a6a6a;
184   w0[2] = w0[2] ^ 0x6a6a6a6a;
185   w0[3] = w0[3] ^ 0x6a6a6a6a;
186   w1[0] = w1[0] ^ 0x6a6a6a6a;
187   w1[1] = w1[1] ^ 0x6a6a6a6a;
188   w1[2] = w1[2] ^ 0x6a6a6a6a;
189   w1[3] = w1[3] ^ 0x6a6a6a6a;
190   w2[0] = w2[0] ^ 0x6a6a6a6a;
191   w2[1] = w2[1] ^ 0x6a6a6a6a;
192   w2[2] = w2[2] ^ 0x6a6a6a6a;
193   w2[3] = w2[3] ^ 0x6a6a6a6a;
194   w3[0] = w3[0] ^ 0x6a6a6a6a;
195   w3[1] = w3[1] ^ 0x6a6a6a6a;
196   w3[2] = w3[2] ^ 0x6a6a6a6a;
197   w3[3] = w3[3] ^ 0x6a6a6a6a;
198
199   opad[0] = SHA256M_A;
200   opad[1] = SHA256M_B;
201   opad[2] = SHA256M_C;
202   opad[3] = SHA256M_D;
203   opad[4] = SHA256M_E;
204   opad[5] = SHA256M_F;
205   opad[6] = SHA256M_G;
206   opad[7] = SHA256M_H;
207
208   sha256_transform (w0, w1, w2, w3, opad);
209 }
210
211 __device__ static void hmac_sha256_run (u32x w0[4], u32x w1[4], u32x w2[4], u32x w3[4], u32x ipad[8], u32x opad[8], u32x digest[8])
212 {
213   digest[0] = ipad[0];
214   digest[1] = ipad[1];
215   digest[2] = ipad[2];
216   digest[3] = ipad[3];
217   digest[4] = ipad[4];
218   digest[5] = ipad[5];
219   digest[6] = ipad[6];
220   digest[7] = ipad[7];
221
222   sha256_transform (w0, w1, w2, w3, digest);
223
224   w0[0] = digest[0];
225   w0[1] = digest[1];
226   w0[2] = digest[2];
227   w0[3] = digest[3];
228   w1[0] = digest[4];
229   w1[1] = digest[5];
230   w1[2] = digest[6];
231   w1[3] = digest[7];
232   w2[0] = 0x80000000;
233   w2[1] = 0;
234   w2[2] = 0;
235   w2[3] = 0;
236   w3[0] = 0;
237   w3[1] = 0;
238   w3[2] = 0;
239   w3[3] = (64 + 32) * 8;
240
241   digest[0] = opad[0];
242   digest[1] = opad[1];
243   digest[2] = opad[2];
244   digest[3] = opad[3];
245   digest[4] = opad[4];
246   digest[5] = opad[5];
247   digest[6] = opad[6];
248   digest[7] = opad[7];
249
250   sha256_transform (w0, w1, w2, w3, digest);
251 }
252
253 extern "C" __global__ void __launch_bounds__ (256, 1) m01450_m04 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, 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)
254 {
255   /**
256    * modifier
257    */
258
259   const u32 lid = threadIdx.x;
260
261   /**
262    * base
263    */
264
265   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
266
267   if (gid >= gid_max) return;
268
269   u32x pw_buf0[4];
270
271   pw_buf0[0] = pws[gid].i[ 0];
272   pw_buf0[1] = pws[gid].i[ 1];
273   pw_buf0[2] = pws[gid].i[ 2];
274   pw_buf0[3] = pws[gid].i[ 3];
275
276   u32x pw_buf1[4];
277
278   pw_buf1[0] = pws[gid].i[ 4];
279   pw_buf1[1] = pws[gid].i[ 5];
280   pw_buf1[2] = pws[gid].i[ 6];
281   pw_buf1[3] = pws[gid].i[ 7];
282
283   const u32 pw_len = pws[gid].pw_len;
284
285   /**
286    * salt
287    */
288
289   u32 salt_buf0[4];
290
291   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
292   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
293   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
294   salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
295
296   u32 salt_buf1[4];
297
298   salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
299   salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
300   salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
301   salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
302
303   const u32 salt_len = salt_bufs[salt_pos].salt_len;
304
305   /**
306    * loop
307    */
308
309   for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
310   {
311     u32x w0[4];
312
313     w0[0] = pw_buf0[0];
314     w0[1] = pw_buf0[1];
315     w0[2] = pw_buf0[2];
316     w0[3] = pw_buf0[3];
317
318     u32x w1[4];
319
320     w1[0] = pw_buf1[0];
321     w1[1] = pw_buf1[1];
322     w1[2] = pw_buf1[2];
323     w1[3] = pw_buf1[3];
324
325     u32x w2[4];
326
327     w2[0] = 0;
328     w2[1] = 0;
329     w2[2] = 0;
330     w2[3] = 0;
331
332     u32x w3[4];
333
334     w3[0] = 0;
335     w3[1] = 0;
336     w3[2] = 0;
337     w3[3] = 0;
338
339     const u32 out_len = apply_rules (c_rules[il_pos].cmds, w0, w1, pw_len);
340
341     /**
342      * pads
343      */
344
345     u32x w0_t[4];
346
347     w0_t[0] = swap_workaround (w0[0]);
348     w0_t[1] = swap_workaround (w0[1]);
349     w0_t[2] = swap_workaround (w0[2]);
350     w0_t[3] = swap_workaround (w0[3]);
351
352     u32x w1_t[4];
353
354     w1_t[0] = swap_workaround (w1[0]);
355     w1_t[1] = swap_workaround (w1[1]);
356     w1_t[2] = swap_workaround (w1[2]);
357     w1_t[3] = swap_workaround (w1[3]);
358
359     u32x w2_t[4];
360
361     w2_t[0] = 0;
362     w2_t[1] = 0;
363     w2_t[2] = 0;
364     w2_t[3] = 0;
365
366     u32x w3_t[4];
367
368     w3_t[0] = 0;
369     w3_t[1] = 0;
370     w3_t[2] = 0;
371     w3_t[3] = 0;
372
373     u32x ipad[8];
374     u32x opad[8];
375
376     hmac_sha256_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
377
378     w0_t[0] = swap_workaround (salt_buf0[0]);
379     w0_t[1] = swap_workaround (salt_buf0[1]);
380     w0_t[2] = swap_workaround (salt_buf0[2]);
381     w0_t[3] = swap_workaround (salt_buf0[3]);
382     w1_t[0] = swap_workaround (salt_buf1[0]);
383     w1_t[1] = swap_workaround (salt_buf1[1]);
384     w1_t[2] = swap_workaround (salt_buf1[2]);
385     w1_t[3] = swap_workaround (salt_buf1[3]);
386     w2_t[0] = 0;
387     w2_t[1] = 0;
388     w2_t[2] = 0;
389     w2_t[3] = 0;
390     w3_t[0] = 0;
391     w3_t[1] = 0;
392     w3_t[2] = 0;
393     w3_t[3] = (64 + salt_len) * 8;
394
395     u32x digest[8];
396
397     hmac_sha256_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
398
399     const u32x r0 = digest[3];
400     const u32x r1 = digest[7];
401     const u32x r2 = digest[2];
402     const u32x r3 = digest[6];
403
404     #include VECT_COMPARE_M
405   }
406 }
407
408 extern "C" __global__ void __launch_bounds__ (256, 1) m01450_m08 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, 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)
409 {
410 }
411
412 extern "C" __global__ void __launch_bounds__ (256, 1) m01450_m16 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, 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)
413 {
414 }
415
416 extern "C" __global__ void __launch_bounds__ (256, 1) m01450_s04 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, 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)
417 {
418   /**
419    * modifier
420    */
421
422   const u32 lid = threadIdx.x;
423
424   /**
425    * base
426    */
427
428   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
429
430   if (gid >= gid_max) return;
431
432   u32x pw_buf0[4];
433
434   pw_buf0[0] = pws[gid].i[ 0];
435   pw_buf0[1] = pws[gid].i[ 1];
436   pw_buf0[2] = pws[gid].i[ 2];
437   pw_buf0[3] = pws[gid].i[ 3];
438
439   u32x pw_buf1[4];
440
441   pw_buf1[0] = pws[gid].i[ 4];
442   pw_buf1[1] = pws[gid].i[ 5];
443   pw_buf1[2] = pws[gid].i[ 6];
444   pw_buf1[3] = pws[gid].i[ 7];
445
446   const u32 pw_len = pws[gid].pw_len;
447
448   /**
449    * salt
450    */
451
452   u32 salt_buf0[4];
453
454   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
455   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
456   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
457   salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
458
459   u32 salt_buf1[4];
460
461   salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
462   salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
463   salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
464   salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
465
466   const u32 salt_len = salt_bufs[salt_pos].salt_len;
467
468   /**
469    * digest
470    */
471
472   const u32 search[4] =
473   {
474     digests_buf[digests_offset].digest_buf[DGST_R0],
475     digests_buf[digests_offset].digest_buf[DGST_R1],
476     digests_buf[digests_offset].digest_buf[DGST_R2],
477     digests_buf[digests_offset].digest_buf[DGST_R3]
478   };
479
480   /**
481    * loop
482    */
483
484   for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
485   {
486     u32x w0[4];
487
488     w0[0] = pw_buf0[0];
489     w0[1] = pw_buf0[1];
490     w0[2] = pw_buf0[2];
491     w0[3] = pw_buf0[3];
492
493     u32x w1[4];
494
495     w1[0] = pw_buf1[0];
496     w1[1] = pw_buf1[1];
497     w1[2] = pw_buf1[2];
498     w1[3] = pw_buf1[3];
499
500     u32x w2[4];
501
502     w2[0] = 0;
503     w2[1] = 0;
504     w2[2] = 0;
505     w2[3] = 0;
506
507     u32x w3[4];
508
509     w3[0] = 0;
510     w3[1] = 0;
511     w3[2] = 0;
512     w3[3] = 0;
513
514     const u32 out_len = apply_rules (c_rules[il_pos].cmds, w0, w1, pw_len);
515
516     /**
517      * pads
518      */
519
520     u32x w0_t[4];
521
522     w0_t[0] = swap_workaround (w0[0]);
523     w0_t[1] = swap_workaround (w0[1]);
524     w0_t[2] = swap_workaround (w0[2]);
525     w0_t[3] = swap_workaround (w0[3]);
526
527     u32x w1_t[4];
528
529     w1_t[0] = swap_workaround (w1[0]);
530     w1_t[1] = swap_workaround (w1[1]);
531     w1_t[2] = swap_workaround (w1[2]);
532     w1_t[3] = swap_workaround (w1[3]);
533
534     u32x w2_t[4];
535
536     w2_t[0] = 0;
537     w2_t[1] = 0;
538     w2_t[2] = 0;
539     w2_t[3] = 0;
540
541     u32x w3_t[4];
542
543     w3_t[0] = 0;
544     w3_t[1] = 0;
545     w3_t[2] = 0;
546     w3_t[3] = 0;
547
548     u32x ipad[8];
549     u32x opad[8];
550
551     hmac_sha256_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
552
553     w0_t[0] = swap_workaround (salt_buf0[0]);
554     w0_t[1] = swap_workaround (salt_buf0[1]);
555     w0_t[2] = swap_workaround (salt_buf0[2]);
556     w0_t[3] = swap_workaround (salt_buf0[3]);
557     w1_t[0] = swap_workaround (salt_buf1[0]);
558     w1_t[1] = swap_workaround (salt_buf1[1]);
559     w1_t[2] = swap_workaround (salt_buf1[2]);
560     w1_t[3] = swap_workaround (salt_buf1[3]);
561     w2_t[0] = 0;
562     w2_t[1] = 0;
563     w2_t[2] = 0;
564     w2_t[3] = 0;
565     w3_t[0] = 0;
566     w3_t[1] = 0;
567     w3_t[2] = 0;
568     w3_t[3] = (64 + salt_len) * 8;
569
570     u32x digest[8];
571
572     hmac_sha256_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
573
574     const u32x r0 = digest[3];
575     const u32x r1 = digest[7];
576     const u32x r2 = digest[2];
577     const u32x r3 = digest[6];
578
579     #include VECT_COMPARE_S
580   }
581 }
582
583 extern "C" __global__ void __launch_bounds__ (256, 1) m01450_s08 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, 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)
584 {
585 }
586
587 extern "C" __global__ void __launch_bounds__ (256, 1) m01450_s16 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, 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)
588 {
589 }