Initial commit
[hashcat.git] / amd / m00100_a3.cl
1 /**
2  * Author......: Jens Steube <jens.steube@gmail.com>
3  * License.....: MIT
4  */
5
6 #define _SHA1_
7 #define _SCALAR_
8
9 #include "include/constants.h"
10 #include "include/kernel_vendor.h"
11
12 #ifdef  VLIW1
13 #define VECT_SIZE1
14 #endif
15
16 #ifdef  VLIW4
17 #define VECT_SIZE4
18 #endif
19
20 #ifdef  VLIW5
21 #define VECT_SIZE4
22 #endif
23
24 #define DGST_R0 3
25 #define DGST_R1 4
26 #define DGST_R2 2
27 #define DGST_R3 1
28
29 #include "include/kernel_functions.c"
30 #include "types_amd.c"
31 #include "common_amd.c"
32
33 #ifdef  VECT_SIZE1
34 #define VECT_COMPARE_S "check_single_vect1_comp4_warp.c"
35 #define VECT_COMPARE_M "check_multi_vect1_comp4_warp.c"
36 #endif
37
38 #ifdef  VECT_SIZE2
39 #define VECT_COMPARE_S "check_single_vect2_comp4_warp.c"
40 #define VECT_COMPARE_M "check_multi_vect2_comp4_warp.c"
41 #endif
42
43 #ifdef  VECT_SIZE4
44 #define VECT_COMPARE_S "check_single_vect4_comp4_warp.c"
45 #define VECT_COMPARE_M "check_multi_vect4_comp4_warp.c"
46 #endif
47
48 static void m00100m (u32 w[16], const u32 pw_len, __global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32x * words_buf_r, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset)
49 {
50   /**
51    * modifier
52    */
53
54   const u32 gid = get_global_id (0);
55   const u32 lid = get_local_id (0);
56
57   /**
58    * base
59    */
60
61   const u32 c_16s = rotl32 ((w[13] ^ w[ 8] ^ w[ 2]        ), 1u);
62   const u32 c_17s = rotl32 ((w[14] ^ w[ 9] ^ w[ 3] ^ w[ 1]), 1u);
63   const u32 c_18s = rotl32 ((w[15] ^ w[10] ^ w[ 4] ^ w[ 2]), 1u);
64   const u32 c_19s = rotl32 ((c_16s ^ w[11] ^ w[ 5] ^ w[ 3]), 1u);
65   const u32 c_20s = rotl32 ((c_17s ^ w[12] ^ w[ 6] ^ w[ 4]), 1u);
66   const u32 c_21s = rotl32 ((c_18s ^ w[13] ^ w[ 7] ^ w[ 5]), 1u);
67   const u32 c_22s = rotl32 ((c_19s ^ w[14] ^ w[ 8] ^ w[ 6]), 1u);
68   const u32 c_23s = rotl32 ((c_20s ^ w[15] ^ w[ 9] ^ w[ 7]), 1u);
69   const u32 c_24s = rotl32 ((c_21s ^ c_16s ^ w[10] ^ w[ 8]), 1u);
70   const u32 c_25s = rotl32 ((c_22s ^ c_17s ^ w[11] ^ w[ 9]), 1u);
71   const u32 c_26s = rotl32 ((c_23s ^ c_18s ^ w[12] ^ w[10]), 1u);
72   const u32 c_27s = rotl32 ((c_24s ^ c_19s ^ w[13] ^ w[11]), 1u);
73   const u32 c_28s = rotl32 ((c_25s ^ c_20s ^ w[14] ^ w[12]), 1u);
74   const u32 c_29s = rotl32 ((c_26s ^ c_21s ^ w[15] ^ w[13]), 1u);
75   const u32 c_30s = rotl32 ((c_27s ^ c_22s ^ c_16s ^ w[14]), 1u);
76   const u32 c_31s = rotl32 ((c_28s ^ c_23s ^ c_17s ^ w[15]), 1u);
77   const u32 c_32s = rotl32 ((c_29s ^ c_24s ^ c_18s ^ c_16s), 1u);
78   const u32 c_33s = rotl32 ((c_30s ^ c_25s ^ c_19s ^ c_17s), 1u);
79   const u32 c_34s = rotl32 ((c_31s ^ c_26s ^ c_20s ^ c_18s), 1u);
80   const u32 c_35s = rotl32 ((c_32s ^ c_27s ^ c_21s ^ c_19s), 1u);
81   const u32 c_36s = rotl32 ((c_33s ^ c_28s ^ c_22s ^ c_20s), 1u);
82   const u32 c_37s = rotl32 ((c_34s ^ c_29s ^ c_23s ^ c_21s), 1u);
83   const u32 c_38s = rotl32 ((c_35s ^ c_30s ^ c_24s ^ c_22s), 1u);
84   const u32 c_39s = rotl32 ((c_36s ^ c_31s ^ c_25s ^ c_23s), 1u);
85   const u32 c_40s = rotl32 ((c_37s ^ c_32s ^ c_26s ^ c_24s), 1u);
86   const u32 c_41s = rotl32 ((c_38s ^ c_33s ^ c_27s ^ c_25s), 1u);
87   const u32 c_42s = rotl32 ((c_39s ^ c_34s ^ c_28s ^ c_26s), 1u);
88   const u32 c_43s = rotl32 ((c_40s ^ c_35s ^ c_29s ^ c_27s), 1u);
89   const u32 c_44s = rotl32 ((c_41s ^ c_36s ^ c_30s ^ c_28s), 1u);
90   const u32 c_45s = rotl32 ((c_42s ^ c_37s ^ c_31s ^ c_29s), 1u);
91   const u32 c_46s = rotl32 ((c_43s ^ c_38s ^ c_32s ^ c_30s), 1u);
92   const u32 c_47s = rotl32 ((c_44s ^ c_39s ^ c_33s ^ c_31s), 1u);
93   const u32 c_48s = rotl32 ((c_45s ^ c_40s ^ c_34s ^ c_32s), 1u);
94   const u32 c_49s = rotl32 ((c_46s ^ c_41s ^ c_35s ^ c_33s), 1u);
95   const u32 c_50s = rotl32 ((c_47s ^ c_42s ^ c_36s ^ c_34s), 1u);
96   const u32 c_51s = rotl32 ((c_48s ^ c_43s ^ c_37s ^ c_35s), 1u);
97   const u32 c_52s = rotl32 ((c_49s ^ c_44s ^ c_38s ^ c_36s), 1u);
98   const u32 c_53s = rotl32 ((c_50s ^ c_45s ^ c_39s ^ c_37s), 1u);
99   const u32 c_54s = rotl32 ((c_51s ^ c_46s ^ c_40s ^ c_38s), 1u);
100   const u32 c_55s = rotl32 ((c_52s ^ c_47s ^ c_41s ^ c_39s), 1u);
101   const u32 c_56s = rotl32 ((c_53s ^ c_48s ^ c_42s ^ c_40s), 1u);
102   const u32 c_57s = rotl32 ((c_54s ^ c_49s ^ c_43s ^ c_41s), 1u);
103   const u32 c_58s = rotl32 ((c_55s ^ c_50s ^ c_44s ^ c_42s), 1u);
104   const u32 c_59s = rotl32 ((c_56s ^ c_51s ^ c_45s ^ c_43s), 1u);
105   const u32 c_60s = rotl32 ((c_57s ^ c_52s ^ c_46s ^ c_44s), 1u);
106   const u32 c_61s = rotl32 ((c_58s ^ c_53s ^ c_47s ^ c_45s), 1u);
107   const u32 c_62s = rotl32 ((c_59s ^ c_54s ^ c_48s ^ c_46s), 1u);
108   const u32 c_63s = rotl32 ((c_60s ^ c_55s ^ c_49s ^ c_47s), 1u);
109   const u32 c_64s = rotl32 ((c_61s ^ c_56s ^ c_50s ^ c_48s), 1u);
110   const u32 c_65s = rotl32 ((c_62s ^ c_57s ^ c_51s ^ c_49s), 1u);
111   const u32 c_66s = rotl32 ((c_63s ^ c_58s ^ c_52s ^ c_50s), 1u);
112   const u32 c_67s = rotl32 ((c_64s ^ c_59s ^ c_53s ^ c_51s), 1u);
113   const u32 c_68s = rotl32 ((c_65s ^ c_60s ^ c_54s ^ c_52s), 1u);
114   const u32 c_69s = rotl32 ((c_66s ^ c_61s ^ c_55s ^ c_53s), 1u);
115   const u32 c_70s = rotl32 ((c_67s ^ c_62s ^ c_56s ^ c_54s), 1u);
116   const u32 c_71s = rotl32 ((c_68s ^ c_63s ^ c_57s ^ c_55s), 1u);
117   const u32 c_72s = rotl32 ((c_69s ^ c_64s ^ c_58s ^ c_56s), 1u);
118   const u32 c_73s = rotl32 ((c_70s ^ c_65s ^ c_59s ^ c_57s), 1u);
119   const u32 c_74s = rotl32 ((c_71s ^ c_66s ^ c_60s ^ c_58s), 1u);
120   const u32 c_75s = rotl32 ((c_72s ^ c_67s ^ c_61s ^ c_59s), 1u);
121
122   const u32 c_17sK = c_17s + SHA1C00;
123   const u32 c_18sK = c_18s + SHA1C00;
124   const u32 c_20sK = c_20s + SHA1C01;
125   const u32 c_21sK = c_21s + SHA1C01;
126   const u32 c_23sK = c_23s + SHA1C01;
127   const u32 c_26sK = c_26s + SHA1C01;
128   const u32 c_27sK = c_27s + SHA1C01;
129   const u32 c_29sK = c_29s + SHA1C01;
130   const u32 c_33sK = c_33s + SHA1C01;
131   const u32 c_39sK = c_39s + SHA1C01;
132   const u32 c_41sK = c_41s + SHA1C02;
133   const u32 c_45sK = c_45s + SHA1C02;
134   const u32 c_53sK = c_53s + SHA1C02;
135   const u32 c_65sK = c_65s + SHA1C03;
136   const u32 c_69sK = c_69s + SHA1C03;
137
138   /**
139    * loop
140    */
141
142   const u32 bf_loops = ceil ((float) bfs_cnt / VECT_DIV);
143
144   u32x w0l = w[0];
145
146   for (u32 il_pos = 0; il_pos < bf_loops; il_pos++)
147   {
148     const u32x w0r = words_buf_r[il_pos];
149
150     const u32x w0 = w0l | w0r;
151
152     const u32x w0s01 = rotl32 (w0, 1u);
153     const u32x w0s02 = rotl32 (w0, 2u);
154     const u32x w0s03 = rotl32 (w0, 3u);
155     const u32x w0s04 = rotl32 (w0, 4u);
156     const u32x w0s05 = rotl32 (w0, 5u);
157     const u32x w0s06 = rotl32 (w0, 6u);
158     const u32x w0s07 = rotl32 (w0, 7u);
159     const u32x w0s08 = rotl32 (w0, 8u);
160     const u32x w0s09 = rotl32 (w0, 9u);
161     const u32x w0s10 = rotl32 (w0, 10u);
162     const u32x w0s11 = rotl32 (w0, 11u);
163     const u32x w0s12 = rotl32 (w0, 12u);
164     const u32x w0s13 = rotl32 (w0, 13u);
165     const u32x w0s14 = rotl32 (w0, 14u);
166     const u32x w0s15 = rotl32 (w0, 15u);
167     const u32x w0s16 = rotl32 (w0, 16u);
168     const u32x w0s17 = rotl32 (w0, 17u);
169     const u32x w0s18 = rotl32 (w0, 18u);
170     const u32x w0s19 = rotl32 (w0, 19u);
171     const u32x w0s20 = rotl32 (w0, 20u);
172
173     const u32x w0s04___w0s06 = w0s04 ^ w0s06;
174     const u32x w0s04___w0s08 = w0s04 ^ w0s08;
175     const u32x w0s08___w0s12 = w0s08 ^ w0s12;
176     const u32x w0s04___w0s06___w0s07 = w0s04___w0s06 ^ w0s07;
177
178     u32x a = SHA1M_A;
179     u32x b = SHA1M_B;
180     u32x c = SHA1M_C;
181     u32x d = SHA1M_D;
182     u32x e = SHA1M_E;
183
184     #undef K
185     #define K SHA1C00
186
187     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0);
188     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w[ 1]);
189     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w[ 2]);
190     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w[ 3]);
191     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w[ 4]);
192     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w[ 5]);
193     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w[ 6]);
194     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w[ 7]);
195     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w[ 8]);
196     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w[ 9]);
197     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w[10]);
198     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w[11]);
199     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w[12]);
200     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w[13]);
201     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w[14]);
202     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w[15]);
203
204     SHA1_STEP (SHA1_F0o, e, a, b, c, d, (c_16s ^ w0s01));
205     SHA1_STEPX(SHA1_F0o, d, e, a, b, c, (c_17sK));
206     SHA1_STEPX(SHA1_F0o, c, d, e, a, b, (c_18sK));
207     SHA1_STEP (SHA1_F0o, b, c, d, e, a, (c_19s ^ w0s02));
208
209     #undef K
210     #define K SHA1C01
211
212     SHA1_STEPX(SHA1_F1 , a, b, c, d, e, (c_20sK));
213     SHA1_STEPX(SHA1_F1 , e, a, b, c, d, (c_21sK));
214     SHA1_STEP (SHA1_F1 , d, e, a, b, c, (c_22s ^ w0s03));
215     SHA1_STEPX(SHA1_F1 , c, d, e, a, b, (c_23sK));
216     SHA1_STEP (SHA1_F1 , b, c, d, e, a, (c_24s ^ w0s02));
217     SHA1_STEP (SHA1_F1 , a, b, c, d, e, (c_25s ^ w0s04));
218     SHA1_STEPX(SHA1_F1 , e, a, b, c, d, (c_26sK));
219     SHA1_STEPX(SHA1_F1 , d, e, a, b, c, (c_27sK));
220     SHA1_STEP (SHA1_F1 , c, d, e, a, b, (c_28s ^ w0s05));
221     SHA1_STEPX(SHA1_F1 , b, c, d, e, a, (c_29sK));
222     SHA1_STEP (SHA1_F1 , a, b, c, d, e, (c_30s ^ w0s02 ^ w0s04));
223     SHA1_STEP (SHA1_F1 , e, a, b, c, d, (c_31s ^ w0s06));
224     SHA1_STEP (SHA1_F1 , d, e, a, b, c, (c_32s ^ w0s02 ^ w0s03));
225     SHA1_STEPX(SHA1_F1 , c, d, e, a, b, (c_33sK));
226     SHA1_STEP (SHA1_F1 , b, c, d, e, a, (c_34s ^ w0s07));
227     SHA1_STEP (SHA1_F1 , a, b, c, d, e, (c_35s ^ w0s04));
228     SHA1_STEP (SHA1_F1 , e, a, b, c, d, (c_36s ^ w0s04___w0s06));
229     SHA1_STEP (SHA1_F1 , d, e, a, b, c, (c_37s ^ w0s08));
230     SHA1_STEP (SHA1_F1 , c, d, e, a, b, (c_38s ^ w0s04));
231     SHA1_STEPX(SHA1_F1 , b, c, d, e, a, (c_39sK));
232
233     #undef K
234     #define K SHA1C02
235
236     SHA1_STEP (SHA1_F2o, a, b, c, d, e, (c_40s ^ w0s04 ^ w0s09));
237     SHA1_STEPX(SHA1_F2o, e, a, b, c, d, (c_41sK));
238     SHA1_STEP (SHA1_F2o, d, e, a, b, c, (c_42s ^ w0s06 ^ w0s08));
239     SHA1_STEP (SHA1_F2o, c, d, e, a, b, (c_43s ^ w0s10));
240     SHA1_STEP (SHA1_F2o, b, c, d, e, a, (c_44s ^ w0s03 ^ w0s06 ^ w0s07));
241     SHA1_STEPX(SHA1_F2o, a, b, c, d, e, (c_45sK));
242     SHA1_STEP (SHA1_F2o, e, a, b, c, d, (c_46s ^ w0s04 ^ w0s11));
243     SHA1_STEP (SHA1_F2o, d, e, a, b, c, (c_47s ^ w0s04___w0s08));
244     SHA1_STEP (SHA1_F2o, c, d, e, a, b, (c_48s ^ w0s03 ^ w0s04___w0s08 ^ w0s05 ^ w0s10));
245     SHA1_STEP (SHA1_F2o, b, c, d, e, a, (c_49s ^ w0s12));
246     SHA1_STEP (SHA1_F2o, a, b, c, d, e, (c_50s ^ w0s08));
247     SHA1_STEP (SHA1_F2o, e, a, b, c, d, (c_51s ^ w0s04___w0s06));
248     SHA1_STEP (SHA1_F2o, d, e, a, b, c, (c_52s ^ w0s04___w0s08 ^ w0s13));
249     SHA1_STEPX(SHA1_F2o, c, d, e, a, b, (c_53sK));
250     SHA1_STEP (SHA1_F2o, b, c, d, e, a, (c_54s ^ w0s07 ^ w0s10 ^ w0s12));
251     SHA1_STEP (SHA1_F2o, a, b, c, d, e, (c_55s ^ w0s14));
252     SHA1_STEP (SHA1_F2o, e, a, b, c, d, (c_56s ^ w0s04___w0s06___w0s07 ^ w0s10 ^ w0s11));
253     SHA1_STEP (SHA1_F2o, d, e, a, b, c, (c_57s ^ w0s08));
254     SHA1_STEP (SHA1_F2o, c, d, e, a, b, (c_58s ^ w0s04___w0s08 ^ w0s15));
255     SHA1_STEP (SHA1_F2o, b, c, d, e, a, (c_59s ^ w0s08___w0s12));
256
257     #undef K
258     #define K SHA1C03
259
260     SHA1_STEP (SHA1_F1 , a, b, c, d, e, (c_60s ^ w0s04 ^ w0s08___w0s12 ^ w0s07 ^ w0s14));
261     SHA1_STEP (SHA1_F1 , e, a, b, c, d, (c_61s ^ w0s16));
262     SHA1_STEP (SHA1_F1 , d, e, a, b, c, (c_62s ^ w0s04___w0s06 ^ w0s08___w0s12));
263     SHA1_STEP (SHA1_F1 , c, d, e, a, b, (c_63s ^ w0s08));
264     SHA1_STEP (SHA1_F1 , b, c, d, e, a, (c_64s ^ w0s04___w0s06___w0s07 ^ w0s08___w0s12 ^ w0s17));
265     SHA1_STEPX(SHA1_F1 , a, b, c, d, e, (c_65sK));
266     SHA1_STEP (SHA1_F1 , e, a, b, c, d, (c_66s ^ w0s14 ^ w0s16));
267     SHA1_STEP (SHA1_F1 , d, e, a, b, c, (c_67s ^ w0s08 ^ w0s18));
268     SHA1_STEP (SHA1_F1 , c, d, e, a, b, (c_68s ^ w0s11 ^ w0s14 ^ w0s15));
269     SHA1_STEPX(SHA1_F1 , b, c, d, e, a, (c_69sK));
270     SHA1_STEP (SHA1_F1 , a, b, c, d, e, (c_70s ^ w0s12 ^ w0s19));
271     SHA1_STEP (SHA1_F1 , e, a, b, c, d, (c_71s ^ w0s12 ^ w0s16));
272     SHA1_STEP (SHA1_F1 , d, e, a, b, c, (c_72s ^ w0s05 ^ w0s11 ^ w0s12 ^ w0s13 ^ w0s16 ^ w0s18));
273     SHA1_STEP (SHA1_F1 , c, d, e, a, b, (c_73s ^ w0s20));
274     SHA1_STEP (SHA1_F1 , b, c, d, e, a, (c_74s ^ w0s08 ^ w0s16));
275     SHA1_STEP (SHA1_F1 , a, b, c, d, e, (c_75s ^ w0s06 ^ w0s12 ^ w0s14));
276
277     const u32 c_76s = rotl32 ((c_73s ^ c_68s ^ c_62s ^ c_60s), 1u);
278     const u32 c_77s = rotl32 ((c_74s ^ c_69s ^ c_63s ^ c_61s), 1u);
279     const u32 c_78s = rotl32 ((c_75s ^ c_70s ^ c_64s ^ c_62s), 1u);
280     const u32 c_79s = rotl32 ((c_76s ^ c_71s ^ c_65s ^ c_63s), 1u);
281
282     const u32x w0s21 = rotl32 (w0, 21u);
283     const u32x w0s22 = rotl32 (w0, 22U);
284
285     SHA1_STEP (SHA1_F1 , e, a, b, c, d, (c_76s ^ w0s07 ^ w0s08___w0s12 ^ w0s16 ^ w0s21));
286     SHA1_STEP (SHA1_F1 , d, e, a, b, c, (c_77s));
287     SHA1_STEP (SHA1_F1 , c, d, e, a, b, (c_78s ^ w0s07 ^ w0s08 ^ w0s15 ^ w0s18 ^ w0s20));
288     SHA1_STEP (SHA1_F1 , b, c, d, e, a, (c_79s ^ w0s08 ^ w0s22));
289
290
291     const u32x r0 = d;
292     const u32x r1 = e;
293     const u32x r2 = c;
294     const u32x r3 = b;
295
296     #include VECT_COMPARE_M
297   }
298 }
299
300 static void m00100s (u32 w[16], const u32 pw_len, __global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32x * words_buf_r, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset)
301 {
302   /**
303    * modifier
304    */
305
306   const u32 gid = get_global_id (0);
307   const u32 lid = get_local_id (0);
308
309   /**
310    * base
311    */
312
313   const u32 c_16s = rotl32 ((w[13] ^ w[ 8] ^ w[ 2]        ), 1u);
314   const u32 c_17s = rotl32 ((w[14] ^ w[ 9] ^ w[ 3] ^ w[ 1]), 1u);
315   const u32 c_18s = rotl32 ((w[15] ^ w[10] ^ w[ 4] ^ w[ 2]), 1u);
316   const u32 c_19s = rotl32 ((c_16s ^ w[11] ^ w[ 5] ^ w[ 3]), 1u);
317   const u32 c_20s = rotl32 ((c_17s ^ w[12] ^ w[ 6] ^ w[ 4]), 1u);
318   const u32 c_21s = rotl32 ((c_18s ^ w[13] ^ w[ 7] ^ w[ 5]), 1u);
319   const u32 c_22s = rotl32 ((c_19s ^ w[14] ^ w[ 8] ^ w[ 6]), 1u);
320   const u32 c_23s = rotl32 ((c_20s ^ w[15] ^ w[ 9] ^ w[ 7]), 1u);
321   const u32 c_24s = rotl32 ((c_21s ^ c_16s ^ w[10] ^ w[ 8]), 1u);
322   const u32 c_25s = rotl32 ((c_22s ^ c_17s ^ w[11] ^ w[ 9]), 1u);
323   const u32 c_26s = rotl32 ((c_23s ^ c_18s ^ w[12] ^ w[10]), 1u);
324   const u32 c_27s = rotl32 ((c_24s ^ c_19s ^ w[13] ^ w[11]), 1u);
325   const u32 c_28s = rotl32 ((c_25s ^ c_20s ^ w[14] ^ w[12]), 1u);
326   const u32 c_29s = rotl32 ((c_26s ^ c_21s ^ w[15] ^ w[13]), 1u);
327   const u32 c_30s = rotl32 ((c_27s ^ c_22s ^ c_16s ^ w[14]), 1u);
328   const u32 c_31s = rotl32 ((c_28s ^ c_23s ^ c_17s ^ w[15]), 1u);
329   const u32 c_32s = rotl32 ((c_29s ^ c_24s ^ c_18s ^ c_16s), 1u);
330   const u32 c_33s = rotl32 ((c_30s ^ c_25s ^ c_19s ^ c_17s), 1u);
331   const u32 c_34s = rotl32 ((c_31s ^ c_26s ^ c_20s ^ c_18s), 1u);
332   const u32 c_35s = rotl32 ((c_32s ^ c_27s ^ c_21s ^ c_19s), 1u);
333   const u32 c_36s = rotl32 ((c_33s ^ c_28s ^ c_22s ^ c_20s), 1u);
334   const u32 c_37s = rotl32 ((c_34s ^ c_29s ^ c_23s ^ c_21s), 1u);
335   const u32 c_38s = rotl32 ((c_35s ^ c_30s ^ c_24s ^ c_22s), 1u);
336   const u32 c_39s = rotl32 ((c_36s ^ c_31s ^ c_25s ^ c_23s), 1u);
337   const u32 c_40s = rotl32 ((c_37s ^ c_32s ^ c_26s ^ c_24s), 1u);
338   const u32 c_41s = rotl32 ((c_38s ^ c_33s ^ c_27s ^ c_25s), 1u);
339   const u32 c_42s = rotl32 ((c_39s ^ c_34s ^ c_28s ^ c_26s), 1u);
340   const u32 c_43s = rotl32 ((c_40s ^ c_35s ^ c_29s ^ c_27s), 1u);
341   const u32 c_44s = rotl32 ((c_41s ^ c_36s ^ c_30s ^ c_28s), 1u);
342   const u32 c_45s = rotl32 ((c_42s ^ c_37s ^ c_31s ^ c_29s), 1u);
343   const u32 c_46s = rotl32 ((c_43s ^ c_38s ^ c_32s ^ c_30s), 1u);
344   const u32 c_47s = rotl32 ((c_44s ^ c_39s ^ c_33s ^ c_31s), 1u);
345   const u32 c_48s = rotl32 ((c_45s ^ c_40s ^ c_34s ^ c_32s), 1u);
346   const u32 c_49s = rotl32 ((c_46s ^ c_41s ^ c_35s ^ c_33s), 1u);
347   const u32 c_50s = rotl32 ((c_47s ^ c_42s ^ c_36s ^ c_34s), 1u);
348   const u32 c_51s = rotl32 ((c_48s ^ c_43s ^ c_37s ^ c_35s), 1u);
349   const u32 c_52s = rotl32 ((c_49s ^ c_44s ^ c_38s ^ c_36s), 1u);
350   const u32 c_53s = rotl32 ((c_50s ^ c_45s ^ c_39s ^ c_37s), 1u);
351   const u32 c_54s = rotl32 ((c_51s ^ c_46s ^ c_40s ^ c_38s), 1u);
352   const u32 c_55s = rotl32 ((c_52s ^ c_47s ^ c_41s ^ c_39s), 1u);
353   const u32 c_56s = rotl32 ((c_53s ^ c_48s ^ c_42s ^ c_40s), 1u);
354   const u32 c_57s = rotl32 ((c_54s ^ c_49s ^ c_43s ^ c_41s), 1u);
355   const u32 c_58s = rotl32 ((c_55s ^ c_50s ^ c_44s ^ c_42s), 1u);
356   const u32 c_59s = rotl32 ((c_56s ^ c_51s ^ c_45s ^ c_43s), 1u);
357   const u32 c_60s = rotl32 ((c_57s ^ c_52s ^ c_46s ^ c_44s), 1u);
358   const u32 c_61s = rotl32 ((c_58s ^ c_53s ^ c_47s ^ c_45s), 1u);
359   const u32 c_62s = rotl32 ((c_59s ^ c_54s ^ c_48s ^ c_46s), 1u);
360   const u32 c_63s = rotl32 ((c_60s ^ c_55s ^ c_49s ^ c_47s), 1u);
361   const u32 c_64s = rotl32 ((c_61s ^ c_56s ^ c_50s ^ c_48s), 1u);
362   const u32 c_65s = rotl32 ((c_62s ^ c_57s ^ c_51s ^ c_49s), 1u);
363   const u32 c_66s = rotl32 ((c_63s ^ c_58s ^ c_52s ^ c_50s), 1u);
364   const u32 c_67s = rotl32 ((c_64s ^ c_59s ^ c_53s ^ c_51s), 1u);
365   const u32 c_68s = rotl32 ((c_65s ^ c_60s ^ c_54s ^ c_52s), 1u);
366   const u32 c_69s = rotl32 ((c_66s ^ c_61s ^ c_55s ^ c_53s), 1u);
367   const u32 c_70s = rotl32 ((c_67s ^ c_62s ^ c_56s ^ c_54s), 1u);
368   const u32 c_71s = rotl32 ((c_68s ^ c_63s ^ c_57s ^ c_55s), 1u);
369   const u32 c_72s = rotl32 ((c_69s ^ c_64s ^ c_58s ^ c_56s), 1u);
370   const u32 c_73s = rotl32 ((c_70s ^ c_65s ^ c_59s ^ c_57s), 1u);
371   const u32 c_74s = rotl32 ((c_71s ^ c_66s ^ c_60s ^ c_58s), 1u);
372   const u32 c_75s = rotl32 ((c_72s ^ c_67s ^ c_61s ^ c_59s), 1u);
373
374   const u32 c_17sK = c_17s + SHA1C00;
375   const u32 c_18sK = c_18s + SHA1C00;
376   const u32 c_20sK = c_20s + SHA1C01;
377   const u32 c_21sK = c_21s + SHA1C01;
378   const u32 c_23sK = c_23s + SHA1C01;
379   const u32 c_26sK = c_26s + SHA1C01;
380   const u32 c_27sK = c_27s + SHA1C01;
381   const u32 c_29sK = c_29s + SHA1C01;
382   const u32 c_33sK = c_33s + SHA1C01;
383   const u32 c_39sK = c_39s + SHA1C01;
384   const u32 c_41sK = c_41s + SHA1C02;
385   const u32 c_45sK = c_45s + SHA1C02;
386   const u32 c_53sK = c_53s + SHA1C02;
387   const u32 c_65sK = c_65s + SHA1C03;
388   const u32 c_69sK = c_69s + SHA1C03;
389
390   /**
391    * digest
392    */
393
394   const u32 search[4] =
395   {
396     digests_buf[digests_offset].digest_buf[DGST_R0],
397     digests_buf[digests_offset].digest_buf[DGST_R1],
398     digests_buf[digests_offset].digest_buf[DGST_R2],
399     digests_buf[digests_offset].digest_buf[DGST_R3]
400   };
401
402   /**
403    * reverse
404    */
405
406   const u32 e_rev = rotl32 (search[1], 2u) - SHA1C03;
407
408  /**
409    * loop
410    */
411
412   const u32 bf_loops = ceil ((float) bfs_cnt / VECT_DIV);
413
414   u32x w0l = w[0];
415
416   for (u32 il_pos = 0; il_pos < bf_loops; il_pos++)
417   {
418     const u32x w0r = words_buf_r[il_pos];
419
420     const u32x w0 = w0l | w0r;
421
422     const u32x w0s01 = rotl32 (w0, 1u);
423     const u32x w0s02 = rotl32 (w0, 2u);
424     const u32x w0s03 = rotl32 (w0, 3u);
425     const u32x w0s04 = rotl32 (w0, 4u);
426     const u32x w0s05 = rotl32 (w0, 5u);
427     const u32x w0s06 = rotl32 (w0, 6u);
428     const u32x w0s07 = rotl32 (w0, 7u);
429     const u32x w0s08 = rotl32 (w0, 8u);
430     const u32x w0s09 = rotl32 (w0, 9u);
431     const u32x w0s10 = rotl32 (w0, 10u);
432     const u32x w0s11 = rotl32 (w0, 11u);
433     const u32x w0s12 = rotl32 (w0, 12u);
434     const u32x w0s13 = rotl32 (w0, 13u);
435     const u32x w0s14 = rotl32 (w0, 14u);
436     const u32x w0s15 = rotl32 (w0, 15u);
437     const u32x w0s16 = rotl32 (w0, 16u);
438     const u32x w0s17 = rotl32 (w0, 17u);
439     const u32x w0s18 = rotl32 (w0, 18u);
440     const u32x w0s19 = rotl32 (w0, 19u);
441     const u32x w0s20 = rotl32 (w0, 20u);
442
443     const u32x w0s04___w0s06 = w0s04 ^ w0s06;
444     const u32x w0s04___w0s08 = w0s04 ^ w0s08;
445     const u32x w0s08___w0s12 = w0s08 ^ w0s12;
446     const u32x w0s04___w0s06___w0s07 = w0s04___w0s06 ^ w0s07;
447
448     u32x a = SHA1M_A;
449     u32x b = SHA1M_B;
450     u32x c = SHA1M_C;
451     u32x d = SHA1M_D;
452     u32x e = SHA1M_E;
453
454     #undef K
455     #define K SHA1C00
456
457     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0);
458     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w[ 1]);
459     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w[ 2]);
460     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w[ 3]);
461     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w[ 4]);
462     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w[ 5]);
463     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w[ 6]);
464     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w[ 7]);
465     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w[ 8]);
466     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w[ 9]);
467     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w[10]);
468     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w[11]);
469     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w[12]);
470     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w[13]);
471     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w[14]);
472     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w[15]);
473
474     SHA1_STEP (SHA1_F0o, e, a, b, c, d, (c_16s ^ w0s01));
475     SHA1_STEPX(SHA1_F0o, d, e, a, b, c, (c_17sK));
476     SHA1_STEPX(SHA1_F0o, c, d, e, a, b, (c_18sK));
477     SHA1_STEP (SHA1_F0o, b, c, d, e, a, (c_19s ^ w0s02));
478
479     #undef K
480     #define K SHA1C01
481
482     SHA1_STEPX(SHA1_F1 , a, b, c, d, e, (c_20sK));
483     SHA1_STEPX(SHA1_F1 , e, a, b, c, d, (c_21sK));
484     SHA1_STEP (SHA1_F1 , d, e, a, b, c, (c_22s ^ w0s03));
485     SHA1_STEPX(SHA1_F1 , c, d, e, a, b, (c_23sK));
486     SHA1_STEP (SHA1_F1 , b, c, d, e, a, (c_24s ^ w0s02));
487     SHA1_STEP (SHA1_F1 , a, b, c, d, e, (c_25s ^ w0s04));
488     SHA1_STEPX(SHA1_F1 , e, a, b, c, d, (c_26sK));
489     SHA1_STEPX(SHA1_F1 , d, e, a, b, c, (c_27sK));
490     SHA1_STEP (SHA1_F1 , c, d, e, a, b, (c_28s ^ w0s05));
491     SHA1_STEPX(SHA1_F1 , b, c, d, e, a, (c_29sK));
492     SHA1_STEP (SHA1_F1 , a, b, c, d, e, (c_30s ^ w0s02 ^ w0s04));
493     SHA1_STEP (SHA1_F1 , e, a, b, c, d, (c_31s ^ w0s06));
494     SHA1_STEP (SHA1_F1 , d, e, a, b, c, (c_32s ^ w0s02 ^ w0s03));
495     SHA1_STEPX(SHA1_F1 , c, d, e, a, b, (c_33sK));
496     SHA1_STEP (SHA1_F1 , b, c, d, e, a, (c_34s ^ w0s07));
497     SHA1_STEP (SHA1_F1 , a, b, c, d, e, (c_35s ^ w0s04));
498     SHA1_STEP (SHA1_F1 , e, a, b, c, d, (c_36s ^ w0s04___w0s06));
499     SHA1_STEP (SHA1_F1 , d, e, a, b, c, (c_37s ^ w0s08));
500     SHA1_STEP (SHA1_F1 , c, d, e, a, b, (c_38s ^ w0s04));
501     SHA1_STEPX(SHA1_F1 , b, c, d, e, a, (c_39sK));
502
503     #undef K
504     #define K SHA1C02
505
506     SHA1_STEP (SHA1_F2o, a, b, c, d, e, (c_40s ^ w0s04 ^ w0s09));
507     SHA1_STEPX(SHA1_F2o, e, a, b, c, d, (c_41sK));
508     SHA1_STEP (SHA1_F2o, d, e, a, b, c, (c_42s ^ w0s06 ^ w0s08));
509     SHA1_STEP (SHA1_F2o, c, d, e, a, b, (c_43s ^ w0s10));
510     SHA1_STEP (SHA1_F2o, b, c, d, e, a, (c_44s ^ w0s03 ^ w0s06 ^ w0s07));
511     SHA1_STEPX(SHA1_F2o, a, b, c, d, e, (c_45sK));
512     SHA1_STEP (SHA1_F2o, e, a, b, c, d, (c_46s ^ w0s04 ^ w0s11));
513     SHA1_STEP (SHA1_F2o, d, e, a, b, c, (c_47s ^ w0s04___w0s08));
514     SHA1_STEP (SHA1_F2o, c, d, e, a, b, (c_48s ^ w0s03 ^ w0s04___w0s08 ^ w0s05 ^ w0s10));
515     SHA1_STEP (SHA1_F2o, b, c, d, e, a, (c_49s ^ w0s12));
516     SHA1_STEP (SHA1_F2o, a, b, c, d, e, (c_50s ^ w0s08));
517     SHA1_STEP (SHA1_F2o, e, a, b, c, d, (c_51s ^ w0s04___w0s06));
518     SHA1_STEP (SHA1_F2o, d, e, a, b, c, (c_52s ^ w0s04___w0s08 ^ w0s13));
519     SHA1_STEPX(SHA1_F2o, c, d, e, a, b, (c_53sK));
520     SHA1_STEP (SHA1_F2o, b, c, d, e, a, (c_54s ^ w0s07 ^ w0s10 ^ w0s12));
521     SHA1_STEP (SHA1_F2o, a, b, c, d, e, (c_55s ^ w0s14));
522     SHA1_STEP (SHA1_F2o, e, a, b, c, d, (c_56s ^ w0s04___w0s06___w0s07 ^ w0s10 ^ w0s11));
523     SHA1_STEP (SHA1_F2o, d, e, a, b, c, (c_57s ^ w0s08));
524     SHA1_STEP (SHA1_F2o, c, d, e, a, b, (c_58s ^ w0s04___w0s08 ^ w0s15));
525     SHA1_STEP (SHA1_F2o, b, c, d, e, a, (c_59s ^ w0s08___w0s12));
526
527     #undef K
528     #define K SHA1C03
529
530     SHA1_STEP (SHA1_F1 , a, b, c, d, e, (c_60s ^ w0s04 ^ w0s08___w0s12 ^ w0s07 ^ w0s14));
531     SHA1_STEP (SHA1_F1 , e, a, b, c, d, (c_61s ^ w0s16));
532     SHA1_STEP (SHA1_F1 , d, e, a, b, c, (c_62s ^ w0s04___w0s06 ^ w0s08___w0s12));
533     SHA1_STEP (SHA1_F1 , c, d, e, a, b, (c_63s ^ w0s08));
534     SHA1_STEP (SHA1_F1 , b, c, d, e, a, (c_64s ^ w0s04___w0s06___w0s07 ^ w0s08___w0s12 ^ w0s17));
535     SHA1_STEPX(SHA1_F1 , a, b, c, d, e, (c_65sK));
536     SHA1_STEP (SHA1_F1 , e, a, b, c, d, (c_66s ^ w0s14 ^ w0s16));
537     SHA1_STEP (SHA1_F1 , d, e, a, b, c, (c_67s ^ w0s08 ^ w0s18));
538     SHA1_STEP (SHA1_F1 , c, d, e, a, b, (c_68s ^ w0s11 ^ w0s14 ^ w0s15));
539     SHA1_STEPX(SHA1_F1 , b, c, d, e, a, (c_69sK));
540     SHA1_STEP (SHA1_F1 , a, b, c, d, e, (c_70s ^ w0s12 ^ w0s19));
541     SHA1_STEP (SHA1_F1 , e, a, b, c, d, (c_71s ^ w0s12 ^ w0s16));
542     SHA1_STEP (SHA1_F1 , d, e, a, b, c, (c_72s ^ w0s05 ^ w0s11 ^ w0s12 ^ w0s13 ^ w0s16 ^ w0s18));
543     SHA1_STEP (SHA1_F1 , c, d, e, a, b, (c_73s ^ w0s20));
544     SHA1_STEP (SHA1_F1 , b, c, d, e, a, (c_74s ^ w0s08 ^ w0s16));
545
546     SHA1_STEP_PE (SHA1_F1, a, b, c, d, e, (c_75s ^ w0s06 ^ w0s12 ^ w0s14));
547
548     bool q_cond = allx (e_rev != e);
549
550     if (q_cond) continue;
551
552     SHA1_STEP_PB (SHA1_F1, a, b, c, d, e, 0);
553
554     const u32 c_76s = rotl32 ((c_73s ^ c_68s ^ c_62s ^ c_60s), 1u);
555     const u32 c_77s = rotl32 ((c_74s ^ c_69s ^ c_63s ^ c_61s), 1u);
556     const u32 c_78s = rotl32 ((c_75s ^ c_70s ^ c_64s ^ c_62s), 1u);
557     const u32 c_79s = rotl32 ((c_76s ^ c_71s ^ c_65s ^ c_63s), 1u);
558
559     const u32x w0s21 = rotl32 (w0, 21u);
560     const u32x w0s22 = rotl32 (w0, 22U);
561
562     SHA1_STEP (SHA1_F1 , e, a, b, c, d, (c_76s ^ w0s07 ^ w0s08___w0s12 ^ w0s16 ^ w0s21));
563     SHA1_STEP (SHA1_F1 , d, e, a, b, c, (c_77s));
564     SHA1_STEP (SHA1_F1 , c, d, e, a, b, (c_78s ^ w0s07 ^ w0s08 ^ w0s15 ^ w0s18 ^ w0s20));
565     SHA1_STEP (SHA1_F1 , b, c, d, e, a, (c_79s ^ w0s08 ^ w0s22));
566
567
568     const u32x r0 = d;
569     const u32x r1 = e;
570     const u32x r2 = c;
571     const u32x r3 = b;
572
573     #include VECT_COMPARE_S
574   }
575 }
576
577 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00100_m04 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32x * words_buf_r, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
578 {
579   /**
580    * base
581    */
582
583   const u32 gid = get_global_id (0);
584
585   if (gid >= gid_max) return;
586
587   u32 w[16];
588
589   w[ 0] = pws[gid].i[ 0];
590   w[ 1] = pws[gid].i[ 1];
591   w[ 2] = pws[gid].i[ 2];
592   w[ 3] = pws[gid].i[ 3];
593   w[ 4] = 0;
594   w[ 5] = 0;
595   w[ 6] = 0;
596   w[ 7] = 0;
597   w[ 8] = 0;
598   w[ 9] = 0;
599   w[10] = 0;
600   w[11] = 0;
601   w[12] = 0;
602   w[13] = 0;
603   w[14] = 0;
604   w[15] = pws[gid].i[15];
605
606   const u32 pw_len = pws[gid].pw_len;
607
608   /**
609    * main
610    */
611
612   m00100m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
613 }
614
615 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00100_m08 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32x * words_buf_r, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
616 {
617   /**
618    * base
619    */
620
621   const u32 gid = get_global_id (0);
622
623   if (gid >= gid_max) return;
624
625   u32 w[16];
626
627   w[ 0] = pws[gid].i[ 0];
628   w[ 1] = pws[gid].i[ 1];
629   w[ 2] = pws[gid].i[ 2];
630   w[ 3] = pws[gid].i[ 3];
631   w[ 4] = pws[gid].i[ 4];
632   w[ 5] = pws[gid].i[ 5];
633   w[ 6] = pws[gid].i[ 6];
634   w[ 7] = pws[gid].i[ 7];
635   w[ 8] = 0;
636   w[ 9] = 0;
637   w[10] = 0;
638   w[11] = 0;
639   w[12] = 0;
640   w[13] = 0;
641   w[14] = 0;
642   w[15] = pws[gid].i[15];
643
644   const u32 pw_len = pws[gid].pw_len;
645
646   /**
647    * main
648    */
649
650   m00100m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
651 }
652
653 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00100_m16 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32x * words_buf_r, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
654 {
655   /**
656    * base
657    */
658
659   const u32 gid = get_global_id (0);
660
661   if (gid >= gid_max) return;
662
663   u32 w[16];
664
665   w[ 0] = pws[gid].i[ 0];
666   w[ 1] = pws[gid].i[ 1];
667   w[ 2] = pws[gid].i[ 2];
668   w[ 3] = pws[gid].i[ 3];
669   w[ 4] = pws[gid].i[ 4];
670   w[ 5] = pws[gid].i[ 5];
671   w[ 6] = pws[gid].i[ 6];
672   w[ 7] = pws[gid].i[ 7];
673   w[ 8] = pws[gid].i[ 8];
674   w[ 9] = pws[gid].i[ 9];
675   w[10] = pws[gid].i[10];
676   w[11] = pws[gid].i[11];
677   w[12] = pws[gid].i[12];
678   w[13] = pws[gid].i[13];
679   w[14] = pws[gid].i[14];
680   w[15] = pws[gid].i[15];
681
682   const u32 pw_len = pws[gid].pw_len;
683
684   /**
685    * main
686    */
687
688   m00100m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
689 }
690
691 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00100_s04 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32x * words_buf_r, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
692 {
693   /**
694    * base
695    */
696
697   const u32 gid = get_global_id (0);
698
699   if (gid >= gid_max) return;
700
701   u32 w[16];
702
703   w[ 0] = pws[gid].i[ 0];
704   w[ 1] = pws[gid].i[ 1];
705   w[ 2] = pws[gid].i[ 2];
706   w[ 3] = pws[gid].i[ 3];
707   w[ 4] = 0;
708   w[ 5] = 0;
709   w[ 6] = 0;
710   w[ 7] = 0;
711   w[ 8] = 0;
712   w[ 9] = 0;
713   w[10] = 0;
714   w[11] = 0;
715   w[12] = 0;
716   w[13] = 0;
717   w[14] = 0;
718   w[15] = pws[gid].i[15];
719
720   const u32 pw_len = pws[gid].pw_len;
721
722   /**
723    * main
724    */
725
726   m00100s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
727 }
728
729 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00100_s08 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32x * words_buf_r, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
730 {
731   /**
732    * base
733    */
734
735   const u32 gid = get_global_id (0);
736
737   if (gid >= gid_max) return;
738
739   u32 w[16];
740
741   w[ 0] = pws[gid].i[ 0];
742   w[ 1] = pws[gid].i[ 1];
743   w[ 2] = pws[gid].i[ 2];
744   w[ 3] = pws[gid].i[ 3];
745   w[ 4] = pws[gid].i[ 4];
746   w[ 5] = pws[gid].i[ 5];
747   w[ 6] = pws[gid].i[ 6];
748   w[ 7] = pws[gid].i[ 7];
749   w[ 8] = 0;
750   w[ 9] = 0;
751   w[10] = 0;
752   w[11] = 0;
753   w[12] = 0;
754   w[13] = 0;
755   w[14] = 0;
756   w[15] = pws[gid].i[15];
757
758   const u32 pw_len = pws[gid].pw_len;
759
760   /**
761    * main
762    */
763
764   m00100s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
765 }
766
767 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00100_s16 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32x * words_buf_r, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
768 {
769   /**
770    * base
771    */
772
773   const u32 gid = get_global_id (0);
774
775   if (gid >= gid_max) return;
776
777   u32 w[16];
778
779   w[ 0] = pws[gid].i[ 0];
780   w[ 1] = pws[gid].i[ 1];
781   w[ 2] = pws[gid].i[ 2];
782   w[ 3] = pws[gid].i[ 3];
783   w[ 4] = pws[gid].i[ 4];
784   w[ 5] = pws[gid].i[ 5];
785   w[ 6] = pws[gid].i[ 6];
786   w[ 7] = pws[gid].i[ 7];
787   w[ 8] = pws[gid].i[ 8];
788   w[ 9] = pws[gid].i[ 9];
789   w[10] = pws[gid].i[10];
790   w[11] = pws[gid].i[11];
791   w[12] = pws[gid].i[12];
792   w[13] = pws[gid].i[13];
793   w[14] = pws[gid].i[14];
794   w[15] = pws[gid].i[15];
795
796   const u32 pw_len = pws[gid].pw_len;
797
798   /**
799    * main
800    */
801
802   m00100s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
803 }