Fix mode 100 attack 3 with mangling
[hashcat.git] / OpenCL / m00100_a3_m.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 #include "mangle.cl"
17
18 void m00100m (u32 w[16], const u32 pw_len, __global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __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)
19 {
20   /**
21    * modifier
22    */
23
24   const u32 gid = get_global_id (0);
25   const u32 lid = get_local_id (0);
26
27   /**
28    * loop
29    */
30
31   u32 w0l = w[0];
32
33   u32x w0[4];
34   u32x w1[4];
35   u32x w2[4];
36   u32x w3[4];
37
38   for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
39   {
40     const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
41
42     //const u32x w0 = w0l | w0r;
43
44     w0[0] = swap32 (w0l | w0r);
45     w0[1] = swap32 (w[1]);
46     w0[2] = swap32 (w[2]);
47     w0[3] = swap32 (w[3]);
48     w1[0] = swap32 (w[4]);
49     w1[1] = swap32 (w[5]);
50     w1[2] = swap32 (w[6]);
51     w1[3] = swap32 (w[7]);
52     w2[0] = swap32 (w[8]);
53     w2[1] = swap32 (w[9]);
54     w2[2] = swap32 (w[10]);
55     w2[3] = swap32 (w[11]);
56     w3[0] = swap32 (w[12]);
57     w3[1] = swap32 (w[13]);
58     w3[2] = swap32 (w[14]);
59     w3[3] = swap32 (w[15]);
60
61     const u32 out_len = mangle(w0, w1, pw_len);
62     append_0x80_2x4_VV (w0, w1, out_len);
63
64     /**
65      * sha1
66      */
67
68     u32x w0_t = swap32 (w0[0]);
69     u32x w1_t = swap32 (w0[1]);
70     u32x w2_t = swap32 (w0[2]);
71     u32x w3_t = swap32 (w0[3]);
72     u32x w4_t = swap32 (w1[0]);
73     u32x w5_t = swap32 (w1[1]);
74     u32x w6_t = swap32 (w1[2]);
75     u32x w7_t = swap32 (w1[3]);
76     u32x w8_t = swap32 (w2[0]);
77     u32x w9_t = swap32 (w2[1]);
78     u32x wa_t = swap32 (w2[2]);
79     u32x wb_t = swap32 (w2[3]);
80     u32x wc_t = swap32 (w3[0]);
81     u32x wd_t = swap32 (w3[1]);
82     u32x we_t = 0;
83     u32x wf_t = out_len * 8;
84
85     u32x a = SHA1M_A;
86     u32x b = SHA1M_B;
87     u32x c = SHA1M_C;
88     u32x d = SHA1M_D;
89     u32x e = SHA1M_E;
90
91     #undef K
92     #define K SHA1C00
93
94     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
95     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
96     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
97     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
98     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
99     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
100     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
101     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
102     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
103     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
104     SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
105     SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
106     SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
107     SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
108     SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
109     SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
110     w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
111     w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
112     w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
113     w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
114
115     #undef K
116     #define K SHA1C01
117
118     w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
119     w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
120     w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
121     w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
122     w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
123     w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
124     wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
125     wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
126     wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
127     wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
128     we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
129     wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
130     w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
131     w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
132     w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
133     w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
134     w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
135     w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
136     w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
137     w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
138
139     #undef K
140     #define K SHA1C02
141
142     w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
143     w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
144     wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
145     wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
146     wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
147     wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
148     we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
149     wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
150     w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
151     w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
152     w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
153     w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
154     w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
155     w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
156     w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
157     w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
158     w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
159     w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
160     wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
161     wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
162
163     #undef K
164     #define K SHA1C03
165
166     wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
167     wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
168     we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
169     wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
170     w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
171     w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
172     w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
173     w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
174     w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
175     w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
176     w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
177     w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
178     w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
179     w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
180     wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
181     wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
182     wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
183     wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
184     we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
185     wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
186
187     COMPARE_M_SIMD (d, e, c, b);
188   }
189 }
190
191
192
193
194
195
196
197 void m00100m_orig (u32 w[16], const u32 pw_len, __global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __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)
198 {
199   /**
200    * modifier
201    */
202
203   const u32 gid = get_global_id (0);
204   const u32 lid = get_local_id (0);
205
206   /**
207    * base
208    */
209
210   const u32 c_16s = rotl32_S ((w[13] ^ w[ 8] ^ w[ 2]        ), 1u);
211   const u32 c_17s = rotl32_S ((w[14] ^ w[ 9] ^ w[ 3] ^ w[ 1]), 1u);
212   const u32 c_18s = rotl32_S ((w[15] ^ w[10] ^ w[ 4] ^ w[ 2]), 1u);
213   const u32 c_19s = rotl32_S ((c_16s ^ w[11] ^ w[ 5] ^ w[ 3]), 1u);
214   const u32 c_20s = rotl32_S ((c_17s ^ w[12] ^ w[ 6] ^ w[ 4]), 1u);
215   const u32 c_21s = rotl32_S ((c_18s ^ w[13] ^ w[ 7] ^ w[ 5]), 1u);
216   const u32 c_22s = rotl32_S ((c_19s ^ w[14] ^ w[ 8] ^ w[ 6]), 1u);
217   const u32 c_23s = rotl32_S ((c_20s ^ w[15] ^ w[ 9] ^ w[ 7]), 1u);
218   const u32 c_24s = rotl32_S ((c_21s ^ c_16s ^ w[10] ^ w[ 8]), 1u);
219   const u32 c_25s = rotl32_S ((c_22s ^ c_17s ^ w[11] ^ w[ 9]), 1u);
220   const u32 c_26s = rotl32_S ((c_23s ^ c_18s ^ w[12] ^ w[10]), 1u);
221   const u32 c_27s = rotl32_S ((c_24s ^ c_19s ^ w[13] ^ w[11]), 1u);
222   const u32 c_28s = rotl32_S ((c_25s ^ c_20s ^ w[14] ^ w[12]), 1u);
223   const u32 c_29s = rotl32_S ((c_26s ^ c_21s ^ w[15] ^ w[13]), 1u);
224   const u32 c_30s = rotl32_S ((c_27s ^ c_22s ^ c_16s ^ w[14]), 1u);
225   const u32 c_31s = rotl32_S ((c_28s ^ c_23s ^ c_17s ^ w[15]), 1u);
226   const u32 c_32s = rotl32_S ((c_29s ^ c_24s ^ c_18s ^ c_16s), 1u);
227   const u32 c_33s = rotl32_S ((c_30s ^ c_25s ^ c_19s ^ c_17s), 1u);
228   const u32 c_34s = rotl32_S ((c_31s ^ c_26s ^ c_20s ^ c_18s), 1u);
229   const u32 c_35s = rotl32_S ((c_32s ^ c_27s ^ c_21s ^ c_19s), 1u);
230   const u32 c_36s = rotl32_S ((c_33s ^ c_28s ^ c_22s ^ c_20s), 1u);
231   const u32 c_37s = rotl32_S ((c_34s ^ c_29s ^ c_23s ^ c_21s), 1u);
232   const u32 c_38s = rotl32_S ((c_35s ^ c_30s ^ c_24s ^ c_22s), 1u);
233   const u32 c_39s = rotl32_S ((c_36s ^ c_31s ^ c_25s ^ c_23s), 1u);
234   const u32 c_40s = rotl32_S ((c_37s ^ c_32s ^ c_26s ^ c_24s), 1u);
235   const u32 c_41s = rotl32_S ((c_38s ^ c_33s ^ c_27s ^ c_25s), 1u);
236   const u32 c_42s = rotl32_S ((c_39s ^ c_34s ^ c_28s ^ c_26s), 1u);
237   const u32 c_43s = rotl32_S ((c_40s ^ c_35s ^ c_29s ^ c_27s), 1u);
238   const u32 c_44s = rotl32_S ((c_41s ^ c_36s ^ c_30s ^ c_28s), 1u);
239   const u32 c_45s = rotl32_S ((c_42s ^ c_37s ^ c_31s ^ c_29s), 1u);
240   const u32 c_46s = rotl32_S ((c_43s ^ c_38s ^ c_32s ^ c_30s), 1u);
241   const u32 c_47s = rotl32_S ((c_44s ^ c_39s ^ c_33s ^ c_31s), 1u);
242   const u32 c_48s = rotl32_S ((c_45s ^ c_40s ^ c_34s ^ c_32s), 1u);
243   const u32 c_49s = rotl32_S ((c_46s ^ c_41s ^ c_35s ^ c_33s), 1u);
244   const u32 c_50s = rotl32_S ((c_47s ^ c_42s ^ c_36s ^ c_34s), 1u);
245   const u32 c_51s = rotl32_S ((c_48s ^ c_43s ^ c_37s ^ c_35s), 1u);
246   const u32 c_52s = rotl32_S ((c_49s ^ c_44s ^ c_38s ^ c_36s), 1u);
247   const u32 c_53s = rotl32_S ((c_50s ^ c_45s ^ c_39s ^ c_37s), 1u);
248   const u32 c_54s = rotl32_S ((c_51s ^ c_46s ^ c_40s ^ c_38s), 1u);
249   const u32 c_55s = rotl32_S ((c_52s ^ c_47s ^ c_41s ^ c_39s), 1u);
250   const u32 c_56s = rotl32_S ((c_53s ^ c_48s ^ c_42s ^ c_40s), 1u);
251   const u32 c_57s = rotl32_S ((c_54s ^ c_49s ^ c_43s ^ c_41s), 1u);
252   const u32 c_58s = rotl32_S ((c_55s ^ c_50s ^ c_44s ^ c_42s), 1u);
253   const u32 c_59s = rotl32_S ((c_56s ^ c_51s ^ c_45s ^ c_43s), 1u);
254   const u32 c_60s = rotl32_S ((c_57s ^ c_52s ^ c_46s ^ c_44s), 1u);
255   const u32 c_61s = rotl32_S ((c_58s ^ c_53s ^ c_47s ^ c_45s), 1u);
256   const u32 c_62s = rotl32_S ((c_59s ^ c_54s ^ c_48s ^ c_46s), 1u);
257   const u32 c_63s = rotl32_S ((c_60s ^ c_55s ^ c_49s ^ c_47s), 1u);
258   const u32 c_64s = rotl32_S ((c_61s ^ c_56s ^ c_50s ^ c_48s), 1u);
259   const u32 c_65s = rotl32_S ((c_62s ^ c_57s ^ c_51s ^ c_49s), 1u);
260   const u32 c_66s = rotl32_S ((c_63s ^ c_58s ^ c_52s ^ c_50s), 1u);
261   const u32 c_67s = rotl32_S ((c_64s ^ c_59s ^ c_53s ^ c_51s), 1u);
262   const u32 c_68s = rotl32_S ((c_65s ^ c_60s ^ c_54s ^ c_52s), 1u);
263   const u32 c_69s = rotl32_S ((c_66s ^ c_61s ^ c_55s ^ c_53s), 1u);
264   const u32 c_70s = rotl32_S ((c_67s ^ c_62s ^ c_56s ^ c_54s), 1u);
265   const u32 c_71s = rotl32_S ((c_68s ^ c_63s ^ c_57s ^ c_55s), 1u);
266   const u32 c_72s = rotl32_S ((c_69s ^ c_64s ^ c_58s ^ c_56s), 1u);
267   const u32 c_73s = rotl32_S ((c_70s ^ c_65s ^ c_59s ^ c_57s), 1u);
268   const u32 c_74s = rotl32_S ((c_71s ^ c_66s ^ c_60s ^ c_58s), 1u);
269   const u32 c_75s = rotl32_S ((c_72s ^ c_67s ^ c_61s ^ c_59s), 1u);
270
271   const u32 c_17sK = c_17s + SHA1C00;
272   const u32 c_18sK = c_18s + SHA1C00;
273   const u32 c_20sK = c_20s + SHA1C01;
274   const u32 c_21sK = c_21s + SHA1C01;
275   const u32 c_23sK = c_23s + SHA1C01;
276   const u32 c_26sK = c_26s + SHA1C01;
277   const u32 c_27sK = c_27s + SHA1C01;
278   const u32 c_29sK = c_29s + SHA1C01;
279   const u32 c_33sK = c_33s + SHA1C01;
280   const u32 c_39sK = c_39s + SHA1C01;
281   const u32 c_41sK = c_41s + SHA1C02;
282   const u32 c_45sK = c_45s + SHA1C02;
283   const u32 c_53sK = c_53s + SHA1C02;
284   const u32 c_65sK = c_65s + SHA1C03;
285   const u32 c_69sK = c_69s + SHA1C03;
286
287   /**
288    * loop
289    */
290
291   u32 w0l = w[0];
292
293   for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
294   {
295     const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
296
297     const u32x w0 = w0l | w0r;
298
299     const u32x w0s01 = rotl32 (w0, 1u);
300     const u32x w0s02 = rotl32 (w0, 2u);
301     const u32x w0s03 = rotl32 (w0, 3u);
302     const u32x w0s04 = rotl32 (w0, 4u);
303     const u32x w0s05 = rotl32 (w0, 5u);
304     const u32x w0s06 = rotl32 (w0, 6u);
305     const u32x w0s07 = rotl32 (w0, 7u);
306     const u32x w0s08 = rotl32 (w0, 8u);
307     const u32x w0s09 = rotl32 (w0, 9u);
308     const u32x w0s10 = rotl32 (w0, 10u);
309     const u32x w0s11 = rotl32 (w0, 11u);
310     const u32x w0s12 = rotl32 (w0, 12u);
311     const u32x w0s13 = rotl32 (w0, 13u);
312     const u32x w0s14 = rotl32 (w0, 14u);
313     const u32x w0s15 = rotl32 (w0, 15u);
314     const u32x w0s16 = rotl32 (w0, 16u);
315     const u32x w0s17 = rotl32 (w0, 17u);
316     const u32x w0s18 = rotl32 (w0, 18u);
317     const u32x w0s19 = rotl32 (w0, 19u);
318     const u32x w0s20 = rotl32 (w0, 20u);
319
320     const u32x w0s04___w0s06 = w0s04 ^ w0s06;
321     const u32x w0s04___w0s08 = w0s04 ^ w0s08;
322     const u32x w0s08___w0s12 = w0s08 ^ w0s12;
323     const u32x w0s04___w0s06___w0s07 = w0s04___w0s06 ^ w0s07;
324
325     u32x a = SHA1M_A;
326     u32x b = SHA1M_B;
327     u32x c = SHA1M_C;
328     u32x d = SHA1M_D;
329     u32x e = SHA1M_E;
330
331     #undef K
332     #define K SHA1C00
333
334     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0);
335     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w[ 1]);
336     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w[ 2]);
337     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w[ 3]);
338     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w[ 4]);
339     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w[ 5]);
340     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w[ 6]);
341     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w[ 7]);
342     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w[ 8]);
343     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w[ 9]);
344     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w[10]);
345     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w[11]);
346     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w[12]);
347     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w[13]);
348     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w[14]);
349     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w[15]);
350
351     SHA1_STEP (SHA1_F0o, e, a, b, c, d, (c_16s ^ w0s01));
352     SHA1_STEPX(SHA1_F0o, d, e, a, b, c, (c_17sK));
353     SHA1_STEPX(SHA1_F0o, c, d, e, a, b, (c_18sK));
354     SHA1_STEP (SHA1_F0o, b, c, d, e, a, (c_19s ^ w0s02));
355
356     #undef K
357     #define K SHA1C01
358
359     SHA1_STEPX(SHA1_F1 , a, b, c, d, e, (c_20sK));
360     SHA1_STEPX(SHA1_F1 , e, a, b, c, d, (c_21sK));
361     SHA1_STEP (SHA1_F1 , d, e, a, b, c, (c_22s ^ w0s03));
362     SHA1_STEPX(SHA1_F1 , c, d, e, a, b, (c_23sK));
363     SHA1_STEP (SHA1_F1 , b, c, d, e, a, (c_24s ^ w0s02));
364     SHA1_STEP (SHA1_F1 , a, b, c, d, e, (c_25s ^ w0s04));
365     SHA1_STEPX(SHA1_F1 , e, a, b, c, d, (c_26sK));
366     SHA1_STEPX(SHA1_F1 , d, e, a, b, c, (c_27sK));
367     SHA1_STEP (SHA1_F1 , c, d, e, a, b, (c_28s ^ w0s05));
368     SHA1_STEPX(SHA1_F1 , b, c, d, e, a, (c_29sK));
369     SHA1_STEP (SHA1_F1 , a, b, c, d, e, (c_30s ^ w0s02 ^ w0s04));
370     SHA1_STEP (SHA1_F1 , e, a, b, c, d, (c_31s ^ w0s06));
371     SHA1_STEP (SHA1_F1 , d, e, a, b, c, (c_32s ^ w0s02 ^ w0s03));
372     SHA1_STEPX(SHA1_F1 , c, d, e, a, b, (c_33sK));
373     SHA1_STEP (SHA1_F1 , b, c, d, e, a, (c_34s ^ w0s07));
374     SHA1_STEP (SHA1_F1 , a, b, c, d, e, (c_35s ^ w0s04));
375     SHA1_STEP (SHA1_F1 , e, a, b, c, d, (c_36s ^ w0s04___w0s06));
376     SHA1_STEP (SHA1_F1 , d, e, a, b, c, (c_37s ^ w0s08));
377     SHA1_STEP (SHA1_F1 , c, d, e, a, b, (c_38s ^ w0s04));
378     SHA1_STEPX(SHA1_F1 , b, c, d, e, a, (c_39sK));
379
380     #undef K
381     #define K SHA1C02
382
383     SHA1_STEP (SHA1_F2o, a, b, c, d, e, (c_40s ^ w0s04 ^ w0s09));
384     SHA1_STEPX(SHA1_F2o, e, a, b, c, d, (c_41sK));
385     SHA1_STEP (SHA1_F2o, d, e, a, b, c, (c_42s ^ w0s06 ^ w0s08));
386     SHA1_STEP (SHA1_F2o, c, d, e, a, b, (c_43s ^ w0s10));
387     SHA1_STEP (SHA1_F2o, b, c, d, e, a, (c_44s ^ w0s03 ^ w0s06 ^ w0s07));
388     SHA1_STEPX(SHA1_F2o, a, b, c, d, e, (c_45sK));
389     SHA1_STEP (SHA1_F2o, e, a, b, c, d, (c_46s ^ w0s04 ^ w0s11));
390     SHA1_STEP (SHA1_F2o, d, e, a, b, c, (c_47s ^ w0s04___w0s08));
391     SHA1_STEP (SHA1_F2o, c, d, e, a, b, (c_48s ^ w0s03 ^ w0s04___w0s08 ^ w0s05 ^ w0s10));
392     SHA1_STEP (SHA1_F2o, b, c, d, e, a, (c_49s ^ w0s12));
393     SHA1_STEP (SHA1_F2o, a, b, c, d, e, (c_50s ^ w0s08));
394     SHA1_STEP (SHA1_F2o, e, a, b, c, d, (c_51s ^ w0s04___w0s06));
395     SHA1_STEP (SHA1_F2o, d, e, a, b, c, (c_52s ^ w0s04___w0s08 ^ w0s13));
396     SHA1_STEPX(SHA1_F2o, c, d, e, a, b, (c_53sK));
397     SHA1_STEP (SHA1_F2o, b, c, d, e, a, (c_54s ^ w0s07 ^ w0s10 ^ w0s12));
398     SHA1_STEP (SHA1_F2o, a, b, c, d, e, (c_55s ^ w0s14));
399     SHA1_STEP (SHA1_F2o, e, a, b, c, d, (c_56s ^ w0s04___w0s06___w0s07 ^ w0s10 ^ w0s11));
400     SHA1_STEP (SHA1_F2o, d, e, a, b, c, (c_57s ^ w0s08));
401     SHA1_STEP (SHA1_F2o, c, d, e, a, b, (c_58s ^ w0s04___w0s08 ^ w0s15));
402     SHA1_STEP (SHA1_F2o, b, c, d, e, a, (c_59s ^ w0s08___w0s12));
403
404     #undef K
405     #define K SHA1C03
406
407     SHA1_STEP (SHA1_F1 , a, b, c, d, e, (c_60s ^ w0s04 ^ w0s08___w0s12 ^ w0s07 ^ w0s14));
408     SHA1_STEP (SHA1_F1 , e, a, b, c, d, (c_61s ^ w0s16));
409     SHA1_STEP (SHA1_F1 , d, e, a, b, c, (c_62s ^ w0s04___w0s06 ^ w0s08___w0s12));
410     SHA1_STEP (SHA1_F1 , c, d, e, a, b, (c_63s ^ w0s08));
411     SHA1_STEP (SHA1_F1 , b, c, d, e, a, (c_64s ^ w0s04___w0s06___w0s07 ^ w0s08___w0s12 ^ w0s17));
412     SHA1_STEPX(SHA1_F1 , a, b, c, d, e, (c_65sK));
413     SHA1_STEP (SHA1_F1 , e, a, b, c, d, (c_66s ^ w0s14 ^ w0s16));
414     SHA1_STEP (SHA1_F1 , d, e, a, b, c, (c_67s ^ w0s08 ^ w0s18));
415     SHA1_STEP (SHA1_F1 , c, d, e, a, b, (c_68s ^ w0s11 ^ w0s14 ^ w0s15));
416     SHA1_STEPX(SHA1_F1 , b, c, d, e, a, (c_69sK));
417     SHA1_STEP (SHA1_F1 , a, b, c, d, e, (c_70s ^ w0s12 ^ w0s19));
418     SHA1_STEP (SHA1_F1 , e, a, b, c, d, (c_71s ^ w0s12 ^ w0s16));
419     SHA1_STEP (SHA1_F1 , d, e, a, b, c, (c_72s ^ w0s05 ^ w0s11 ^ w0s12 ^ w0s13 ^ w0s16 ^ w0s18));
420     SHA1_STEP (SHA1_F1 , c, d, e, a, b, (c_73s ^ w0s20));
421     SHA1_STEP (SHA1_F1 , b, c, d, e, a, (c_74s ^ w0s08 ^ w0s16));
422     SHA1_STEP (SHA1_F1 , a, b, c, d, e, (c_75s ^ w0s06 ^ w0s12 ^ w0s14));
423
424     const u32x c_76s = rotl32 ((c_73s ^ c_68s ^ c_62s ^ c_60s), 1u);
425     const u32x c_77s = rotl32 ((c_74s ^ c_69s ^ c_63s ^ c_61s), 1u);
426     const u32x c_78s = rotl32 ((c_75s ^ c_70s ^ c_64s ^ c_62s), 1u);
427     const u32x c_79s = rotl32 ((c_76s ^ c_71s ^ c_65s ^ c_63s), 1u);
428
429     const u32x w0s21 = rotl32 (w0, 21u);
430     const u32x w0s22 = rotl32 (w0, 22U);
431
432     SHA1_STEP (SHA1_F1 , e, a, b, c, d, (c_76s ^ w0s07 ^ w0s08___w0s12 ^ w0s16 ^ w0s21));
433     SHA1_STEP (SHA1_F1 , d, e, a, b, c, (c_77s));
434     SHA1_STEP (SHA1_F1 , c, d, e, a, b, (c_78s ^ w0s07 ^ w0s08 ^ w0s15 ^ w0s18 ^ w0s20));
435     SHA1_STEP (SHA1_F1 , b, c, d, e, a, (c_79s ^ w0s08 ^ w0s22));
436
437     COMPARE_M_SIMD (d, e, c, b);
438   }
439 }
440
441 void m00100s (u32 w[16], const u32 pw_len, __global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __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)
442 {
443   /**
444    * modifier
445    */
446
447   const u32 gid = get_global_id (0);
448   const u32 lid = get_local_id (0);
449
450   /**
451    * base
452    */
453
454   const u32 c_16s = rotl32_S ((w[13] ^ w[ 8] ^ w[ 2]        ), 1u);
455   const u32 c_17s = rotl32_S ((w[14] ^ w[ 9] ^ w[ 3] ^ w[ 1]), 1u);
456   const u32 c_18s = rotl32_S ((w[15] ^ w[10] ^ w[ 4] ^ w[ 2]), 1u);
457   const u32 c_19s = rotl32_S ((c_16s ^ w[11] ^ w[ 5] ^ w[ 3]), 1u);
458   const u32 c_20s = rotl32_S ((c_17s ^ w[12] ^ w[ 6] ^ w[ 4]), 1u);
459   const u32 c_21s = rotl32_S ((c_18s ^ w[13] ^ w[ 7] ^ w[ 5]), 1u);
460   const u32 c_22s = rotl32_S ((c_19s ^ w[14] ^ w[ 8] ^ w[ 6]), 1u);
461   const u32 c_23s = rotl32_S ((c_20s ^ w[15] ^ w[ 9] ^ w[ 7]), 1u);
462   const u32 c_24s = rotl32_S ((c_21s ^ c_16s ^ w[10] ^ w[ 8]), 1u);
463   const u32 c_25s = rotl32_S ((c_22s ^ c_17s ^ w[11] ^ w[ 9]), 1u);
464   const u32 c_26s = rotl32_S ((c_23s ^ c_18s ^ w[12] ^ w[10]), 1u);
465   const u32 c_27s = rotl32_S ((c_24s ^ c_19s ^ w[13] ^ w[11]), 1u);
466   const u32 c_28s = rotl32_S ((c_25s ^ c_20s ^ w[14] ^ w[12]), 1u);
467   const u32 c_29s = rotl32_S ((c_26s ^ c_21s ^ w[15] ^ w[13]), 1u);
468   const u32 c_30s = rotl32_S ((c_27s ^ c_22s ^ c_16s ^ w[14]), 1u);
469   const u32 c_31s = rotl32_S ((c_28s ^ c_23s ^ c_17s ^ w[15]), 1u);
470   const u32 c_32s = rotl32_S ((c_29s ^ c_24s ^ c_18s ^ c_16s), 1u);
471   const u32 c_33s = rotl32_S ((c_30s ^ c_25s ^ c_19s ^ c_17s), 1u);
472   const u32 c_34s = rotl32_S ((c_31s ^ c_26s ^ c_20s ^ c_18s), 1u);
473   const u32 c_35s = rotl32_S ((c_32s ^ c_27s ^ c_21s ^ c_19s), 1u);
474   const u32 c_36s = rotl32_S ((c_33s ^ c_28s ^ c_22s ^ c_20s), 1u);
475   const u32 c_37s = rotl32_S ((c_34s ^ c_29s ^ c_23s ^ c_21s), 1u);
476   const u32 c_38s = rotl32_S ((c_35s ^ c_30s ^ c_24s ^ c_22s), 1u);
477   const u32 c_39s = rotl32_S ((c_36s ^ c_31s ^ c_25s ^ c_23s), 1u);
478   const u32 c_40s = rotl32_S ((c_37s ^ c_32s ^ c_26s ^ c_24s), 1u);
479   const u32 c_41s = rotl32_S ((c_38s ^ c_33s ^ c_27s ^ c_25s), 1u);
480   const u32 c_42s = rotl32_S ((c_39s ^ c_34s ^ c_28s ^ c_26s), 1u);
481   const u32 c_43s = rotl32_S ((c_40s ^ c_35s ^ c_29s ^ c_27s), 1u);
482   const u32 c_44s = rotl32_S ((c_41s ^ c_36s ^ c_30s ^ c_28s), 1u);
483   const u32 c_45s = rotl32_S ((c_42s ^ c_37s ^ c_31s ^ c_29s), 1u);
484   const u32 c_46s = rotl32_S ((c_43s ^ c_38s ^ c_32s ^ c_30s), 1u);
485   const u32 c_47s = rotl32_S ((c_44s ^ c_39s ^ c_33s ^ c_31s), 1u);
486   const u32 c_48s = rotl32_S ((c_45s ^ c_40s ^ c_34s ^ c_32s), 1u);
487   const u32 c_49s = rotl32_S ((c_46s ^ c_41s ^ c_35s ^ c_33s), 1u);
488   const u32 c_50s = rotl32_S ((c_47s ^ c_42s ^ c_36s ^ c_34s), 1u);
489   const u32 c_51s = rotl32_S ((c_48s ^ c_43s ^ c_37s ^ c_35s), 1u);
490   const u32 c_52s = rotl32_S ((c_49s ^ c_44s ^ c_38s ^ c_36s), 1u);
491   const u32 c_53s = rotl32_S ((c_50s ^ c_45s ^ c_39s ^ c_37s), 1u);
492   const u32 c_54s = rotl32_S ((c_51s ^ c_46s ^ c_40s ^ c_38s), 1u);
493   const u32 c_55s = rotl32_S ((c_52s ^ c_47s ^ c_41s ^ c_39s), 1u);
494   const u32 c_56s = rotl32_S ((c_53s ^ c_48s ^ c_42s ^ c_40s), 1u);
495   const u32 c_57s = rotl32_S ((c_54s ^ c_49s ^ c_43s ^ c_41s), 1u);
496   const u32 c_58s = rotl32_S ((c_55s ^ c_50s ^ c_44s ^ c_42s), 1u);
497   const u32 c_59s = rotl32_S ((c_56s ^ c_51s ^ c_45s ^ c_43s), 1u);
498   const u32 c_60s = rotl32_S ((c_57s ^ c_52s ^ c_46s ^ c_44s), 1u);
499   const u32 c_61s = rotl32_S ((c_58s ^ c_53s ^ c_47s ^ c_45s), 1u);
500   const u32 c_62s = rotl32_S ((c_59s ^ c_54s ^ c_48s ^ c_46s), 1u);
501   const u32 c_63s = rotl32_S ((c_60s ^ c_55s ^ c_49s ^ c_47s), 1u);
502   const u32 c_64s = rotl32_S ((c_61s ^ c_56s ^ c_50s ^ c_48s), 1u);
503   const u32 c_65s = rotl32_S ((c_62s ^ c_57s ^ c_51s ^ c_49s), 1u);
504   const u32 c_66s = rotl32_S ((c_63s ^ c_58s ^ c_52s ^ c_50s), 1u);
505   const u32 c_67s = rotl32_S ((c_64s ^ c_59s ^ c_53s ^ c_51s), 1u);
506   const u32 c_68s = rotl32_S ((c_65s ^ c_60s ^ c_54s ^ c_52s), 1u);
507   const u32 c_69s = rotl32_S ((c_66s ^ c_61s ^ c_55s ^ c_53s), 1u);
508   const u32 c_70s = rotl32_S ((c_67s ^ c_62s ^ c_56s ^ c_54s), 1u);
509   const u32 c_71s = rotl32_S ((c_68s ^ c_63s ^ c_57s ^ c_55s), 1u);
510   const u32 c_72s = rotl32_S ((c_69s ^ c_64s ^ c_58s ^ c_56s), 1u);
511   const u32 c_73s = rotl32_S ((c_70s ^ c_65s ^ c_59s ^ c_57s), 1u);
512   const u32 c_74s = rotl32_S ((c_71s ^ c_66s ^ c_60s ^ c_58s), 1u);
513   const u32 c_75s = rotl32_S ((c_72s ^ c_67s ^ c_61s ^ c_59s), 1u);
514
515   const u32 c_17sK = c_17s + SHA1C00;
516   const u32 c_18sK = c_18s + SHA1C00;
517   const u32 c_20sK = c_20s + SHA1C01;
518   const u32 c_21sK = c_21s + SHA1C01;
519   const u32 c_23sK = c_23s + SHA1C01;
520   const u32 c_26sK = c_26s + SHA1C01;
521   const u32 c_27sK = c_27s + SHA1C01;
522   const u32 c_29sK = c_29s + SHA1C01;
523   const u32 c_33sK = c_33s + SHA1C01;
524   const u32 c_39sK = c_39s + SHA1C01;
525   const u32 c_41sK = c_41s + SHA1C02;
526   const u32 c_45sK = c_45s + SHA1C02;
527   const u32 c_53sK = c_53s + SHA1C02;
528   const u32 c_65sK = c_65s + SHA1C03;
529   const u32 c_69sK = c_69s + SHA1C03;
530
531   /**
532    * digest
533    */
534
535   const u32 search[4] =
536   {
537     digests_buf[digests_offset].digest_buf[DGST_R0],
538     digests_buf[digests_offset].digest_buf[DGST_R1],
539     digests_buf[digests_offset].digest_buf[DGST_R2],
540     digests_buf[digests_offset].digest_buf[DGST_R3]
541   };
542
543   /**
544    * reverse
545    */
546
547   const u32 e_rev = rotl32_S (search[1], 2u) - SHA1C03;
548
549  /**
550    * loop
551    */
552
553   u32 w0l = w[0];
554
555   for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
556   {
557     const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
558
559     const u32x w0 = w0l | w0r;
560
561     const u32x w0s01 = rotl32 (w0, 1u);
562     const u32x w0s02 = rotl32 (w0, 2u);
563     const u32x w0s03 = rotl32 (w0, 3u);
564     const u32x w0s04 = rotl32 (w0, 4u);
565     const u32x w0s05 = rotl32 (w0, 5u);
566     const u32x w0s06 = rotl32 (w0, 6u);
567     const u32x w0s07 = rotl32 (w0, 7u);
568     const u32x w0s08 = rotl32 (w0, 8u);
569     const u32x w0s09 = rotl32 (w0, 9u);
570     const u32x w0s10 = rotl32 (w0, 10u);
571     const u32x w0s11 = rotl32 (w0, 11u);
572     const u32x w0s12 = rotl32 (w0, 12u);
573     const u32x w0s13 = rotl32 (w0, 13u);
574     const u32x w0s14 = rotl32 (w0, 14u);
575     const u32x w0s15 = rotl32 (w0, 15u);
576     const u32x w0s16 = rotl32 (w0, 16u);
577     const u32x w0s17 = rotl32 (w0, 17u);
578     const u32x w0s18 = rotl32 (w0, 18u);
579     const u32x w0s19 = rotl32 (w0, 19u);
580     const u32x w0s20 = rotl32 (w0, 20u);
581
582     const u32x w0s04___w0s06 = w0s04 ^ w0s06;
583     const u32x w0s04___w0s08 = w0s04 ^ w0s08;
584     const u32x w0s08___w0s12 = w0s08 ^ w0s12;
585     const u32x w0s04___w0s06___w0s07 = w0s04___w0s06 ^ w0s07;
586
587     u32x a = SHA1M_A;
588     u32x b = SHA1M_B;
589     u32x c = SHA1M_C;
590     u32x d = SHA1M_D;
591     u32x e = SHA1M_E;
592
593     #undef K
594     #define K SHA1C00
595
596     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0);
597     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w[ 1]);
598     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w[ 2]);
599     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w[ 3]);
600     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w[ 4]);
601     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w[ 5]);
602     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w[ 6]);
603     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w[ 7]);
604     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w[ 8]);
605     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w[ 9]);
606     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w[10]);
607     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w[11]);
608     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w[12]);
609     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w[13]);
610     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w[14]);
611     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w[15]);
612
613     SHA1_STEP (SHA1_F0o, e, a, b, c, d, (c_16s ^ w0s01));
614     SHA1_STEPX(SHA1_F0o, d, e, a, b, c, (c_17sK));
615     SHA1_STEPX(SHA1_F0o, c, d, e, a, b, (c_18sK));
616     SHA1_STEP (SHA1_F0o, b, c, d, e, a, (c_19s ^ w0s02));
617
618     #undef K
619     #define K SHA1C01
620
621     SHA1_STEPX(SHA1_F1 , a, b, c, d, e, (c_20sK));
622     SHA1_STEPX(SHA1_F1 , e, a, b, c, d, (c_21sK));
623     SHA1_STEP (SHA1_F1 , d, e, a, b, c, (c_22s ^ w0s03));
624     SHA1_STEPX(SHA1_F1 , c, d, e, a, b, (c_23sK));
625     SHA1_STEP (SHA1_F1 , b, c, d, e, a, (c_24s ^ w0s02));
626     SHA1_STEP (SHA1_F1 , a, b, c, d, e, (c_25s ^ w0s04));
627     SHA1_STEPX(SHA1_F1 , e, a, b, c, d, (c_26sK));
628     SHA1_STEPX(SHA1_F1 , d, e, a, b, c, (c_27sK));
629     SHA1_STEP (SHA1_F1 , c, d, e, a, b, (c_28s ^ w0s05));
630     SHA1_STEPX(SHA1_F1 , b, c, d, e, a, (c_29sK));
631     SHA1_STEP (SHA1_F1 , a, b, c, d, e, (c_30s ^ w0s02 ^ w0s04));
632     SHA1_STEP (SHA1_F1 , e, a, b, c, d, (c_31s ^ w0s06));
633     SHA1_STEP (SHA1_F1 , d, e, a, b, c, (c_32s ^ w0s02 ^ w0s03));
634     SHA1_STEPX(SHA1_F1 , c, d, e, a, b, (c_33sK));
635     SHA1_STEP (SHA1_F1 , b, c, d, e, a, (c_34s ^ w0s07));
636     SHA1_STEP (SHA1_F1 , a, b, c, d, e, (c_35s ^ w0s04));
637     SHA1_STEP (SHA1_F1 , e, a, b, c, d, (c_36s ^ w0s04___w0s06));
638     SHA1_STEP (SHA1_F1 , d, e, a, b, c, (c_37s ^ w0s08));
639     SHA1_STEP (SHA1_F1 , c, d, e, a, b, (c_38s ^ w0s04));
640     SHA1_STEPX(SHA1_F1 , b, c, d, e, a, (c_39sK));
641
642     #undef K
643     #define K SHA1C02
644
645     SHA1_STEP (SHA1_F2o, a, b, c, d, e, (c_40s ^ w0s04 ^ w0s09));
646     SHA1_STEPX(SHA1_F2o, e, a, b, c, d, (c_41sK));
647     SHA1_STEP (SHA1_F2o, d, e, a, b, c, (c_42s ^ w0s06 ^ w0s08));
648     SHA1_STEP (SHA1_F2o, c, d, e, a, b, (c_43s ^ w0s10));
649     SHA1_STEP (SHA1_F2o, b, c, d, e, a, (c_44s ^ w0s03 ^ w0s06 ^ w0s07));
650     SHA1_STEPX(SHA1_F2o, a, b, c, d, e, (c_45sK));
651     SHA1_STEP (SHA1_F2o, e, a, b, c, d, (c_46s ^ w0s04 ^ w0s11));
652     SHA1_STEP (SHA1_F2o, d, e, a, b, c, (c_47s ^ w0s04___w0s08));
653     SHA1_STEP (SHA1_F2o, c, d, e, a, b, (c_48s ^ w0s03 ^ w0s04___w0s08 ^ w0s05 ^ w0s10));
654     SHA1_STEP (SHA1_F2o, b, c, d, e, a, (c_49s ^ w0s12));
655     SHA1_STEP (SHA1_F2o, a, b, c, d, e, (c_50s ^ w0s08));
656     SHA1_STEP (SHA1_F2o, e, a, b, c, d, (c_51s ^ w0s04___w0s06));
657     SHA1_STEP (SHA1_F2o, d, e, a, b, c, (c_52s ^ w0s04___w0s08 ^ w0s13));
658     SHA1_STEPX(SHA1_F2o, c, d, e, a, b, (c_53sK));
659     SHA1_STEP (SHA1_F2o, b, c, d, e, a, (c_54s ^ w0s07 ^ w0s10 ^ w0s12));
660     SHA1_STEP (SHA1_F2o, a, b, c, d, e, (c_55s ^ w0s14));
661     SHA1_STEP (SHA1_F2o, e, a, b, c, d, (c_56s ^ w0s04___w0s06___w0s07 ^ w0s10 ^ w0s11));
662     SHA1_STEP (SHA1_F2o, d, e, a, b, c, (c_57s ^ w0s08));
663     SHA1_STEP (SHA1_F2o, c, d, e, a, b, (c_58s ^ w0s04___w0s08 ^ w0s15));
664     SHA1_STEP (SHA1_F2o, b, c, d, e, a, (c_59s ^ w0s08___w0s12));
665
666     #undef K
667     #define K SHA1C03
668
669     SHA1_STEP (SHA1_F1 , a, b, c, d, e, (c_60s ^ w0s04 ^ w0s08___w0s12 ^ w0s07 ^ w0s14));
670     SHA1_STEP (SHA1_F1 , e, a, b, c, d, (c_61s ^ w0s16));
671     SHA1_STEP (SHA1_F1 , d, e, a, b, c, (c_62s ^ w0s04___w0s06 ^ w0s08___w0s12));
672     SHA1_STEP (SHA1_F1 , c, d, e, a, b, (c_63s ^ w0s08));
673     SHA1_STEP (SHA1_F1 , b, c, d, e, a, (c_64s ^ w0s04___w0s06___w0s07 ^ w0s08___w0s12 ^ w0s17));
674     SHA1_STEPX(SHA1_F1 , a, b, c, d, e, (c_65sK));
675     SHA1_STEP (SHA1_F1 , e, a, b, c, d, (c_66s ^ w0s14 ^ w0s16));
676     SHA1_STEP (SHA1_F1 , d, e, a, b, c, (c_67s ^ w0s08 ^ w0s18));
677     SHA1_STEP (SHA1_F1 , c, d, e, a, b, (c_68s ^ w0s11 ^ w0s14 ^ w0s15));
678     SHA1_STEPX(SHA1_F1 , b, c, d, e, a, (c_69sK));
679     SHA1_STEP (SHA1_F1 , a, b, c, d, e, (c_70s ^ w0s12 ^ w0s19));
680     SHA1_STEP (SHA1_F1 , e, a, b, c, d, (c_71s ^ w0s12 ^ w0s16));
681     SHA1_STEP (SHA1_F1 , d, e, a, b, c, (c_72s ^ w0s05 ^ w0s11 ^ w0s12 ^ w0s13 ^ w0s16 ^ w0s18));
682     SHA1_STEP (SHA1_F1 , c, d, e, a, b, (c_73s ^ w0s20));
683     SHA1_STEP (SHA1_F1 , b, c, d, e, a, (c_74s ^ w0s08 ^ w0s16));
684
685     SHA1_STEP_PE (SHA1_F1, a, b, c, d, e, (c_75s ^ w0s06 ^ w0s12 ^ w0s14));
686
687     if (MATCHES_NONE_VS (e, e_rev)) continue;
688
689     SHA1_STEP_PB (SHA1_F1, a, b, c, d, e, 0);
690
691     const u32x c_76s = rotl32 ((c_73s ^ c_68s ^ c_62s ^ c_60s), 1u);
692     const u32x c_77s = rotl32 ((c_74s ^ c_69s ^ c_63s ^ c_61s), 1u);
693     const u32x c_78s = rotl32 ((c_75s ^ c_70s ^ c_64s ^ c_62s), 1u);
694     const u32x c_79s = rotl32 ((c_76s ^ c_71s ^ c_65s ^ c_63s), 1u);
695
696     const u32x w0s21 = rotl32 (w0, 21u);
697     const u32x w0s22 = rotl32 (w0, 22U);
698
699     SHA1_STEP (SHA1_F1 , e, a, b, c, d, (c_76s ^ w0s07 ^ w0s08___w0s12 ^ w0s16 ^ w0s21));
700     SHA1_STEP (SHA1_F1 , d, e, a, b, c, (c_77s));
701     SHA1_STEP (SHA1_F1 , c, d, e, a, b, (c_78s ^ w0s07 ^ w0s08 ^ w0s15 ^ w0s18 ^ w0s20));
702     SHA1_STEP (SHA1_F1 , b, c, d, e, a, (c_79s ^ w0s08 ^ w0s22));
703
704     COMPARE_S_SIMD (d, e, c, b);
705   }
706 }
707
708 __kernel void m00100_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __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)
709 {
710   /**
711    * base
712    */
713
714   const u32 gid = get_global_id (0);
715
716   if (gid >= gid_max) return;
717
718   u32 w[16];
719
720   w[ 0] = pws[gid].i[ 0];
721   w[ 1] = pws[gid].i[ 1];
722   w[ 2] = pws[gid].i[ 2];
723   w[ 3] = pws[gid].i[ 3];
724   w[ 4] = 0;
725   w[ 5] = 0;
726   w[ 6] = 0;
727   w[ 7] = 0;
728   w[ 8] = 0;
729   w[ 9] = 0;
730   w[10] = 0;
731   w[11] = 0;
732   w[12] = 0;
733   w[13] = 0;
734   w[14] = 0;
735   w[15] = pws[gid].i[15];
736
737   const u32 pw_len = pws[gid].pw_len;
738
739   /**
740    * main
741    */
742
743   m00100m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, 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);
744 }
745
746 __kernel void m00100_m08 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __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)
747 {
748   /**
749    * base
750    */
751
752   const u32 gid = get_global_id (0);
753
754   if (gid >= gid_max) return;
755
756   u32 w[16];
757
758   w[ 0] = pws[gid].i[ 0];
759   w[ 1] = pws[gid].i[ 1];
760   w[ 2] = pws[gid].i[ 2];
761   w[ 3] = pws[gid].i[ 3];
762   w[ 4] = pws[gid].i[ 4];
763   w[ 5] = pws[gid].i[ 5];
764   w[ 6] = pws[gid].i[ 6];
765   w[ 7] = pws[gid].i[ 7];
766   w[ 8] = 0;
767   w[ 9] = 0;
768   w[10] = 0;
769   w[11] = 0;
770   w[12] = 0;
771   w[13] = 0;
772   w[14] = 0;
773   w[15] = pws[gid].i[15];
774
775   const u32 pw_len = pws[gid].pw_len;
776
777   /**
778    * main
779    */
780
781   m00100m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, 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);
782 }
783
784 __kernel void m00100_m16 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __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)
785 {
786   /**
787    * base
788    */
789
790   const u32 gid = get_global_id (0);
791
792   if (gid >= gid_max) return;
793
794   u32 w[16];
795
796   w[ 0] = pws[gid].i[ 0];
797   w[ 1] = pws[gid].i[ 1];
798   w[ 2] = pws[gid].i[ 2];
799   w[ 3] = pws[gid].i[ 3];
800   w[ 4] = pws[gid].i[ 4];
801   w[ 5] = pws[gid].i[ 5];
802   w[ 6] = pws[gid].i[ 6];
803   w[ 7] = pws[gid].i[ 7];
804   w[ 8] = pws[gid].i[ 8];
805   w[ 9] = pws[gid].i[ 9];
806   w[10] = pws[gid].i[10];
807   w[11] = pws[gid].i[11];
808   w[12] = pws[gid].i[12];
809   w[13] = pws[gid].i[13];
810   w[14] = pws[gid].i[14];
811   w[15] = pws[gid].i[15];
812
813   const u32 pw_len = pws[gid].pw_len;
814
815   /**
816    * main
817    */
818
819   m00100m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, 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);
820 }
821
822 __kernel void m00100_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __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)
823 {
824   /**
825    * base
826    */
827
828   const u32 gid = get_global_id (0);
829
830   if (gid >= gid_max) return;
831
832   u32 w[16];
833
834   w[ 0] = pws[gid].i[ 0];
835   w[ 1] = pws[gid].i[ 1];
836   w[ 2] = pws[gid].i[ 2];
837   w[ 3] = pws[gid].i[ 3];
838   w[ 4] = 0;
839   w[ 5] = 0;
840   w[ 6] = 0;
841   w[ 7] = 0;
842   w[ 8] = 0;
843   w[ 9] = 0;
844   w[10] = 0;
845   w[11] = 0;
846   w[12] = 0;
847   w[13] = 0;
848   w[14] = 0;
849   w[15] = pws[gid].i[15];
850
851   const u32 pw_len = pws[gid].pw_len;
852
853   /**
854    * main
855    */
856
857   m00100s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, 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);
858 }
859
860 __kernel void m00100_s08 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __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)
861 {
862   /**
863    * base
864    */
865
866   const u32 gid = get_global_id (0);
867
868   if (gid >= gid_max) return;
869
870   u32 w[16];
871
872   w[ 0] = pws[gid].i[ 0];
873   w[ 1] = pws[gid].i[ 1];
874   w[ 2] = pws[gid].i[ 2];
875   w[ 3] = pws[gid].i[ 3];
876   w[ 4] = pws[gid].i[ 4];
877   w[ 5] = pws[gid].i[ 5];
878   w[ 6] = pws[gid].i[ 6];
879   w[ 7] = pws[gid].i[ 7];
880   w[ 8] = 0;
881   w[ 9] = 0;
882   w[10] = 0;
883   w[11] = 0;
884   w[12] = 0;
885   w[13] = 0;
886   w[14] = 0;
887   w[15] = pws[gid].i[15];
888
889   const u32 pw_len = pws[gid].pw_len;
890
891   /**
892    * main
893    */
894
895   m00100s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, 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);
896 }
897
898 __kernel void m00100_s16 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __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)
899 {
900   /**
901    * base
902    */
903
904   const u32 gid = get_global_id (0);
905
906   if (gid >= gid_max) return;
907
908   u32 w[16];
909
910   w[ 0] = pws[gid].i[ 0];
911   w[ 1] = pws[gid].i[ 1];
912   w[ 2] = pws[gid].i[ 2];
913   w[ 3] = pws[gid].i[ 3];
914   w[ 4] = pws[gid].i[ 4];
915   w[ 5] = pws[gid].i[ 5];
916   w[ 6] = pws[gid].i[ 6];
917   w[ 7] = pws[gid].i[ 7];
918   w[ 8] = pws[gid].i[ 8];
919   w[ 9] = pws[gid].i[ 9];
920   w[10] = pws[gid].i[10];
921   w[11] = pws[gid].i[11];
922   w[12] = pws[gid].i[12];
923   w[13] = pws[gid].i[13];
924   w[14] = pws[gid].i[14];
925   w[15] = pws[gid].i[15];
926
927   const u32 pw_len = pws[gid].pw_len;
928
929   /**
930    * main
931    */
932
933   m00100s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, 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);
934 }