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