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