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