Initial commit
[hashcat.git] / nv / m00190_a1.cu
1 /**
2  * Author......: Jens Steube <jens.steube@gmail.com>
3  * License.....: MIT
4  */
5
6 #define _SHA1_
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_SIZE4
17 #endif
18
19 #define DGST_R0 0
20 #define DGST_R1 4
21 #define DGST_R2 3
22 #define DGST_R3 2
23
24 #include "include/kernel_functions.c"
25 #include "types_nv.c"
26 #include "common_nv.c"
27
28 #ifdef  VECT_SIZE1
29 #define VECT_COMPARE_S "check_single_vect1_comp4.c"
30 #define VECT_COMPARE_M "check_multi_vect1_comp4.c"
31 #endif
32
33 #ifdef  VECT_SIZE2
34 #define VECT_COMPARE_S "check_single_vect2_comp4.c"
35 #define VECT_COMPARE_M "check_multi_vect2_comp4.c"
36 #endif
37
38 #ifdef  VECT_SIZE4
39 #define VECT_COMPARE_S "check_single_vect4_comp4.c"
40 #define VECT_COMPARE_M "check_multi_vect4_comp4.c"
41 #endif
42
43 __device__ __constant__ comb_t c_combs[1024];
44
45 extern "C" __global__ void __launch_bounds__ (256, 1) m00190_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
46 {
47   /**
48    * modifier
49    */
50
51   const u32 lid = threadIdx.x;
52
53   /**
54    * base
55    */
56
57   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
58
59   if (gid >= gid_max) return;
60
61   u32x wordl0[4];
62
63   wordl0[0] = pws[gid].i[ 0];
64   wordl0[1] = pws[gid].i[ 1];
65   wordl0[2] = pws[gid].i[ 2];
66   wordl0[3] = pws[gid].i[ 3];
67
68   u32x wordl1[4];
69
70   wordl1[0] = pws[gid].i[ 4];
71   wordl1[1] = pws[gid].i[ 5];
72   wordl1[2] = pws[gid].i[ 6];
73   wordl1[3] = pws[gid].i[ 7];
74
75   u32x wordl2[4];
76
77   wordl2[0] = 0;
78   wordl2[1] = 0;
79   wordl2[2] = 0;
80   wordl2[3] = 0;
81
82   u32x wordl3[4];
83
84   wordl3[0] = 0;
85   wordl3[1] = 0;
86   wordl3[2] = 0;
87   wordl3[3] = 0;
88
89   const u32 pw_l_len = pws[gid].pw_len;
90
91   if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
92   {
93     append_0x80_2 (wordl0, wordl1, pw_l_len);
94
95     switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, c_combs[0].pw_len);
96   }
97
98   /**
99    * loop
100    */
101
102   for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
103   {
104     const u32 pw_r_len = c_combs[il_pos].pw_len;
105
106     const u32 pw_len = pw_l_len + pw_r_len;
107
108     u32 wordr0[4];
109
110     wordr0[0] = c_combs[il_pos].i[0];
111     wordr0[1] = c_combs[il_pos].i[1];
112     wordr0[2] = c_combs[il_pos].i[2];
113     wordr0[3] = c_combs[il_pos].i[3];
114
115     u32 wordr1[4];
116
117     wordr1[0] = c_combs[il_pos].i[4];
118     wordr1[1] = c_combs[il_pos].i[5];
119     wordr1[2] = c_combs[il_pos].i[6];
120     wordr1[3] = c_combs[il_pos].i[7];
121
122     u32 wordr2[4];
123
124     wordr2[0] = 0;
125     wordr2[1] = 0;
126     wordr2[2] = 0;
127     wordr2[3] = 0;
128
129     u32 wordr3[4];
130
131     wordr3[0] = 0;
132     wordr3[1] = 0;
133     wordr3[2] = 0;
134     wordr3[3] = 0;
135
136     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
137     {
138       append_0x80_2 (wordr0, wordr1, pw_r_len);
139
140       switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
141     }
142
143     u32x w0[4];
144
145     w0[0] = wordl0[0] | wordr0[0];
146     w0[1] = wordl0[1] | wordr0[1];
147     w0[2] = wordl0[2] | wordr0[2];
148     w0[3] = wordl0[3] | wordr0[3];
149
150     u32x w1[4];
151
152     w1[0] = wordl1[0] | wordr1[0];
153     w1[1] = wordl1[1] | wordr1[1];
154     w1[2] = wordl1[2] | wordr1[2];
155     w1[3] = wordl1[3] | wordr1[3];
156
157     u32x w2[4];
158
159     w2[0] = wordl2[0] | wordr2[0];
160     w2[1] = wordl2[1] | wordr2[1];
161     w2[2] = wordl2[2] | wordr2[2];
162     w2[3] = wordl2[3] | wordr2[3];
163
164     u32x w3[4];
165
166     w3[0] = wordl3[0] | wordr3[0];
167     w3[1] = wordl3[1] | wordr3[1];
168     w3[2] = 0;
169     w3[3] = 0;
170
171     /**
172      * sha1
173      */
174
175     u32x w0_t = swap_workaround (w0[0]);
176     u32x w1_t = swap_workaround (w0[1]);
177     u32x w2_t = swap_workaround (w0[2]);
178     u32x w3_t = swap_workaround (w0[3]);
179     u32x w4_t = swap_workaround (w1[0]);
180     u32x w5_t = swap_workaround (w1[1]);
181     u32x w6_t = swap_workaround (w1[2]);
182     u32x w7_t = swap_workaround (w1[3]);
183     u32x w8_t = swap_workaround (w2[0]);
184     u32x w9_t = swap_workaround (w2[1]);
185     u32x wa_t = swap_workaround (w2[2]);
186     u32x wb_t = swap_workaround (w2[3]);
187     u32x wc_t = swap_workaround (w3[0]);
188     u32x wd_t = swap_workaround (w3[1]);
189     u32x we_t = 0;
190     u32x wf_t = pw_len * 8;
191
192     u32x a = SHA1M_A;
193     u32x b = SHA1M_B;
194     u32x c = SHA1M_C;
195     u32x d = SHA1M_D;
196     u32x e = SHA1M_E;
197
198     #undef K
199     #define K SHA1C00
200
201     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
202     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
203     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
204     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
205     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
206     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
207     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
208     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
209     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
210     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
211     SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
212     SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
213     SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
214     SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
215     SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
216     SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
217     w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
218     w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
219     w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
220     w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
221
222     #undef K
223     #define K SHA1C01
224
225     w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
226     w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
227     w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
228     w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
229     w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
230     w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
231     wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
232     wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
233     wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
234     wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
235     we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
236     wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
237     w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
238     w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
239     w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
240     w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
241     w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
242     w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
243     w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
244     w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
245
246     #undef K
247     #define K SHA1C02
248
249     w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
250     w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
251     wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
252     wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
253     wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
254     wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
255     we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
256     wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
257     w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
258     w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
259     w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
260     w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
261     w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
262     w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
263     w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
264     w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
265     w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
266     w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
267     wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
268     wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
269
270     #undef K
271     #define K SHA1C03
272
273     wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
274     wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
275     we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
276     wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
277     w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
278     w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
279     w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
280     w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
281     w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
282     w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
283     w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
284     w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
285     w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
286     w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
287     wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
288     wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
289     wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
290     wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
291     we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
292     wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
293
294     a += SHA1M_A;
295     e += SHA1M_E;
296     d += SHA1M_D;
297     c += SHA1M_C;
298
299     {
300       const u32x r0 = a;
301       const u32x r1 = e;
302       const u32x r2 = d;
303       const u32x r3 = c;
304
305       #include VECT_COMPARE_M
306     }
307
308     a &= 0x00000fff;
309
310     {
311       const u32x r0 = a;
312       const u32x r1 = e;
313       const u32x r2 = d;
314       const u32x r3 = c;
315
316       #include VECT_COMPARE_M
317     }
318   }
319 }
320
321 extern "C" __global__ void __launch_bounds__ (256, 1) m00190_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)
322 {
323 }
324
325 extern "C" __global__ void __launch_bounds__ (256, 1) m00190_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)
326 {
327 }
328
329 extern "C" __global__ void __launch_bounds__ (256, 1) m00190_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
330 {
331   /**
332    * modifier
333    */
334
335   const u32 lid = threadIdx.x;
336
337   /**
338    * base
339    */
340
341   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
342
343   if (gid >= gid_max) return;
344
345   u32x wordl0[4];
346
347   wordl0[0] = pws[gid].i[ 0];
348   wordl0[1] = pws[gid].i[ 1];
349   wordl0[2] = pws[gid].i[ 2];
350   wordl0[3] = pws[gid].i[ 3];
351
352   u32x wordl1[4];
353
354   wordl1[0] = pws[gid].i[ 4];
355   wordl1[1] = pws[gid].i[ 5];
356   wordl1[2] = pws[gid].i[ 6];
357   wordl1[3] = pws[gid].i[ 7];
358
359   u32x wordl2[4];
360
361   wordl2[0] = 0;
362   wordl2[1] = 0;
363   wordl2[2] = 0;
364   wordl2[3] = 0;
365
366   u32x wordl3[4];
367
368   wordl3[0] = 0;
369   wordl3[1] = 0;
370   wordl3[2] = 0;
371   wordl3[3] = 0;
372
373   const u32 pw_l_len = pws[gid].pw_len;
374
375   if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
376   {
377     append_0x80_2 (wordl0, wordl1, pw_l_len);
378
379     switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, c_combs[0].pw_len);
380   }
381
382   /**
383    * digest
384    */
385
386   const u32 search[4] =
387   {
388     digests_buf[digests_offset].digest_buf[DGST_R0],
389     digests_buf[digests_offset].digest_buf[DGST_R1],
390     digests_buf[digests_offset].digest_buf[DGST_R2],
391     digests_buf[digests_offset].digest_buf[DGST_R3],
392   };
393
394   /**
395    * loop
396    */
397
398   for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
399   {
400     const u32 pw_r_len = c_combs[il_pos].pw_len;
401
402     const u32 pw_len = pw_l_len + pw_r_len;
403
404     u32 wordr0[4];
405
406     wordr0[0] = c_combs[il_pos].i[0];
407     wordr0[1] = c_combs[il_pos].i[1];
408     wordr0[2] = c_combs[il_pos].i[2];
409     wordr0[3] = c_combs[il_pos].i[3];
410
411     u32 wordr1[4];
412
413     wordr1[0] = c_combs[il_pos].i[4];
414     wordr1[1] = c_combs[il_pos].i[5];
415     wordr1[2] = c_combs[il_pos].i[6];
416     wordr1[3] = c_combs[il_pos].i[7];
417
418     u32 wordr2[4];
419
420     wordr2[0] = 0;
421     wordr2[1] = 0;
422     wordr2[2] = 0;
423     wordr2[3] = 0;
424
425     u32 wordr3[4];
426
427     wordr3[0] = 0;
428     wordr3[1] = 0;
429     wordr3[2] = 0;
430     wordr3[3] = 0;
431
432     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
433     {
434       append_0x80_2 (wordr0, wordr1, pw_r_len);
435
436       switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
437     }
438
439     u32x w0[4];
440
441     w0[0] = wordl0[0] | wordr0[0];
442     w0[1] = wordl0[1] | wordr0[1];
443     w0[2] = wordl0[2] | wordr0[2];
444     w0[3] = wordl0[3] | wordr0[3];
445
446     u32x w1[4];
447
448     w1[0] = wordl1[0] | wordr1[0];
449     w1[1] = wordl1[1] | wordr1[1];
450     w1[2] = wordl1[2] | wordr1[2];
451     w1[3] = wordl1[3] | wordr1[3];
452
453     u32x w2[4];
454
455     w2[0] = wordl2[0] | wordr2[0];
456     w2[1] = wordl2[1] | wordr2[1];
457     w2[2] = wordl2[2] | wordr2[2];
458     w2[3] = wordl2[3] | wordr2[3];
459
460     u32x w3[4];
461
462     w3[0] = wordl3[0] | wordr3[0];
463     w3[1] = wordl3[1] | wordr3[1];
464     w3[2] = 0;
465     w3[3] = 0;
466
467     /**
468      * sha1
469      */
470
471     u32x w0_t = swap_workaround (w0[0]);
472     u32x w1_t = swap_workaround (w0[1]);
473     u32x w2_t = swap_workaround (w0[2]);
474     u32x w3_t = swap_workaround (w0[3]);
475     u32x w4_t = swap_workaround (w1[0]);
476     u32x w5_t = swap_workaround (w1[1]);
477     u32x w6_t = swap_workaround (w1[2]);
478     u32x w7_t = swap_workaround (w1[3]);
479     u32x w8_t = swap_workaround (w2[0]);
480     u32x w9_t = swap_workaround (w2[1]);
481     u32x wa_t = swap_workaround (w2[2]);
482     u32x wb_t = swap_workaround (w2[3]);
483     u32x wc_t = swap_workaround (w3[0]);
484     u32x wd_t = swap_workaround (w3[1]);
485     u32x we_t = 0;
486     u32x wf_t = pw_len * 8;
487
488     u32x a = SHA1M_A;
489     u32x b = SHA1M_B;
490     u32x c = SHA1M_C;
491     u32x d = SHA1M_D;
492     u32x e = SHA1M_E;
493
494     #undef K
495     #define K SHA1C00
496
497     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
498     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
499     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
500     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
501     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
502     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
503     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
504     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
505     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
506     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
507     SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
508     SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
509     SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
510     SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
511     SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
512     SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
513     w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
514     w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
515     w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
516     w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
517
518     #undef K
519     #define K SHA1C01
520
521     w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
522     w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
523     w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
524     w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
525     w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
526     w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
527     wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
528     wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
529     wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
530     wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
531     we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
532     wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
533     w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
534     w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
535     w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
536     w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
537     w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
538     w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
539     w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
540     w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
541
542     #undef K
543     #define K SHA1C02
544
545     w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
546     w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
547     wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
548     wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
549     wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
550     wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
551     we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
552     wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
553     w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
554     w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
555     w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
556     w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
557     w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
558     w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
559     w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
560     w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
561     w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
562     w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
563     wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
564     wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
565
566     #undef K
567     #define K SHA1C03
568
569     wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
570     wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
571     we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
572     wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
573     w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
574     w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
575     w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
576     w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
577     w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
578     w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
579     w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
580     w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
581     w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
582     w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
583     wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
584     wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
585     wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
586     wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
587     we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
588     wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
589
590     a += SHA1M_A;
591     e += SHA1M_E;
592     d += SHA1M_D;
593     c += SHA1M_C;
594
595     {
596       const u32x r0 = a;
597       const u32x r1 = e;
598       const u32x r2 = d;
599       const u32x r3 = c;
600
601       #include VECT_COMPARE_S
602     }
603
604     a &= 0x00000fff;
605
606     {
607       const u32x r0 = a;
608       const u32x r1 = e;
609       const u32x r2 = d;
610       const u32x r3 = c;
611
612       #include VECT_COMPARE_S
613     }
614   }
615 }
616
617 extern "C" __global__ void __launch_bounds__ (256, 1) m00190_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)
618 {
619 }
620
621 extern "C" __global__ void __launch_bounds__ (256, 1) m00190_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)
622 {
623 }