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