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