Initial commit
[hashcat.git] / nv / m04400_a1.cu
1 /**
2  * Author......: Jens Steube <jens.steube@gmail.com>
3  * License.....: MIT
4  */
5
6 #define _MD5_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 0
20 #define DGST_R1 3
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
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 #ifdef VECT_SIZE1
44 #define uint_to_hex_lower8(i) l_bin2asc[(i)]
45 #endif
46
47 #ifdef VECT_SIZE2
48 #define uint_to_hex_lower8(i) u32x (l_bin2asc[(i).x], l_bin2asc[(i).y])
49 #endif
50
51 #ifdef VECT_SIZE4
52 #define uint_to_hex_lower8(i) u32x (l_bin2asc[(i).x], l_bin2asc[(i).y], l_bin2asc[(i).z], l_bin2asc[(i).w])
53 #endif
54
55 __device__ __constant__ char c_bin2asc[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
56
57 __device__ __shared__ short l_bin2asc[256];
58
59 __device__ __constant__ comb_t c_combs[1024];
60
61 extern "C" __global__ void __launch_bounds__ (256, 1) m04400_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)
62 {
63   /**
64    * modifier
65    */
66
67   const u32 lid = threadIdx.x;
68
69   /**
70    * base
71    */
72
73   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
74
75   u32x wordl0[4];
76
77   wordl0[0] = pws[gid].i[ 0];
78   wordl0[1] = pws[gid].i[ 1];
79   wordl0[2] = pws[gid].i[ 2];
80   wordl0[3] = pws[gid].i[ 3];
81
82   u32x wordl1[4];
83
84   wordl1[0] = pws[gid].i[ 4];
85   wordl1[1] = pws[gid].i[ 5];
86   wordl1[2] = pws[gid].i[ 6];
87   wordl1[3] = pws[gid].i[ 7];
88
89   u32x wordl2[4];
90
91   wordl2[0] = 0;
92   wordl2[1] = 0;
93   wordl2[2] = 0;
94   wordl2[3] = 0;
95
96   u32x wordl3[4];
97
98   wordl3[0] = 0;
99   wordl3[1] = 0;
100   wordl3[2] = 0;
101   wordl3[3] = 0;
102
103   const u32 pw_l_len = pws[gid].pw_len;
104
105   if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
106   {
107     append_0x80_2 (wordl0, wordl1, pw_l_len);
108
109     switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, c_combs[0].pw_len);
110   }
111
112   /**
113    * bin2asc table
114    */
115
116   l_bin2asc[lid] = c_bin2asc[(lid >> 0) & 15] << 8
117                  | c_bin2asc[(lid >> 4) & 15] << 0;
118
119   __syncthreads ();
120
121   if (gid >= gid_max) return;
122
123   /**
124    * loop
125    */
126
127   for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
128   {
129     const u32 pw_r_len = c_combs[il_pos].pw_len;
130
131     const u32 pw_len = pw_l_len + pw_r_len;
132
133     u32 wordr0[4];
134
135     wordr0[0] = c_combs[il_pos].i[0];
136     wordr0[1] = c_combs[il_pos].i[1];
137     wordr0[2] = c_combs[il_pos].i[2];
138     wordr0[3] = c_combs[il_pos].i[3];
139
140     u32 wordr1[4];
141
142     wordr1[0] = c_combs[il_pos].i[4];
143     wordr1[1] = c_combs[il_pos].i[5];
144     wordr1[2] = c_combs[il_pos].i[6];
145     wordr1[3] = c_combs[il_pos].i[7];
146
147     u32 wordr2[4];
148
149     wordr2[0] = 0;
150     wordr2[1] = 0;
151     wordr2[2] = 0;
152     wordr2[3] = 0;
153
154     u32 wordr3[4];
155
156     wordr3[0] = 0;
157     wordr3[1] = 0;
158     wordr3[2] = 0;
159     wordr3[3] = 0;
160
161     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
162     {
163       append_0x80_2 (wordr0, wordr1, pw_r_len);
164
165       switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
166     }
167
168     u32x w0[4];
169
170     w0[0] = wordl0[0] | wordr0[0];
171     w0[1] = wordl0[1] | wordr0[1];
172     w0[2] = wordl0[2] | wordr0[2];
173     w0[3] = wordl0[3] | wordr0[3];
174
175     u32x w1[4];
176
177     w1[0] = wordl1[0] | wordr1[0];
178     w1[1] = wordl1[1] | wordr1[1];
179     w1[2] = wordl1[2] | wordr1[2];
180     w1[3] = wordl1[3] | wordr1[3];
181
182     u32x w2[4];
183
184     w2[0] = wordl2[0] | wordr2[0];
185     w2[1] = wordl2[1] | wordr2[1];
186     w2[2] = wordl2[2] | wordr2[2];
187     w2[3] = wordl2[3] | wordr2[3];
188
189     u32x w3[4];
190
191     w3[0] = wordl3[0] | wordr3[0];
192     w3[1] = wordl3[1] | wordr3[1];
193     w3[2] = 0;
194     w3[3] = 0;
195
196     /**
197      * sha1
198      */
199
200     u32x w0_t = swap_workaround (w0[0]);
201     u32x w1_t = swap_workaround (w0[1]);
202     u32x w2_t = swap_workaround (w0[2]);
203     u32x w3_t = swap_workaround (w0[3]);
204     u32x w4_t = swap_workaround (w1[0]);
205     u32x w5_t = swap_workaround (w1[1]);
206     u32x w6_t = swap_workaround (w1[2]);
207     u32x w7_t = swap_workaround (w1[3]);
208     u32x w8_t = swap_workaround (w2[0]);
209     u32x w9_t = swap_workaround (w2[1]);
210     u32x wa_t = swap_workaround (w2[2]);
211     u32x wb_t = swap_workaround (w2[3]);
212     u32x wc_t = swap_workaround (w3[0]);
213     u32x wd_t = swap_workaround (w3[1]);
214     u32x we_t = 0;
215     u32x wf_t = pw_len * 8;
216
217     u32x a = SHA1M_A;
218     u32x b = SHA1M_B;
219     u32x c = SHA1M_C;
220     u32x d = SHA1M_D;
221     u32x e = SHA1M_E;
222
223     #undef K
224     #define K SHA1C00
225
226     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
227     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
228     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
229     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
230     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
231     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
232     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
233     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
234     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
235     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
236     SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
237     SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
238     SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
239     SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
240     SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
241     SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
242     w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
243     w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
244     w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
245     w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
246
247     #undef K
248     #define K SHA1C01
249
250     w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
251     w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
252     w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
253     w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
254     w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
255     w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
256     wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
257     wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
258     wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
259     wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
260     we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
261     wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
262     w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
263     w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
264     w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
265     w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
266     w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
267     w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
268     w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
269     w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
270
271     #undef K
272     #define K SHA1C02
273
274     w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
275     w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
276     wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
277     wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
278     wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
279     wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
280     we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
281     wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
282     w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
283     w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
284     w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
285     w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
286     w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
287     w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
288     w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
289     w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
290     w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
291     w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
292     wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
293     wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
294
295     #undef K
296     #define K SHA1C03
297
298     wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
299     wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
300     we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
301     wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
302     w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
303     w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
304     w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
305     w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
306     w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
307     w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
308     w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
309     w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
310     w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
311     w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
312     wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
313     wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
314     wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
315     wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
316     we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
317     wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
318
319     a += SHA1M_A;
320     b += SHA1M_B;
321     c += SHA1M_C;
322     d += SHA1M_D;
323     e += SHA1M_E;
324
325     /**
326      * md5
327      */
328
329     w0_t = uint_to_hex_lower8 ((a >> 24) & 255) <<  0
330          | uint_to_hex_lower8 ((a >> 16) & 255) << 16;
331     w1_t = uint_to_hex_lower8 ((a >>  8) & 255) <<  0
332          | uint_to_hex_lower8 ((a >>  0) & 255) << 16;
333     w2_t = uint_to_hex_lower8 ((b >> 24) & 255) <<  0
334          | uint_to_hex_lower8 ((b >> 16) & 255) << 16;
335     w3_t = uint_to_hex_lower8 ((b >>  8) & 255) <<  0
336          | uint_to_hex_lower8 ((b >>  0) & 255) << 16;
337     w4_t = uint_to_hex_lower8 ((c >> 24) & 255) <<  0
338          | uint_to_hex_lower8 ((c >> 16) & 255) << 16;
339     w5_t = uint_to_hex_lower8 ((c >>  8) & 255) <<  0
340          | uint_to_hex_lower8 ((c >>  0) & 255) << 16;
341     w6_t = uint_to_hex_lower8 ((d >> 24) & 255) <<  0
342          | uint_to_hex_lower8 ((d >> 16) & 255) << 16;
343     w7_t = uint_to_hex_lower8 ((d >>  8) & 255) <<  0
344          | uint_to_hex_lower8 ((d >>  0) & 255) << 16;
345     w8_t = uint_to_hex_lower8 ((e >> 24) & 255) <<  0
346          | uint_to_hex_lower8 ((e >> 16) & 255) << 16;
347     w9_t = uint_to_hex_lower8 ((e >>  8) & 255) <<  0
348          | uint_to_hex_lower8 ((e >>  0) & 255) << 16;
349
350     wa_t = 0x80;
351     wb_t = 0;
352     wc_t = 0;
353     wd_t = 0;
354     we_t = 40 * 8;
355     wf_t = 0;
356
357     a = MD5M_A;
358     b = MD5M_B;
359     c = MD5M_C;
360     d = MD5M_D;
361
362     MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
363     MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
364     MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
365     MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
366     MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
367     MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
368     MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
369     MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
370     MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
371     MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
372     MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
373     MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
374     MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
375     MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
376     MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
377     MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
378
379     MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
380     MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
381     MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
382     MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
383     MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
384     MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
385     MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
386     MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
387     MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
388     MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
389     MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
390     MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
391     MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
392     MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
393     MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
394     MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
395
396     MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
397     MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
398     MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
399     MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
400     MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
401     MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
402     MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
403     MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
404     MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
405     MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
406     MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
407     MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
408     MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
409     MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
410     MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
411     MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
412
413     MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
414     MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
415     MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
416     MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
417     MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
418     MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
419     MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
420     MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
421     MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
422     MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
423     MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
424     MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
425     MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
426     MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
427     MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
428     MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
429
430     const u32x r0 = a;
431     const u32x r1 = d;
432     const u32x r2 = c;
433     const u32x r3 = b;
434
435     #include VECT_COMPARE_M
436   }
437 }
438
439 extern "C" __global__ void __launch_bounds__ (256, 1) m04400_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)
440 {
441 }
442
443 extern "C" __global__ void __launch_bounds__ (256, 1) m04400_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)
444 {
445 }
446
447 extern "C" __global__ void __launch_bounds__ (256, 1) m04400_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)
448 {
449   /**
450    * modifier
451    */
452
453   const u32 lid = threadIdx.x;
454
455   /**
456    * base
457    */
458
459   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
460
461   u32x wordl0[4];
462
463   wordl0[0] = pws[gid].i[ 0];
464   wordl0[1] = pws[gid].i[ 1];
465   wordl0[2] = pws[gid].i[ 2];
466   wordl0[3] = pws[gid].i[ 3];
467
468   u32x wordl1[4];
469
470   wordl1[0] = pws[gid].i[ 4];
471   wordl1[1] = pws[gid].i[ 5];
472   wordl1[2] = pws[gid].i[ 6];
473   wordl1[3] = pws[gid].i[ 7];
474
475   u32x wordl2[4];
476
477   wordl2[0] = 0;
478   wordl2[1] = 0;
479   wordl2[2] = 0;
480   wordl2[3] = 0;
481
482   u32x wordl3[4];
483
484   wordl3[0] = 0;
485   wordl3[1] = 0;
486   wordl3[2] = 0;
487   wordl3[3] = 0;
488
489   const u32 pw_l_len = pws[gid].pw_len;
490
491   if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
492   {
493     append_0x80_2 (wordl0, wordl1, pw_l_len);
494
495     switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, c_combs[0].pw_len);
496   }
497
498   /**
499    * bin2asc table
500    */
501
502   l_bin2asc[lid] = c_bin2asc[(lid >> 0) & 15] << 8
503                  | c_bin2asc[(lid >> 4) & 15] << 0;
504
505   __syncthreads ();
506
507   if (gid >= gid_max) return;
508
509   /**
510    * digest
511    */
512
513   const u32 search[4] =
514   {
515     digests_buf[digests_offset].digest_buf[DGST_R0],
516     digests_buf[digests_offset].digest_buf[DGST_R1],
517     digests_buf[digests_offset].digest_buf[DGST_R2],
518     digests_buf[digests_offset].digest_buf[DGST_R3]
519   };
520
521   /**
522    * loop
523    */
524
525   for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
526   {
527     const u32 pw_r_len = c_combs[il_pos].pw_len;
528
529     const u32 pw_len = pw_l_len + pw_r_len;
530
531     u32 wordr0[4];
532
533     wordr0[0] = c_combs[il_pos].i[0];
534     wordr0[1] = c_combs[il_pos].i[1];
535     wordr0[2] = c_combs[il_pos].i[2];
536     wordr0[3] = c_combs[il_pos].i[3];
537
538     u32 wordr1[4];
539
540     wordr1[0] = c_combs[il_pos].i[4];
541     wordr1[1] = c_combs[il_pos].i[5];
542     wordr1[2] = c_combs[il_pos].i[6];
543     wordr1[3] = c_combs[il_pos].i[7];
544
545     u32 wordr2[4];
546
547     wordr2[0] = 0;
548     wordr2[1] = 0;
549     wordr2[2] = 0;
550     wordr2[3] = 0;
551
552     u32 wordr3[4];
553
554     wordr3[0] = 0;
555     wordr3[1] = 0;
556     wordr3[2] = 0;
557     wordr3[3] = 0;
558
559     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
560     {
561       append_0x80_2 (wordr0, wordr1, pw_r_len);
562
563       switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
564     }
565
566     u32x w0[4];
567
568     w0[0] = wordl0[0] | wordr0[0];
569     w0[1] = wordl0[1] | wordr0[1];
570     w0[2] = wordl0[2] | wordr0[2];
571     w0[3] = wordl0[3] | wordr0[3];
572
573     u32x w1[4];
574
575     w1[0] = wordl1[0] | wordr1[0];
576     w1[1] = wordl1[1] | wordr1[1];
577     w1[2] = wordl1[2] | wordr1[2];
578     w1[3] = wordl1[3] | wordr1[3];
579
580     u32x w2[4];
581
582     w2[0] = wordl2[0] | wordr2[0];
583     w2[1] = wordl2[1] | wordr2[1];
584     w2[2] = wordl2[2] | wordr2[2];
585     w2[3] = wordl2[3] | wordr2[3];
586
587     u32x w3[4];
588
589     w3[0] = wordl3[0] | wordr3[0];
590     w3[1] = wordl3[1] | wordr3[1];
591     w3[2] = 0;
592     w3[3] = 0;
593
594     /**
595      * sha1
596      */
597
598     u32x w0_t = swap_workaround (w0[0]);
599     u32x w1_t = swap_workaround (w0[1]);
600     u32x w2_t = swap_workaround (w0[2]);
601     u32x w3_t = swap_workaround (w0[3]);
602     u32x w4_t = swap_workaround (w1[0]);
603     u32x w5_t = swap_workaround (w1[1]);
604     u32x w6_t = swap_workaround (w1[2]);
605     u32x w7_t = swap_workaround (w1[3]);
606     u32x w8_t = swap_workaround (w2[0]);
607     u32x w9_t = swap_workaround (w2[1]);
608     u32x wa_t = swap_workaround (w2[2]);
609     u32x wb_t = swap_workaround (w2[3]);
610     u32x wc_t = swap_workaround (w3[0]);
611     u32x wd_t = swap_workaround (w3[1]);
612     u32x we_t = 0;
613     u32x wf_t = pw_len * 8;
614
615     u32x a = SHA1M_A;
616     u32x b = SHA1M_B;
617     u32x c = SHA1M_C;
618     u32x d = SHA1M_D;
619     u32x e = SHA1M_E;
620
621     #undef K
622     #define K SHA1C00
623
624     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
625     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
626     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
627     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
628     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
629     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
630     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
631     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
632     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
633     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
634     SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
635     SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
636     SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
637     SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
638     SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
639     SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
640     w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
641     w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
642     w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
643     w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
644
645     #undef K
646     #define K SHA1C01
647
648     w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
649     w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
650     w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
651     w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
652     w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
653     w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
654     wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
655     wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
656     wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
657     wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
658     we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
659     wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
660     w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
661     w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
662     w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
663     w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
664     w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
665     w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
666     w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
667     w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
668
669     #undef K
670     #define K SHA1C02
671
672     w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
673     w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
674     wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
675     wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
676     wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
677     wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
678     we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
679     wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
680     w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
681     w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
682     w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
683     w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
684     w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
685     w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
686     w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
687     w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
688     w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
689     w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
690     wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
691     wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
692
693     #undef K
694     #define K SHA1C03
695
696     wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
697     wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
698     we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
699     wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
700     w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
701     w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
702     w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
703     w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
704     w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
705     w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
706     w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
707     w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
708     w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
709     w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
710     wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
711     wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
712     wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
713     wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
714     we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
715     wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
716
717     a += SHA1M_A;
718     b += SHA1M_B;
719     c += SHA1M_C;
720     d += SHA1M_D;
721     e += SHA1M_E;
722
723     /**
724      * md5
725      */
726
727     w0_t = uint_to_hex_lower8 ((a >> 24) & 255) <<  0
728          | uint_to_hex_lower8 ((a >> 16) & 255) << 16;
729     w1_t = uint_to_hex_lower8 ((a >>  8) & 255) <<  0
730          | uint_to_hex_lower8 ((a >>  0) & 255) << 16;
731     w2_t = uint_to_hex_lower8 ((b >> 24) & 255) <<  0
732          | uint_to_hex_lower8 ((b >> 16) & 255) << 16;
733     w3_t = uint_to_hex_lower8 ((b >>  8) & 255) <<  0
734          | uint_to_hex_lower8 ((b >>  0) & 255) << 16;
735     w4_t = uint_to_hex_lower8 ((c >> 24) & 255) <<  0
736          | uint_to_hex_lower8 ((c >> 16) & 255) << 16;
737     w5_t = uint_to_hex_lower8 ((c >>  8) & 255) <<  0
738          | uint_to_hex_lower8 ((c >>  0) & 255) << 16;
739     w6_t = uint_to_hex_lower8 ((d >> 24) & 255) <<  0
740          | uint_to_hex_lower8 ((d >> 16) & 255) << 16;
741     w7_t = uint_to_hex_lower8 ((d >>  8) & 255) <<  0
742          | uint_to_hex_lower8 ((d >>  0) & 255) << 16;
743     w8_t = uint_to_hex_lower8 ((e >> 24) & 255) <<  0
744          | uint_to_hex_lower8 ((e >> 16) & 255) << 16;
745     w9_t = uint_to_hex_lower8 ((e >>  8) & 255) <<  0
746          | uint_to_hex_lower8 ((e >>  0) & 255) << 16;
747
748     wa_t = 0x80;
749     wb_t = 0;
750     wc_t = 0;
751     wd_t = 0;
752     we_t = 40 * 8;
753     wf_t = 0;
754
755     a = MD5M_A;
756     b = MD5M_B;
757     c = MD5M_C;
758     d = MD5M_D;
759
760     MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
761     MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
762     MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
763     MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
764     MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
765     MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
766     MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
767     MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
768     MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
769     MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
770     MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
771     MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
772     MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
773     MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
774     MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
775     MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
776
777     MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
778     MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
779     MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
780     MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
781     MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
782     MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
783     MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
784     MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
785     MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
786     MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
787     MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
788     MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
789     MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
790     MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
791     MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
792     MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
793
794     MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
795     MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
796     MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
797     MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
798     MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
799     MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
800     MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
801     MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
802     MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
803     MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
804     MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
805     MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
806     MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
807     MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
808     MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
809     MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
810
811     MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
812     MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
813     MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
814     MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
815     MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
816     MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
817     MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
818     MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
819     MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
820     MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
821     MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
822     MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
823     MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
824     MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
825     MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
826     MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
827
828     const u32x r0 = a;
829     const u32x r1 = d;
830     const u32x r2 = c;
831     const u32x r3 = b;
832
833     #include VECT_COMPARE_S
834   }
835 }
836
837 extern "C" __global__ void __launch_bounds__ (256, 1) m04400_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)
838 {
839 }
840
841 extern "C" __global__ void __launch_bounds__ (256, 1) m04400_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)
842 {
843 }