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