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