Initial commit
[hashcat.git] / nv / m01100_a1.cu
1 /**
2  * Author......: Jens Steube <jens.steube@gmail.com>
3  * License.....: MIT
4  */
5
6 #define _MD4_
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 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 __device__ __constant__ comb_t c_combs[1024];
44
45 extern "C" __global__ void __launch_bounds__ (256, 1) m01100_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    * salt
100    */
101
102   u32 salt_buf0[4];
103
104   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
105   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
106   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
107   salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
108
109   u32 salt_buf1[4];
110
111   salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
112   salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
113   salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
114   salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
115
116   u32 salt_buf2[4];
117
118   salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
119   salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
120   salt_buf2[2] = 0;
121   salt_buf2[3] = 0;
122
123   const u32 salt_len = salt_bufs[salt_pos].salt_len;
124
125   /**
126    * loop
127    */
128
129   for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
130   {
131     const u32 pw_r_len = c_combs[il_pos].pw_len;
132
133     const u32 pw_len = pw_l_len + pw_r_len;
134
135     u32 wordr0[4];
136
137     wordr0[0] = c_combs[il_pos].i[0];
138     wordr0[1] = c_combs[il_pos].i[1];
139     wordr0[2] = c_combs[il_pos].i[2];
140     wordr0[3] = c_combs[il_pos].i[3];
141
142     u32 wordr1[4];
143
144     wordr1[0] = c_combs[il_pos].i[4];
145     wordr1[1] = c_combs[il_pos].i[5];
146     wordr1[2] = c_combs[il_pos].i[6];
147     wordr1[3] = c_combs[il_pos].i[7];
148
149     u32 wordr2[4];
150
151     wordr2[0] = 0;
152     wordr2[1] = 0;
153     wordr2[2] = 0;
154     wordr2[3] = 0;
155
156     u32 wordr3[4];
157
158     wordr3[0] = 0;
159     wordr3[1] = 0;
160     wordr3[2] = 0;
161     wordr3[3] = 0;
162
163     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
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] = 0;
185     w2[1] = 0;
186     w2[2] = 0;
187     w2[3] = 0;
188
189     u32x w3[4];
190
191     w3[0] = 0;
192     w3[1] = 0;
193     w3[2] = 0;
194     w3[3] = 0;
195
196     u32x w0_t[4];
197     u32x w1_t[4];
198     u32x w2_t[4];
199     u32x w3_t[4];
200
201     make_unicode (w0, w0_t, w1_t);
202     make_unicode (w1, w2_t, w3_t);
203
204     w3_t[2] = pw_len * 8 * 2;
205
206     u32x a = MD4M_A;
207     u32x b = MD4M_B;
208     u32x c = MD4M_C;
209     u32x d = MD4M_D;
210
211     MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00);
212     MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01);
213     MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02);
214     MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03);
215     MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00);
216     MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01);
217     MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02);
218     MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03);
219     MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00);
220     MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01);
221     MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02);
222     MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03);
223     MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00);
224     MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01);
225     MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02);
226     MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03);
227
228     MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10);
229     MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11);
230     MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12);
231     MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13);
232     MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10);
233     MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11);
234     MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12);
235     MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13);
236     MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10);
237     MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11);
238     MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12);
239     MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13);
240     MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10);
241     MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11);
242     MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12);
243     MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13);
244
245     MD4_STEP (MD4_H , a, b, c, d, w0_t[0], MD4C02, MD4S20);
246     MD4_STEP (MD4_H , d, a, b, c, w2_t[0], MD4C02, MD4S21);
247     MD4_STEP (MD4_H , c, d, a, b, w1_t[0], MD4C02, MD4S22);
248     MD4_STEP (MD4_H , b, c, d, a, w3_t[0], MD4C02, MD4S23);
249     MD4_STEP (MD4_H , a, b, c, d, w0_t[2], MD4C02, MD4S20);
250     MD4_STEP (MD4_H , d, a, b, c, w2_t[2], MD4C02, MD4S21);
251     MD4_STEP (MD4_H , c, d, a, b, w1_t[2], MD4C02, MD4S22);
252     MD4_STEP (MD4_H , b, c, d, a, w3_t[2], MD4C02, MD4S23);
253     MD4_STEP (MD4_H , a, b, c, d, w0_t[1], MD4C02, MD4S20);
254     MD4_STEP (MD4_H , d, a, b, c, w2_t[1], MD4C02, MD4S21);
255     MD4_STEP (MD4_H , c, d, a, b, w1_t[1], MD4C02, MD4S22);
256     MD4_STEP (MD4_H , b, c, d, a, w3_t[1], MD4C02, MD4S23);
257     MD4_STEP (MD4_H , a, b, c, d, w0_t[3], MD4C02, MD4S20);
258     MD4_STEP (MD4_H , d, a, b, c, w2_t[3], MD4C02, MD4S21);
259     MD4_STEP (MD4_H , c, d, a, b, w1_t[3], MD4C02, MD4S22);
260     MD4_STEP (MD4_H , b, c, d, a, w3_t[3], MD4C02, MD4S23);
261
262     a += MD4M_A;
263     b += MD4M_B;
264     c += MD4M_C;
265     d += MD4M_D;
266
267     w0_t[0] = a;
268     w0_t[1] = b;
269     w0_t[2] = c;
270     w0_t[3] = d;
271     w1_t[0] = salt_buf0[0];
272     w1_t[1] = salt_buf0[1];
273     w1_t[2] = salt_buf0[2];
274     w1_t[3] = salt_buf0[3];
275     w2_t[0] = salt_buf1[0];
276     w2_t[1] = salt_buf1[1];
277     w2_t[2] = salt_buf1[2];
278     w2_t[3] = salt_buf1[3];
279     w3_t[0] = salt_buf2[0];
280     w3_t[1] = salt_buf2[1];
281     w3_t[2] = (16 + salt_len) * 8;
282     w3_t[3] = 0;
283
284     a = MD4M_A;
285     b = MD4M_B;
286     c = MD4M_C;
287     d = MD4M_D;
288
289     MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00);
290     MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01);
291     MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02);
292     MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03);
293     MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00);
294     MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01);
295     MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02);
296     MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03);
297     MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00);
298     MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01);
299     MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02);
300     MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03);
301     MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00);
302     MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01);
303     MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02);
304     MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03);
305
306     MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10);
307     MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11);
308     MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12);
309     MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13);
310     MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10);
311     MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11);
312     MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12);
313     MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13);
314     MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10);
315     MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11);
316     MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12);
317     MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13);
318     MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10);
319     MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11);
320     MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12);
321     MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13);
322
323     MD4_STEP (MD4_H , a, b, c, d, w0_t[0], MD4C02, MD4S20);
324     MD4_STEP (MD4_H , d, a, b, c, w2_t[0], MD4C02, MD4S21);
325     MD4_STEP (MD4_H , c, d, a, b, w1_t[0], MD4C02, MD4S22);
326     MD4_STEP (MD4_H , b, c, d, a, w3_t[0], MD4C02, MD4S23);
327     MD4_STEP (MD4_H , a, b, c, d, w0_t[2], MD4C02, MD4S20);
328     MD4_STEP (MD4_H , d, a, b, c, w2_t[2], MD4C02, MD4S21);
329     MD4_STEP (MD4_H , c, d, a, b, w1_t[2], MD4C02, MD4S22);
330     MD4_STEP (MD4_H , b, c, d, a, w3_t[2], MD4C02, MD4S23);
331     MD4_STEP (MD4_H , a, b, c, d, w0_t[1], MD4C02, MD4S20);
332     MD4_STEP (MD4_H , d, a, b, c, w2_t[1], MD4C02, MD4S21);
333     MD4_STEP (MD4_H , c, d, a, b, w1_t[1], MD4C02, MD4S22);
334     MD4_STEP (MD4_H , b, c, d, a, w3_t[1], MD4C02, MD4S23);
335     MD4_STEP (MD4_H , a, b, c, d, w0_t[3], MD4C02, MD4S20);
336     MD4_STEP (MD4_H , d, a, b, c, w2_t[3], MD4C02, MD4S21);
337     MD4_STEP (MD4_H , c, d, a, b, w1_t[3], MD4C02, MD4S22);
338     MD4_STEP (MD4_H , b, c, d, a, w3_t[3], MD4C02, MD4S23);
339
340     const u32x r0 = a;
341     const u32x r1 = d;
342     const u32x r2 = c;
343     const u32x r3 = b;
344
345     #include VECT_COMPARE_M
346   }
347 }
348
349 extern "C" __global__ void __launch_bounds__ (256, 1) m01100_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)
350 {
351 }
352
353 extern "C" __global__ void __launch_bounds__ (256, 1) m01100_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)
354 {
355 }
356
357 extern "C" __global__ void __launch_bounds__ (256, 1) m01100_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)
358 {
359   /**
360    * modifier
361    */
362
363   const u32 lid = threadIdx.x;
364
365   /**
366    * base
367    */
368
369   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
370
371   if (gid >= gid_max) return;
372
373   u32x wordl0[4];
374
375   wordl0[0] = pws[gid].i[ 0];
376   wordl0[1] = pws[gid].i[ 1];
377   wordl0[2] = pws[gid].i[ 2];
378   wordl0[3] = pws[gid].i[ 3];
379
380   u32x wordl1[4];
381
382   wordl1[0] = pws[gid].i[ 4];
383   wordl1[1] = pws[gid].i[ 5];
384   wordl1[2] = pws[gid].i[ 6];
385   wordl1[3] = pws[gid].i[ 7];
386
387   u32x wordl2[4];
388
389   wordl2[0] = 0;
390   wordl2[1] = 0;
391   wordl2[2] = 0;
392   wordl2[3] = 0;
393
394   u32x wordl3[4];
395
396   wordl3[0] = 0;
397   wordl3[1] = 0;
398   wordl3[2] = 0;
399   wordl3[3] = 0;
400
401   const u32 pw_l_len = pws[gid].pw_len;
402
403   if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
404   {
405     append_0x80_2 (wordl0, wordl1, pw_l_len);
406
407     switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, c_combs[0].pw_len);
408   }
409
410   /**
411    * digest
412    */
413
414   const u32 search[4] =
415   {
416     digests_buf[digests_offset].digest_buf[DGST_R0],
417     digests_buf[digests_offset].digest_buf[DGST_R1],
418     digests_buf[digests_offset].digest_buf[DGST_R2],
419     digests_buf[digests_offset].digest_buf[DGST_R3]
420   };
421
422   /**
423    * salt
424    */
425
426   u32 salt_buf0[4];
427
428   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
429   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
430   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
431   salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
432
433   u32 salt_buf1[4];
434
435   salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
436   salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
437   salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
438   salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
439
440   u32 salt_buf2[4];
441
442   salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
443   salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
444   salt_buf2[2] = 0;
445   salt_buf2[3] = 0;
446
447   const u32 salt_len = salt_bufs[salt_pos].salt_len;
448
449   /**
450    * loop
451    */
452
453   for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
454   {
455     const u32 pw_r_len = c_combs[il_pos].pw_len;
456
457     const u32 pw_len = pw_l_len + pw_r_len;
458
459     u32 wordr0[4];
460
461     wordr0[0] = c_combs[il_pos].i[0];
462     wordr0[1] = c_combs[il_pos].i[1];
463     wordr0[2] = c_combs[il_pos].i[2];
464     wordr0[3] = c_combs[il_pos].i[3];
465
466     u32 wordr1[4];
467
468     wordr1[0] = c_combs[il_pos].i[4];
469     wordr1[1] = c_combs[il_pos].i[5];
470     wordr1[2] = c_combs[il_pos].i[6];
471     wordr1[3] = c_combs[il_pos].i[7];
472
473     u32 wordr2[4];
474
475     wordr2[0] = 0;
476     wordr2[1] = 0;
477     wordr2[2] = 0;
478     wordr2[3] = 0;
479
480     u32 wordr3[4];
481
482     wordr3[0] = 0;
483     wordr3[1] = 0;
484     wordr3[2] = 0;
485     wordr3[3] = 0;
486
487     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
488     {
489       switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
490     }
491
492     u32x w0[4];
493
494     w0[0] = wordl0[0] | wordr0[0];
495     w0[1] = wordl0[1] | wordr0[1];
496     w0[2] = wordl0[2] | wordr0[2];
497     w0[3] = wordl0[3] | wordr0[3];
498
499     u32x w1[4];
500
501     w1[0] = wordl1[0] | wordr1[0];
502     w1[1] = wordl1[1] | wordr1[1];
503     w1[2] = wordl1[2] | wordr1[2];
504     w1[3] = wordl1[3] | wordr1[3];
505
506     u32x w2[4];
507
508     w2[0] = 0;
509     w2[1] = 0;
510     w2[2] = 0;
511     w2[3] = 0;
512
513     u32x w3[4];
514
515     w3[0] = 0;
516     w3[1] = 0;
517     w3[2] = 0;
518     w3[3] = 0;
519
520     u32x w0_t[4];
521     u32x w1_t[4];
522     u32x w2_t[4];
523     u32x w3_t[4];
524
525     make_unicode (w0, w0_t, w1_t);
526     make_unicode (w1, w2_t, w3_t);
527
528     w3_t[2] = pw_len * 8 * 2;
529
530     u32x a = MD4M_A;
531     u32x b = MD4M_B;
532     u32x c = MD4M_C;
533     u32x d = MD4M_D;
534
535     MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00);
536     MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01);
537     MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02);
538     MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03);
539     MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00);
540     MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01);
541     MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02);
542     MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03);
543     MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00);
544     MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01);
545     MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02);
546     MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03);
547     MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00);
548     MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01);
549     MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02);
550     MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03);
551
552     MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10);
553     MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11);
554     MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12);
555     MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13);
556     MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10);
557     MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11);
558     MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12);
559     MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13);
560     MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10);
561     MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11);
562     MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12);
563     MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13);
564     MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10);
565     MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11);
566     MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12);
567     MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13);
568
569     MD4_STEP (MD4_H , a, b, c, d, w0_t[0], MD4C02, MD4S20);
570     MD4_STEP (MD4_H , d, a, b, c, w2_t[0], MD4C02, MD4S21);
571     MD4_STEP (MD4_H , c, d, a, b, w1_t[0], MD4C02, MD4S22);
572     MD4_STEP (MD4_H , b, c, d, a, w3_t[0], MD4C02, MD4S23);
573     MD4_STEP (MD4_H , a, b, c, d, w0_t[2], MD4C02, MD4S20);
574     MD4_STEP (MD4_H , d, a, b, c, w2_t[2], MD4C02, MD4S21);
575     MD4_STEP (MD4_H , c, d, a, b, w1_t[2], MD4C02, MD4S22);
576     MD4_STEP (MD4_H , b, c, d, a, w3_t[2], MD4C02, MD4S23);
577     MD4_STEP (MD4_H , a, b, c, d, w0_t[1], MD4C02, MD4S20);
578     MD4_STEP (MD4_H , d, a, b, c, w2_t[1], MD4C02, MD4S21);
579     MD4_STEP (MD4_H , c, d, a, b, w1_t[1], MD4C02, MD4S22);
580     MD4_STEP (MD4_H , b, c, d, a, w3_t[1], MD4C02, MD4S23);
581     MD4_STEP (MD4_H , a, b, c, d, w0_t[3], MD4C02, MD4S20);
582     MD4_STEP (MD4_H , d, a, b, c, w2_t[3], MD4C02, MD4S21);
583     MD4_STEP (MD4_H , c, d, a, b, w1_t[3], MD4C02, MD4S22);
584     MD4_STEP (MD4_H , b, c, d, a, w3_t[3], MD4C02, MD4S23);
585
586     a += MD4M_A;
587     b += MD4M_B;
588     c += MD4M_C;
589     d += MD4M_D;
590
591     w0_t[0] = a;
592     w0_t[1] = b;
593     w0_t[2] = c;
594     w0_t[3] = d;
595     w1_t[0] = salt_buf0[0];
596     w1_t[1] = salt_buf0[1];
597     w1_t[2] = salt_buf0[2];
598     w1_t[3] = salt_buf0[3];
599     w2_t[0] = salt_buf1[0];
600     w2_t[1] = salt_buf1[1];
601     w2_t[2] = salt_buf1[2];
602     w2_t[3] = salt_buf1[3];
603     w3_t[0] = salt_buf2[0];
604     w3_t[1] = salt_buf2[1];
605     w3_t[2] = (16 + salt_len) * 8;
606     w3_t[3] = 0;
607
608     a = MD4M_A;
609     b = MD4M_B;
610     c = MD4M_C;
611     d = MD4M_D;
612
613     MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00);
614     MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01);
615     MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02);
616     MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03);
617     MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00);
618     MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01);
619     MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02);
620     MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03);
621     MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00);
622     MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01);
623     MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02);
624     MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03);
625     MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00);
626     MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01);
627     MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02);
628     MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03);
629
630     MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10);
631     MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11);
632     MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12);
633     MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13);
634     MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10);
635     MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11);
636     MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12);
637     MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13);
638     MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10);
639     MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11);
640     MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12);
641     MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13);
642     MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10);
643     MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11);
644     MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12);
645     MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13);
646
647     MD4_STEP (MD4_H , a, b, c, d, w0_t[0], MD4C02, MD4S20);
648     MD4_STEP (MD4_H , d, a, b, c, w2_t[0], MD4C02, MD4S21);
649     MD4_STEP (MD4_H , c, d, a, b, w1_t[0], MD4C02, MD4S22);
650     MD4_STEP (MD4_H , b, c, d, a, w3_t[0], MD4C02, MD4S23);
651     MD4_STEP (MD4_H , a, b, c, d, w0_t[2], MD4C02, MD4S20);
652     MD4_STEP (MD4_H , d, a, b, c, w2_t[2], MD4C02, MD4S21);
653     MD4_STEP (MD4_H , c, d, a, b, w1_t[2], MD4C02, MD4S22);
654     MD4_STEP (MD4_H , b, c, d, a, w3_t[2], MD4C02, MD4S23);
655     MD4_STEP (MD4_H , a, b, c, d, w0_t[1], MD4C02, MD4S20);
656     MD4_STEP (MD4_H , d, a, b, c, w2_t[1], MD4C02, MD4S21);
657     MD4_STEP (MD4_H , c, d, a, b, w1_t[1], MD4C02, MD4S22);
658     MD4_STEP (MD4_H , b, c, d, a, w3_t[1], MD4C02, MD4S23);
659     MD4_STEP (MD4_H , a, b, c, d, w0_t[3], MD4C02, MD4S20);
660
661     bool q_cond = (search[0] != a);
662
663     if (q_cond) continue;
664
665     MD4_STEP (MD4_H , d, a, b, c, w2_t[3], MD4C02, MD4S21);
666     MD4_STEP (MD4_H , c, d, a, b, w1_t[3], MD4C02, MD4S22);
667     MD4_STEP (MD4_H , b, c, d, a, w3_t[3], MD4C02, MD4S23);
668
669     const u32x r0 = a;
670     const u32x r1 = d;
671     const u32x r2 = c;
672     const u32x r3 = b;
673
674     #include VECT_COMPARE_S
675   }
676 }
677
678 extern "C" __global__ void __launch_bounds__ (256, 1) m01100_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)
679 {
680 }
681
682 extern "C" __global__ void __launch_bounds__ (256, 1) m01100_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)
683 {
684 }