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