Initial commit
[hashcat.git] / nv / m11100_a3.cu
1 /**
2  * Author......: Jens Steube <jens.steube@gmail.com>
3  * License.....: MIT
4  */
5
6 #define _MD5_
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__ bf_t c_bfs[1024];
60
61 __device__ static void m11100m (u32x w0[4], u32x w1[4], u32x w2[4], u32x w3[4], const u32 pw_len, 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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset)
62 {
63   /**
64    * modifier
65    */
66
67   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
68   const u32 lid = threadIdx.x;
69
70   /**
71    * challenge
72    */
73
74   u32 challenge;
75
76   challenge = salt_bufs[salt_pos].salt_buf[0];
77
78   /**
79    * salt
80    */
81
82   u32 salt_buf0[4];
83
84   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 1]; // not a bug
85   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 2];
86   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 3];
87   salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 4];
88
89   u32 salt_buf1[4];
90
91   salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 5];
92   salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 6];
93   salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 7];
94   salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 8];
95
96   u32 salt_buf2[4];
97
98   salt_buf2[0] = 0;
99   salt_buf2[1] = 0;
100   salt_buf2[2] = 0;
101   salt_buf2[3] = 0;
102
103   u32 salt_buf3[4];
104
105   salt_buf3[0] = 0;
106   salt_buf3[1] = 0;
107   salt_buf3[2] = 0;
108   salt_buf3[3] = 0;
109
110   const u32 salt_len = salt_bufs[salt_pos].salt_len - 4;
111
112   switch_buffer_by_offset (salt_buf0, salt_buf1, salt_buf2, salt_buf3, pw_len);
113
114   const u32 pw_salt_len = pw_len + salt_len;
115
116   /**
117    * loop
118    */
119
120   u32x w0l = w0[0];
121
122   for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos++)
123   {
124     const u32 w0r = c_bfs[il_pos].i;
125
126     w0[0] = w0l | w0r;
127
128     u32x w0_t[4];
129
130     w0_t[0] = w0[0] | salt_buf0[0];
131     w0_t[1] = w0[1] | salt_buf0[1];
132     w0_t[2] = w0[2] | salt_buf0[2];
133     w0_t[3] = w0[3] | salt_buf0[3];
134
135     u32x w1_t[4];
136
137     w1_t[0] = w1[0] | salt_buf1[0];
138     w1_t[1] = w1[1] | salt_buf1[1];
139     w1_t[2] = w1[2] | salt_buf1[2];
140     w1_t[3] = w1[3] | salt_buf1[3];
141
142     u32x w2_t[4];
143
144     w2_t[0] = w2[0] | salt_buf2[0];
145     w2_t[1] = w2[1] | salt_buf2[1];
146     w2_t[2] = w2[2] | salt_buf2[2];
147     w2_t[3] = w2[3] | salt_buf2[3];
148
149     u32x w3_t[4];
150
151     w3_t[0] = w3[0] | salt_buf3[0];
152     w3_t[1] = w3[1] | salt_buf3[1];
153     w3_t[2] = pw_salt_len * 8;
154     w3_t[3] = 0;
155
156     /*
157      * md5 ($pass.$salt)
158      */
159
160     u32x a = MD5M_A;
161     u32x b = MD5M_B;
162     u32x c = MD5M_C;
163     u32x d = MD5M_D;
164
165     MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
166     MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
167     MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
168     MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
169     MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
170     MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
171     MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
172     MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
173     MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
174     MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
175     MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
176     MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
177     MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
178     MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
179     MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
180     MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
181
182     MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
183     MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
184     MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
185     MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
186     MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
187     MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
188     MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
189     MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
190     MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
191     MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
192     MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
193     MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
194     MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
195     MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
196     MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
197     MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
198
199     MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
200     MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
201     MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
202     MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
203     MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
204     MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
205     MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
206     MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
207     MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
208     MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
209     MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
210     MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
211     MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
212     MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
213     MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
214     MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
215
216     MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
217     MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
218     MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
219     MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
220     MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
221     MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
222     MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
223     MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
224     MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
225     MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
226     MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
227     MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
228     MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
229     MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
230     MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
231     MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
232
233     a += MD5M_A;
234     b += MD5M_B;
235     c += MD5M_C;
236     d += MD5M_D;
237
238     w0_t[0] = uint_to_hex_lower8 ((a >>  0) & 255) <<  0
239             | uint_to_hex_lower8 ((a >>  8) & 255) << 16;
240     w0_t[1] = uint_to_hex_lower8 ((a >> 16) & 255) <<  0
241             | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
242     w0_t[2] = uint_to_hex_lower8 ((b >>  0) & 255) <<  0
243             | uint_to_hex_lower8 ((b >>  8) & 255) << 16;
244     w0_t[3] = uint_to_hex_lower8 ((b >> 16) & 255) <<  0
245             | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
246     w1_t[0] = uint_to_hex_lower8 ((c >>  0) & 255) <<  0
247             | uint_to_hex_lower8 ((c >>  8) & 255) << 16;
248     w1_t[1] = uint_to_hex_lower8 ((c >> 16) & 255) <<  0
249             | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
250     w1_t[2] = uint_to_hex_lower8 ((d >>  0) & 255) <<  0
251             | uint_to_hex_lower8 ((d >>  8) & 255) << 16;
252     w1_t[3] = uint_to_hex_lower8 ((d >> 16) & 255) <<  0
253             | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
254
255     // add the 4 byte challenge here
256
257     w2_t[0] = challenge;
258     w2_t[1] = 0x00000080;
259     w2_t[2] = 0;
260     w2_t[3] = 0;
261
262     w3_t[0] = 0;
263     w3_t[1] = 0;
264     w3_t[2] = (32 + 4) * 8;
265     w3_t[3] = 0;
266
267     /**
268      * md5 ($hash.$challenge)
269      */
270
271     a = MD5M_A;
272     b = MD5M_B;
273     c = MD5M_C;
274     d = MD5M_D;
275
276     MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
277     MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
278     MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
279     MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
280     MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
281     MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
282     MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
283     MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
284     MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
285     MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
286     MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
287     MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
288     MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
289     MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
290     MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
291     MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
292
293     MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
294     MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
295     MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
296     MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
297     MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
298     MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
299     MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
300     MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
301     MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
302     MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
303     MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
304     MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
305     MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
306     MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
307     MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
308     MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
309
310     MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
311     MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
312     MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
313     MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
314     MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
315     MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
316     MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
317     MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
318     MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
319     MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
320     MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
321     MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
322     MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
323     MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
324     MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
325     MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
326
327     MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
328     MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
329     MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
330     MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
331     MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
332     MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
333     MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
334     MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
335     MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
336     MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
337     MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
338     MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
339     MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
340     MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
341     MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
342     MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
343
344     const u32x r0 = a;
345     const u32x r1 = d;
346     const u32x r2 = c;
347     const u32x r3 = b;
348
349     #include VECT_COMPARE_M
350   }
351 }
352
353 __device__ static void m11100s (u32x w0[4], u32x w1[4], u32x w2[4], u32x w3[4], const u32 pw_len, 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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset)
354 {
355   /**
356    * modifier
357    */
358
359   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
360   const u32 lid = threadIdx.x;
361
362   /**
363    * digest
364    */
365
366   const u32 search[4] =
367   {
368     digests_buf[digests_offset].digest_buf[DGST_R0],
369     digests_buf[digests_offset].digest_buf[DGST_R1],
370     digests_buf[digests_offset].digest_buf[DGST_R2],
371     digests_buf[digests_offset].digest_buf[DGST_R3]
372   };
373
374   /**
375    * challenge
376    */
377
378   u32 challenge;
379
380   challenge = salt_bufs[salt_pos].salt_buf[0];
381
382   /**
383    * salt
384    */
385
386   u32 salt_buf0[4];
387
388   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 1]; // not a bug
389   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 2];
390   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 3];
391   salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 4];
392
393   u32 salt_buf1[4];
394
395   salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 5];
396   salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 6];
397   salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 7];
398   salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 8];
399
400   u32 salt_buf2[4];
401
402   salt_buf2[0] = 0;
403   salt_buf2[1] = 0;
404   salt_buf2[2] = 0;
405   salt_buf2[3] = 0;
406
407   u32 salt_buf3[4];
408
409   salt_buf3[0] = 0;
410   salt_buf3[1] = 0;
411   salt_buf3[2] = 0;
412   salt_buf3[3] = 0;
413
414   const u32 salt_len = salt_bufs[salt_pos].salt_len - 4;
415
416   switch_buffer_by_offset (salt_buf0, salt_buf1, salt_buf2, salt_buf3, pw_len);
417
418   const u32 pw_salt_len = pw_len + salt_len;
419
420   /**
421    * loop
422    */
423
424   u32x w0l = w0[0];
425
426   for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos++)
427   {
428     const u32 w0r = c_bfs[il_pos].i;
429
430     w0[0] = w0l | w0r;
431
432     u32x w0_t[4];
433
434     w0_t[0] = w0[0] | salt_buf0[0];
435     w0_t[1] = w0[1] | salt_buf0[1];
436     w0_t[2] = w0[2] | salt_buf0[2];
437     w0_t[3] = w0[3] | salt_buf0[3];
438
439     u32x w1_t[4];
440
441     w1_t[0] = w1[0] | salt_buf1[0];
442     w1_t[1] = w1[1] | salt_buf1[1];
443     w1_t[2] = w1[2] | salt_buf1[2];
444     w1_t[3] = w1[3] | salt_buf1[3];
445
446     u32x w2_t[4];
447
448     w2_t[0] = w2[0] | salt_buf2[0];
449     w2_t[1] = w2[1] | salt_buf2[1];
450     w2_t[2] = w2[2] | salt_buf2[2];
451     w2_t[3] = w2[3] | salt_buf2[3];
452
453     u32x w3_t[4];
454
455     w3_t[0] = w3[0] | salt_buf3[0];
456     w3_t[1] = w3[1] | salt_buf3[1];
457     w3_t[2] = pw_salt_len * 8;
458     w3_t[3] = 0;
459
460     /*
461      * md5 ($pass.$salt)
462      */
463
464     u32x a = MD5M_A;
465     u32x b = MD5M_B;
466     u32x c = MD5M_C;
467     u32x d = MD5M_D;
468
469     MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
470     MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
471     MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
472     MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
473     MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
474     MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
475     MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
476     MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
477     MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
478     MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
479     MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
480     MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
481     MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
482     MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
483     MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
484     MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
485
486     MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
487     MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
488     MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
489     MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
490     MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
491     MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
492     MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
493     MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
494     MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
495     MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
496     MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
497     MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
498     MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
499     MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
500     MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
501     MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
502
503     MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
504     MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
505     MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
506     MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
507     MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
508     MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
509     MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
510     MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
511     MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
512     MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
513     MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
514     MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
515     MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
516     MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
517     MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
518     MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
519
520     MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
521     MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
522     MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
523     MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
524     MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
525     MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
526     MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
527     MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
528     MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
529     MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
530     MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
531     MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
532     MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
533     MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
534     MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
535     MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
536
537     a += MD5M_A;
538     b += MD5M_B;
539     c += MD5M_C;
540     d += MD5M_D;
541
542     w0_t[0] = uint_to_hex_lower8 ((a >>  0) & 255) <<  0
543             | uint_to_hex_lower8 ((a >>  8) & 255) << 16;
544     w0_t[1] = uint_to_hex_lower8 ((a >> 16) & 255) <<  0
545             | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
546     w0_t[2] = uint_to_hex_lower8 ((b >>  0) & 255) <<  0
547             | uint_to_hex_lower8 ((b >>  8) & 255) << 16;
548     w0_t[3] = uint_to_hex_lower8 ((b >> 16) & 255) <<  0
549             | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
550     w1_t[0] = uint_to_hex_lower8 ((c >>  0) & 255) <<  0
551             | uint_to_hex_lower8 ((c >>  8) & 255) << 16;
552     w1_t[1] = uint_to_hex_lower8 ((c >> 16) & 255) <<  0
553             | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
554     w1_t[2] = uint_to_hex_lower8 ((d >>  0) & 255) <<  0
555             | uint_to_hex_lower8 ((d >>  8) & 255) << 16;
556     w1_t[3] = uint_to_hex_lower8 ((d >> 16) & 255) <<  0
557             | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
558
559     // add the 4 byte challenge here
560
561     w2_t[0] = challenge;
562     w2_t[1] = 0x00000080;
563     w2_t[2] = 0;
564     w2_t[3] = 0;
565
566     w3_t[0] = 0;
567     w3_t[1] = 0;
568     w3_t[2] = (32 + 4) * 8;
569     w3_t[3] = 0;
570
571     /**
572      * md5 ($hash.$challenge)
573      */
574
575     a = MD5M_A;
576     b = MD5M_B;
577     c = MD5M_C;
578     d = MD5M_D;
579
580     MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
581     MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
582     MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
583     MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
584     MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
585     MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
586     MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
587     MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
588     MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
589     MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
590     MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
591     MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
592     MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
593     MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
594     MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
595     MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
596
597     MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
598     MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
599     MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
600     MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
601     MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
602     MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
603     MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
604     MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
605     MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
606     MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
607     MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
608     MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
609     MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
610     MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
611     MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
612     MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
613
614     MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
615     MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
616     MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
617     MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
618     MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
619     MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
620     MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
621     MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
622     MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
623     MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
624     MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
625     MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
626     MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
627     MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
628     MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
629     MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
630
631     MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
632     MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
633     MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
634     MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
635     MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
636     MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
637     MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
638     MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
639     MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
640     MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
641     MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
642     MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
643     MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
644     MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
645     MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
646     MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
647
648     const u32x r0 = a;
649     const u32x r1 = d;
650     const u32x r2 = c;
651     const u32x r3 = b;
652
653     #include VECT_COMPARE_S
654   }
655 }
656
657 extern "C" __global__ void __launch_bounds__ (256, 1) m11100_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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
658 {
659   /**
660    * base
661    */
662
663   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
664
665   /**
666    * modifier
667    */
668
669   const u32 lid = threadIdx.x;
670
671   u32x w0[4];
672
673   w0[0] = pws[gid].i[ 0];
674   w0[1] = pws[gid].i[ 1];
675   w0[2] = pws[gid].i[ 2];
676   w0[3] = pws[gid].i[ 3];
677
678   u32x w1[4];
679
680   w1[0] = 0;
681   w1[1] = 0;
682   w1[2] = 0;
683   w1[3] = 0;
684
685   u32x w2[4];
686
687   w2[0] = 0;
688   w2[1] = 0;
689   w2[2] = 0;
690   w2[3] = 0;
691
692   u32x w3[4];
693
694   w3[0] = 0;
695   w3[1] = 0;
696   w3[2] = pws[gid].i[14];
697   w3[3] = 0;
698
699   const u32 pw_len = pws[gid].pw_len;
700
701   /**
702    * bin2asc table
703    */
704
705   l_bin2asc[lid] = c_bin2asc[(lid >> 0) & 15] << 8
706                  | c_bin2asc[(lid >> 4) & 15] << 0;
707
708   __syncthreads ();
709
710   if (gid >= gid_max) return;
711
712   /**
713    * main
714    */
715
716   m11100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
717 }
718
719 extern "C" __global__ void __launch_bounds__ (256, 1) m11100_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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
720 {
721   /**
722    * base
723    */
724
725   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
726
727   /**
728    * modifier
729    */
730
731   const u32 lid = threadIdx.x;
732
733   u32x w0[4];
734
735   w0[0] = pws[gid].i[ 0];
736   w0[1] = pws[gid].i[ 1];
737   w0[2] = pws[gid].i[ 2];
738   w0[3] = pws[gid].i[ 3];
739
740   u32x w1[4];
741
742   w1[0] = pws[gid].i[ 4];
743   w1[1] = pws[gid].i[ 5];
744   w1[2] = pws[gid].i[ 6];
745   w1[3] = pws[gid].i[ 7];
746
747   u32x w2[4];
748
749   w2[0] = 0;
750   w2[1] = 0;
751   w2[2] = 0;
752   w2[3] = 0;
753
754   u32x w3[4];
755
756   w3[0] = 0;
757   w3[1] = 0;
758   w3[2] = pws[gid].i[14];
759   w3[3] = 0;
760
761   const u32 pw_len = pws[gid].pw_len;
762
763   /**
764    * bin2asc table
765    */
766
767   l_bin2asc[lid] = c_bin2asc[(lid >> 0) & 15] << 8
768                  | c_bin2asc[(lid >> 4) & 15] << 0;
769
770   __syncthreads ();
771
772   if (gid >= gid_max) return;
773
774   /**
775    * main
776    */
777
778   m11100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
779 }
780
781 extern "C" __global__ void __launch_bounds__ (256, 1) m11100_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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
782 {
783   /**
784    * base
785    */
786
787   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
788
789   /**
790    * modifier
791    */
792
793   const u32 lid = threadIdx.x;
794
795   u32x w0[4];
796
797   w0[0] = pws[gid].i[ 0];
798   w0[1] = pws[gid].i[ 1];
799   w0[2] = pws[gid].i[ 2];
800   w0[3] = pws[gid].i[ 3];
801
802   u32x w1[4];
803
804   w1[0] = pws[gid].i[ 4];
805   w1[1] = pws[gid].i[ 5];
806   w1[2] = pws[gid].i[ 6];
807   w1[3] = pws[gid].i[ 7];
808
809   u32x w2[4];
810
811   w2[0] = pws[gid].i[ 8];
812   w2[1] = pws[gid].i[ 9];
813   w2[2] = pws[gid].i[10];
814   w2[3] = pws[gid].i[11];
815
816   u32x w3[4];
817
818   w3[0] = pws[gid].i[12];
819   w3[1] = pws[gid].i[13];
820   w3[2] = pws[gid].i[14];
821   w3[3] = pws[gid].i[15];
822
823   const u32 pw_len = pws[gid].pw_len;
824
825   /**
826    * bin2asc table
827    */
828
829   l_bin2asc[lid] = c_bin2asc[(lid >> 0) & 15] << 8
830                  | c_bin2asc[(lid >> 4) & 15] << 0;
831
832   __syncthreads ();
833
834   if (gid >= gid_max) return;
835
836   /**
837    * main
838    */
839
840   m11100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
841 }
842
843 extern "C" __global__ void __launch_bounds__ (256, 1) m11100_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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
844 {
845   /**
846    * base
847    */
848
849   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
850
851   /**
852    * modifier
853    */
854
855   const u32 lid = threadIdx.x;
856
857   u32x w0[4];
858
859   w0[0] = pws[gid].i[ 0];
860   w0[1] = pws[gid].i[ 1];
861   w0[2] = pws[gid].i[ 2];
862   w0[3] = pws[gid].i[ 3];
863
864   u32x w1[4];
865
866   w1[0] = 0;
867   w1[1] = 0;
868   w1[2] = 0;
869   w1[3] = 0;
870
871   u32x w2[4];
872
873   w2[0] = 0;
874   w2[1] = 0;
875   w2[2] = 0;
876   w2[3] = 0;
877
878   u32x w3[4];
879
880   w3[0] = 0;
881   w3[1] = 0;
882   w3[2] = pws[gid].i[14];
883   w3[3] = 0;
884
885   const u32 pw_len = pws[gid].pw_len;
886
887   /**
888    * bin2asc table
889    */
890
891   l_bin2asc[lid] = c_bin2asc[(lid >> 0) & 15] << 8
892                  | c_bin2asc[(lid >> 4) & 15] << 0;
893
894   __syncthreads ();
895
896   if (gid >= gid_max) return;
897
898   /**
899    * main
900    */
901
902   m11100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
903 }
904
905 extern "C" __global__ void __launch_bounds__ (256, 1) m11100_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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
906 {
907   /**
908    * base
909    */
910
911   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
912
913   /**
914    * modifier
915    */
916
917   const u32 lid = threadIdx.x;
918
919   u32x w0[4];
920
921   w0[0] = pws[gid].i[ 0];
922   w0[1] = pws[gid].i[ 1];
923   w0[2] = pws[gid].i[ 2];
924   w0[3] = pws[gid].i[ 3];
925
926   u32x w1[4];
927
928   w1[0] = pws[gid].i[ 4];
929   w1[1] = pws[gid].i[ 5];
930   w1[2] = pws[gid].i[ 6];
931   w1[3] = pws[gid].i[ 7];
932
933   u32x w2[4];
934
935   w2[0] = 0;
936   w2[1] = 0;
937   w2[2] = 0;
938   w2[3] = 0;
939
940   u32x w3[4];
941
942   w3[0] = 0;
943   w3[1] = 0;
944   w3[2] = pws[gid].i[14];
945   w3[3] = 0;
946
947   const u32 pw_len = pws[gid].pw_len;
948
949   /**
950    * bin2asc table
951    */
952
953   l_bin2asc[lid] = c_bin2asc[(lid >> 0) & 15] << 8
954                  | c_bin2asc[(lid >> 4) & 15] << 0;
955
956   __syncthreads ();
957
958   if (gid >= gid_max) return;
959
960   /**
961    * main
962    */
963
964   m11100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
965 }
966
967 extern "C" __global__ void __launch_bounds__ (256, 1) m11100_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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
968 {
969   /**
970    * base
971    */
972
973   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
974
975   /**
976    * modifier
977    */
978
979   const u32 lid = threadIdx.x;
980
981   u32x w0[4];
982
983   w0[0] = pws[gid].i[ 0];
984   w0[1] = pws[gid].i[ 1];
985   w0[2] = pws[gid].i[ 2];
986   w0[3] = pws[gid].i[ 3];
987
988   u32x w1[4];
989
990   w1[0] = pws[gid].i[ 4];
991   w1[1] = pws[gid].i[ 5];
992   w1[2] = pws[gid].i[ 6];
993   w1[3] = pws[gid].i[ 7];
994
995   u32x w2[4];
996
997   w2[0] = pws[gid].i[ 8];
998   w2[1] = pws[gid].i[ 9];
999   w2[2] = pws[gid].i[10];
1000   w2[3] = pws[gid].i[11];
1001
1002   u32x w3[4];
1003
1004   w3[0] = pws[gid].i[12];
1005   w3[1] = pws[gid].i[13];
1006   w3[2] = pws[gid].i[14];
1007   w3[3] = pws[gid].i[15];
1008
1009   const u32 pw_len = pws[gid].pw_len;
1010
1011   /**
1012    * bin2asc table
1013    */
1014
1015   l_bin2asc[lid] = c_bin2asc[(lid >> 0) & 15] << 8
1016                  | c_bin2asc[(lid >> 4) & 15] << 0;
1017
1018   __syncthreads ();
1019
1020   if (gid >= gid_max) return;
1021
1022   /**
1023    * main
1024    */
1025
1026   m11100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
1027 }