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