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