Initial commit
[hashcat.git] / amd / m00140_a1.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 #ifdef  VLIW1
12 #define VECT_SIZE1
13 #endif
14
15 #ifdef  VLIW4
16 #define VECT_SIZE4
17 #endif
18
19 #ifdef  VLIW5
20 #define VECT_SIZE4
21 #endif
22
23 #define DGST_R0 3
24 #define DGST_R1 4
25 #define DGST_R2 2
26 #define DGST_R3 1
27
28 #include "include/kernel_functions.c"
29 #include "types_amd.c"
30 #include "common_amd.c"
31
32 #ifdef  VECT_SIZE1
33 #define VECT_COMPARE_S "check_single_vect1_comp4.c"
34 #define VECT_COMPARE_M "check_multi_vect1_comp4.c"
35 #endif
36
37 #ifdef  VECT_SIZE2
38 #define VECT_COMPARE_S "check_single_vect2_comp4.c"
39 #define VECT_COMPARE_M "check_multi_vect2_comp4.c"
40 #endif
41
42 #ifdef  VECT_SIZE4
43 #define VECT_COMPARE_S "check_single_vect4_comp4.c"
44 #define VECT_COMPARE_M "check_multi_vect4_comp4.c"
45 #endif
46
47 // no unicode yet
48
49 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00140_m04 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
50 {
51   /**
52    * modifier
53    */
54
55   const u32 lid = get_local_id (0);
56
57   /**
58    * base
59    */
60
61   const u32 gid = get_global_id (0);
62
63   if (gid >= gid_max) return;
64
65   u32x wordl0[4];
66
67   wordl0[0] = pws[gid].i[ 0];
68   wordl0[1] = pws[gid].i[ 1];
69   wordl0[2] = pws[gid].i[ 2];
70   wordl0[3] = pws[gid].i[ 3];
71
72   u32x wordl1[4];
73
74   wordl1[0] = pws[gid].i[ 4];
75   wordl1[1] = pws[gid].i[ 5];
76   wordl1[2] = pws[gid].i[ 6];
77   wordl1[3] = pws[gid].i[ 7];
78
79   u32x wordl2[4];
80
81   wordl2[0] = 0;
82   wordl2[1] = 0;
83   wordl2[2] = 0;
84   wordl2[3] = 0;
85
86   u32x wordl3[4];
87
88   wordl3[0] = 0;
89   wordl3[1] = 0;
90   wordl3[2] = 0;
91   wordl3[3] = 0;
92
93   const u32 pw_l_len = pws[gid].pw_len;
94
95   if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
96   {
97     switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
98   }
99
100   /**
101    * salt
102    */
103
104   u32 salt_buf0[4];
105
106   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[0];
107   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[1];
108   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[2];
109   salt_buf0[3] = salt_bufs[salt_pos].salt_buf[3];
110
111   u32 salt_buf1[4];
112
113   salt_buf1[0] = salt_bufs[salt_pos].salt_buf[4];
114   salt_buf1[1] = salt_bufs[salt_pos].salt_buf[5];
115   salt_buf1[2] = salt_bufs[salt_pos].salt_buf[6];
116   salt_buf1[3] = salt_bufs[salt_pos].salt_buf[7];
117
118   const u32 salt_len = salt_bufs[salt_pos].salt_len;
119
120   /**
121    * loop
122    */
123
124   for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
125   {
126     const u32 pw_r_len = combs_buf[il_pos].pw_len;
127
128     const u32 pw_len = pw_l_len + pw_r_len;
129
130     u32 wordr0[4];
131
132     wordr0[0] = combs_buf[il_pos].i[0];
133     wordr0[1] = combs_buf[il_pos].i[1];
134     wordr0[2] = combs_buf[il_pos].i[2];
135     wordr0[3] = combs_buf[il_pos].i[3];
136
137     u32 wordr1[4];
138
139     wordr1[0] = combs_buf[il_pos].i[4];
140     wordr1[1] = combs_buf[il_pos].i[5];
141     wordr1[2] = combs_buf[il_pos].i[6];
142     wordr1[3] = combs_buf[il_pos].i[7];
143
144     u32 wordr2[4];
145
146     wordr2[0] = 0;
147     wordr2[1] = 0;
148     wordr2[2] = 0;
149     wordr2[3] = 0;
150
151     u32 wordr3[4];
152
153     wordr3[0] = 0;
154     wordr3[1] = 0;
155     wordr3[2] = 0;
156     wordr3[3] = 0;
157
158     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
159     {
160       switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
161     }
162
163     /**
164      * prepend salt
165      */
166
167     const u32 pw_salt_len = (pw_len * 2) + salt_len;
168
169     u32x w0[4];
170     u32x w1[4];
171     u32x w2[4];
172     u32x w3[4];
173
174     w0[0] = wordl0[0] | wordr0[0];
175     w0[1] = wordl0[1] | wordr0[1];
176     w0[2] = wordl0[2] | wordr0[2];
177     w0[3] = wordl0[3] | wordr0[3];
178     w1[0] = wordl1[0] | wordr1[0];
179     w1[1] = wordl1[1] | wordr1[1];
180     w1[2] = wordl1[2] | wordr1[2];
181     w1[3] = wordl1[3] | wordr1[3];
182     w2[0] = 0;
183     w2[1] = 0;
184     w2[2] = 0;
185     w2[3] = 0;
186     w3[0] = 0;
187     w3[1] = 0;
188     w3[2] = 0;
189     w3[3] = 0;
190
191     u32x w0_t[4];
192     u32x w1_t[4];
193     u32x w2_t[4];
194     u32x w3_t[4];
195
196     make_unicode (w0, w0_t, w1_t);
197     make_unicode (w1, w2_t, w3_t);
198
199     switch_buffer_by_offset (w0_t, w1_t, w2_t, w3_t, salt_len);
200
201     w0_t[0] |= salt_buf0[0];
202     w0_t[1] |= salt_buf0[1];
203     w0_t[2] |= salt_buf0[2];
204     w0_t[3] |= salt_buf0[3];
205     w1_t[0] |= salt_buf1[0];
206     w1_t[1] |= salt_buf1[1];
207     w1_t[2] |= salt_buf1[2];
208     w1_t[3] |= salt_buf1[3];
209
210     append_0x80_4 (w0_t, w1_t, w2_t, w3_t, pw_salt_len);
211
212     w3_t[3] = pw_salt_len * 8;
213
214     /**
215      * sha1
216      */
217
218     w0_t[0] = swap_workaround (w0_t[0]);
219     w0_t[1] = swap_workaround (w0_t[1]);
220     w0_t[2] = swap_workaround (w0_t[2]);
221     w0_t[3] = swap_workaround (w0_t[3]);
222     w1_t[0] = swap_workaround (w1_t[0]);
223     w1_t[1] = swap_workaround (w1_t[1]);
224     w1_t[2] = swap_workaround (w1_t[2]);
225     w1_t[3] = swap_workaround (w1_t[3]);
226     w2_t[0] = swap_workaround (w2_t[0]);
227     w2_t[1] = swap_workaround (w2_t[1]);
228     w2_t[2] = swap_workaround (w2_t[2]);
229     w2_t[3] = swap_workaround (w2_t[3]);
230     w3_t[0] = swap_workaround (w3_t[0]);
231     w3_t[1] = swap_workaround (w3_t[1]);
232     //w3_t[2] = swap_workaround (w3_t[2]);
233     //w3_t[3] = swap_workaround (w3_t[3]);
234
235     u32x a = SHA1M_A;
236     u32x b = SHA1M_B;
237     u32x c = SHA1M_C;
238     u32x d = SHA1M_D;
239     u32x e = SHA1M_E;
240
241     #undef K
242     #define K SHA1C00
243
244     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t[0]);
245     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t[1]);
246     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w0_t[2]);
247     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w0_t[3]);
248     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w1_t[0]);
249     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w1_t[1]);
250     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t[2]);
251     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t[3]);
252     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t[0]);
253     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w2_t[1]);
254     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w2_t[2]);
255     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w2_t[3]);
256     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w3_t[0]);
257     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t[1]);
258     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t[2]);
259     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w3_t[3]);
260     w0_t[0] = rotl32 ((w3_t[1] ^ w2_t[0] ^ w0_t[2] ^ w0_t[0]), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t[0]);
261     w0_t[1] = rotl32 ((w3_t[2] ^ w2_t[1] ^ w0_t[3] ^ w0_t[1]), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w0_t[1]);
262     w0_t[2] = rotl32 ((w3_t[3] ^ w2_t[2] ^ w1_t[0] ^ w0_t[2]), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w0_t[2]);
263     w0_t[3] = rotl32 ((w0_t[0] ^ w2_t[3] ^ w1_t[1] ^ w0_t[3]), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w0_t[3]);
264
265     #undef K
266     #define K SHA1C01
267
268     w1_t[0] = rotl32 ((w0_t[1] ^ w3_t[0] ^ w1_t[2] ^ w1_t[0]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t[0]);
269     w1_t[1] = rotl32 ((w0_t[2] ^ w3_t[1] ^ w1_t[3] ^ w1_t[1]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w1_t[1]);
270     w1_t[2] = rotl32 ((w0_t[3] ^ w3_t[2] ^ w2_t[0] ^ w1_t[2]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w1_t[2]);
271     w1_t[3] = rotl32 ((w1_t[0] ^ w3_t[3] ^ w2_t[1] ^ w1_t[3]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t[3]);
272     w2_t[0] = rotl32 ((w1_t[1] ^ w0_t[0] ^ w2_t[2] ^ w2_t[0]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t[0]);
273     w2_t[1] = rotl32 ((w1_t[2] ^ w0_t[1] ^ w2_t[3] ^ w2_t[1]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w2_t[1]);
274     w2_t[2] = rotl32 ((w1_t[3] ^ w0_t[2] ^ w3_t[0] ^ w2_t[2]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t[2]);
275     w2_t[3] = rotl32 ((w2_t[0] ^ w0_t[3] ^ w3_t[1] ^ w2_t[3]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w2_t[3]);
276     w3_t[0] = rotl32 ((w2_t[1] ^ w1_t[0] ^ w3_t[2] ^ w3_t[0]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w3_t[0]);
277     w3_t[1] = rotl32 ((w2_t[2] ^ w1_t[1] ^ w3_t[3] ^ w3_t[1]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w3_t[1]);
278     w3_t[2] = rotl32 ((w2_t[3] ^ w1_t[2] ^ w0_t[0] ^ w3_t[2]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t[2]);
279     w3_t[3] = rotl32 ((w3_t[0] ^ w1_t[3] ^ w0_t[1] ^ w3_t[3]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w3_t[3]);
280     w0_t[0] = rotl32 ((w3_t[1] ^ w2_t[0] ^ w0_t[2] ^ w0_t[0]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t[0]);
281     w0_t[1] = rotl32 ((w3_t[2] ^ w2_t[1] ^ w0_t[3] ^ w0_t[1]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w0_t[1]);
282     w0_t[2] = rotl32 ((w3_t[3] ^ w2_t[2] ^ w1_t[0] ^ w0_t[2]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t[2]);
283     w0_t[3] = rotl32 ((w0_t[0] ^ w2_t[3] ^ w1_t[1] ^ w0_t[3]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w0_t[3]);
284     w1_t[0] = rotl32 ((w0_t[1] ^ w3_t[0] ^ w1_t[2] ^ w1_t[0]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w1_t[0]);
285     w1_t[1] = rotl32 ((w0_t[2] ^ w3_t[1] ^ w1_t[3] ^ w1_t[1]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w1_t[1]);
286     w1_t[2] = rotl32 ((w0_t[3] ^ w3_t[2] ^ w2_t[0] ^ w1_t[2]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t[2]);
287     w1_t[3] = rotl32 ((w1_t[0] ^ w3_t[3] ^ w2_t[1] ^ w1_t[3]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w1_t[3]);
288
289     #undef K
290     #define K SHA1C02
291
292     w2_t[0] = rotl32 ((w1_t[1] ^ w0_t[0] ^ w2_t[2] ^ w2_t[0]), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t[0]);
293     w2_t[1] = rotl32 ((w1_t[2] ^ w0_t[1] ^ w2_t[3] ^ w2_t[1]), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w2_t[1]);
294     w2_t[2] = rotl32 ((w1_t[3] ^ w0_t[2] ^ w3_t[0] ^ w2_t[2]), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w2_t[2]);
295     w2_t[3] = rotl32 ((w2_t[0] ^ w0_t[3] ^ w3_t[1] ^ w2_t[3]), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w2_t[3]);
296     w3_t[0] = rotl32 ((w2_t[1] ^ w1_t[0] ^ w3_t[2] ^ w3_t[0]), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w3_t[0]);
297     w3_t[1] = rotl32 ((w2_t[2] ^ w1_t[1] ^ w3_t[3] ^ w3_t[1]), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w3_t[1]);
298     w3_t[2] = rotl32 ((w2_t[3] ^ w1_t[2] ^ w0_t[0] ^ w3_t[2]), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t[2]);
299     w3_t[3] = rotl32 ((w3_t[0] ^ w1_t[3] ^ w0_t[1] ^ w3_t[3]), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w3_t[3]);
300     w0_t[0] = rotl32 ((w3_t[1] ^ w2_t[0] ^ w0_t[2] ^ w0_t[0]), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t[0]);
301     w0_t[1] = rotl32 ((w3_t[2] ^ w2_t[1] ^ w0_t[3] ^ w0_t[1]), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w0_t[1]);
302     w0_t[2] = rotl32 ((w3_t[3] ^ w2_t[2] ^ w1_t[0] ^ w0_t[2]), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w0_t[2]);
303     w0_t[3] = rotl32 ((w0_t[0] ^ w2_t[3] ^ w1_t[1] ^ w0_t[3]), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w0_t[3]);
304     w1_t[0] = rotl32 ((w0_t[1] ^ w3_t[0] ^ w1_t[2] ^ w1_t[0]), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w1_t[0]);
305     w1_t[1] = rotl32 ((w0_t[2] ^ w3_t[1] ^ w1_t[3] ^ w1_t[1]), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w1_t[1]);
306     w1_t[2] = rotl32 ((w0_t[3] ^ w3_t[2] ^ w2_t[0] ^ w1_t[2]), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t[2]);
307     w1_t[3] = rotl32 ((w1_t[0] ^ w3_t[3] ^ w2_t[1] ^ w1_t[3]), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w1_t[3]);
308     w2_t[0] = rotl32 ((w1_t[1] ^ w0_t[0] ^ w2_t[2] ^ w2_t[0]), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w2_t[0]);
309     w2_t[1] = rotl32 ((w1_t[2] ^ w0_t[1] ^ w2_t[3] ^ w2_t[1]), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w2_t[1]);
310     w2_t[2] = rotl32 ((w1_t[3] ^ w0_t[2] ^ w3_t[0] ^ w2_t[2]), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w2_t[2]);
311     w2_t[3] = rotl32 ((w2_t[0] ^ w0_t[3] ^ w3_t[1] ^ w2_t[3]), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w2_t[3]);
312
313     #undef K
314     #define K SHA1C03
315
316     w3_t[0] = rotl32 ((w2_t[1] ^ w1_t[0] ^ w3_t[2] ^ w3_t[0]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t[0]);
317     w3_t[1] = rotl32 ((w2_t[2] ^ w1_t[1] ^ w3_t[3] ^ w3_t[1]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w3_t[1]);
318     w3_t[2] = rotl32 ((w2_t[3] ^ w1_t[2] ^ w0_t[0] ^ w3_t[2]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t[2]);
319     w3_t[3] = rotl32 ((w3_t[0] ^ w1_t[3] ^ w0_t[1] ^ w3_t[3]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w3_t[3]);
320     w0_t[0] = rotl32 ((w3_t[1] ^ w2_t[0] ^ w0_t[2] ^ w0_t[0]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t[0]);
321     w0_t[1] = rotl32 ((w3_t[2] ^ w2_t[1] ^ w0_t[3] ^ w0_t[1]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w0_t[1]);
322     w0_t[2] = rotl32 ((w3_t[3] ^ w2_t[2] ^ w1_t[0] ^ w0_t[2]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w0_t[2]);
323     w0_t[3] = rotl32 ((w0_t[0] ^ w2_t[3] ^ w1_t[1] ^ w0_t[3]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t[3]);
324     w1_t[0] = rotl32 ((w0_t[1] ^ w3_t[0] ^ w1_t[2] ^ w1_t[0]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t[0]);
325     w1_t[1] = rotl32 ((w0_t[2] ^ w3_t[1] ^ w1_t[3] ^ w1_t[1]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w1_t[1]);
326     w1_t[2] = rotl32 ((w0_t[3] ^ w3_t[2] ^ w2_t[0] ^ w1_t[2]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t[2]);
327     w1_t[3] = rotl32 ((w1_t[0] ^ w3_t[3] ^ w2_t[1] ^ w1_t[3]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w1_t[3]);
328     w2_t[0] = rotl32 ((w1_t[1] ^ w0_t[0] ^ w2_t[2] ^ w2_t[0]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w2_t[0]);
329     w2_t[1] = rotl32 ((w1_t[2] ^ w0_t[1] ^ w2_t[3] ^ w2_t[1]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w2_t[1]);
330     w2_t[2] = rotl32 ((w1_t[3] ^ w0_t[2] ^ w3_t[0] ^ w2_t[2]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t[2]);
331     w2_t[3] = rotl32 ((w2_t[0] ^ w0_t[3] ^ w3_t[1] ^ w2_t[3]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w2_t[3]);
332     w3_t[0] = rotl32 ((w2_t[1] ^ w1_t[0] ^ w3_t[2] ^ w3_t[0]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w3_t[0]);
333     w3_t[1] = rotl32 ((w2_t[2] ^ w1_t[1] ^ w3_t[3] ^ w3_t[1]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t[1]);
334     w3_t[2] = rotl32 ((w2_t[3] ^ w1_t[2] ^ w0_t[0] ^ w3_t[2]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w3_t[2]);
335     w3_t[3] = rotl32 ((w3_t[0] ^ w1_t[3] ^ w0_t[1] ^ w3_t[3]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w3_t[3]);
336
337
338     const u32x r0 = d;
339     const u32x r1 = e;
340     const u32x r2 = c;
341     const u32x r3 = b;
342
343     #include VECT_COMPARE_M
344   }
345 }
346
347 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00140_m08 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
348 {
349 }
350
351 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00140_m16 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
352 {
353 }
354
355 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00140_s04 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
356 {
357   /**
358    * modifier
359    */
360
361   const u32 lid = get_local_id (0);
362
363   /**
364    * base
365    */
366
367   const u32 gid = get_global_id (0);
368
369   if (gid >= gid_max) return;
370
371   u32x wordl0[4];
372
373   wordl0[0] = pws[gid].i[ 0];
374   wordl0[1] = pws[gid].i[ 1];
375   wordl0[2] = pws[gid].i[ 2];
376   wordl0[3] = pws[gid].i[ 3];
377
378   u32x wordl1[4];
379
380   wordl1[0] = pws[gid].i[ 4];
381   wordl1[1] = pws[gid].i[ 5];
382   wordl1[2] = pws[gid].i[ 6];
383   wordl1[3] = pws[gid].i[ 7];
384
385   u32x wordl2[4];
386
387   wordl2[0] = 0;
388   wordl2[1] = 0;
389   wordl2[2] = 0;
390   wordl2[3] = 0;
391
392   u32x wordl3[4];
393
394   wordl3[0] = 0;
395   wordl3[1] = 0;
396   wordl3[2] = 0;
397   wordl3[3] = 0;
398
399   const u32 pw_l_len = pws[gid].pw_len;
400
401   if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
402   {
403     switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
404   }
405
406   /**
407    * salt
408    */
409
410   u32 salt_buf0[4];
411
412   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[0];
413   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[1];
414   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[2];
415   salt_buf0[3] = salt_bufs[salt_pos].salt_buf[3];
416
417   u32 salt_buf1[4];
418
419   salt_buf1[0] = salt_bufs[salt_pos].salt_buf[4];
420   salt_buf1[1] = salt_bufs[salt_pos].salt_buf[5];
421   salt_buf1[2] = salt_bufs[salt_pos].salt_buf[6];
422   salt_buf1[3] = salt_bufs[salt_pos].salt_buf[7];
423
424   const u32 salt_len = salt_bufs[salt_pos].salt_len;
425
426   /**
427    * digest
428    */
429
430   const u32 search[4] =
431   {
432     digests_buf[digests_offset].digest_buf[DGST_R0],
433     digests_buf[digests_offset].digest_buf[DGST_R1],
434     digests_buf[digests_offset].digest_buf[DGST_R2],
435     digests_buf[digests_offset].digest_buf[DGST_R3]
436   };
437
438   /**
439    * reverse
440    */
441
442   const u32 e_rev = rotl32 (search[1], 2u);
443
444   /**
445    * loop
446    */
447
448   for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
449   {
450     const u32 pw_r_len = combs_buf[il_pos].pw_len;
451
452     const u32 pw_len = pw_l_len + pw_r_len;
453
454     u32 wordr0[4];
455
456     wordr0[0] = combs_buf[il_pos].i[0];
457     wordr0[1] = combs_buf[il_pos].i[1];
458     wordr0[2] = combs_buf[il_pos].i[2];
459     wordr0[3] = combs_buf[il_pos].i[3];
460
461     u32 wordr1[4];
462
463     wordr1[0] = combs_buf[il_pos].i[4];
464     wordr1[1] = combs_buf[il_pos].i[5];
465     wordr1[2] = combs_buf[il_pos].i[6];
466     wordr1[3] = combs_buf[il_pos].i[7];
467
468     u32 wordr2[4];
469
470     wordr2[0] = 0;
471     wordr2[1] = 0;
472     wordr2[2] = 0;
473     wordr2[3] = 0;
474
475     u32 wordr3[4];
476
477     wordr3[0] = 0;
478     wordr3[1] = 0;
479     wordr3[2] = 0;
480     wordr3[3] = 0;
481
482     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
483     {
484       switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
485     }
486
487     /**
488      * prepend salt
489      */
490
491     const u32 pw_salt_len = (pw_len * 2) + salt_len;
492
493     u32x w0[4];
494     u32x w1[4];
495     u32x w2[4];
496     u32x w3[4];
497
498     w0[0] = wordl0[0] | wordr0[0];
499     w0[1] = wordl0[1] | wordr0[1];
500     w0[2] = wordl0[2] | wordr0[2];
501     w0[3] = wordl0[3] | wordr0[3];
502     w1[0] = wordl1[0] | wordr1[0];
503     w1[1] = wordl1[1] | wordr1[1];
504     w1[2] = wordl1[2] | wordr1[2];
505     w1[3] = wordl1[3] | wordr1[3];
506     w2[0] = 0;
507     w2[1] = 0;
508     w2[2] = 0;
509     w2[3] = 0;
510     w3[0] = 0;
511     w3[1] = 0;
512     w3[2] = 0;
513     w3[3] = 0;
514
515     u32x w0_t[4];
516     u32x w1_t[4];
517     u32x w2_t[4];
518     u32x w3_t[4];
519
520     make_unicode (w0, w0_t, w1_t);
521     make_unicode (w1, w2_t, w3_t);
522
523     switch_buffer_by_offset (w0_t, w1_t, w2_t, w3_t, salt_len);
524
525     w0_t[0] |= salt_buf0[0];
526     w0_t[1] |= salt_buf0[1];
527     w0_t[2] |= salt_buf0[2];
528     w0_t[3] |= salt_buf0[3];
529     w1_t[0] |= salt_buf1[0];
530     w1_t[1] |= salt_buf1[1];
531     w1_t[2] |= salt_buf1[2];
532     w1_t[3] |= salt_buf1[3];
533
534     append_0x80_4 (w0_t, w1_t, w2_t, w3_t, pw_salt_len);
535
536     w3_t[3] = pw_salt_len * 8;
537
538     /**
539      * sha1
540      */
541
542     w0_t[0] = swap_workaround (w0_t[0]);
543     w0_t[1] = swap_workaround (w0_t[1]);
544     w0_t[2] = swap_workaround (w0_t[2]);
545     w0_t[3] = swap_workaround (w0_t[3]);
546     w1_t[0] = swap_workaround (w1_t[0]);
547     w1_t[1] = swap_workaround (w1_t[1]);
548     w1_t[2] = swap_workaround (w1_t[2]);
549     w1_t[3] = swap_workaround (w1_t[3]);
550     w2_t[0] = swap_workaround (w2_t[0]);
551     w2_t[1] = swap_workaround (w2_t[1]);
552     w2_t[2] = swap_workaround (w2_t[2]);
553     w2_t[3] = swap_workaround (w2_t[3]);
554     w3_t[0] = swap_workaround (w3_t[0]);
555     w3_t[1] = swap_workaround (w3_t[1]);
556     //w3_t[2] = swap_workaround (w3_t[2]);
557     //w3_t[3] = swap_workaround (w3_t[3]);
558
559     u32x a = SHA1M_A;
560     u32x b = SHA1M_B;
561     u32x c = SHA1M_C;
562     u32x d = SHA1M_D;
563     u32x e = SHA1M_E;
564
565     #undef K
566     #define K SHA1C00
567
568     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t[0]);
569     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t[1]);
570     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w0_t[2]);
571     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w0_t[3]);
572     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w1_t[0]);
573     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w1_t[1]);
574     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t[2]);
575     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t[3]);
576     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t[0]);
577     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w2_t[1]);
578     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w2_t[2]);
579     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w2_t[3]);
580     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w3_t[0]);
581     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t[1]);
582     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t[2]);
583     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w3_t[3]);
584     w0_t[0] = rotl32 ((w3_t[1] ^ w2_t[0] ^ w0_t[2] ^ w0_t[0]), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t[0]);
585     w0_t[1] = rotl32 ((w3_t[2] ^ w2_t[1] ^ w0_t[3] ^ w0_t[1]), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w0_t[1]);
586     w0_t[2] = rotl32 ((w3_t[3] ^ w2_t[2] ^ w1_t[0] ^ w0_t[2]), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w0_t[2]);
587     w0_t[3] = rotl32 ((w0_t[0] ^ w2_t[3] ^ w1_t[1] ^ w0_t[3]), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w0_t[3]);
588
589     #undef K
590     #define K SHA1C01
591
592     w1_t[0] = rotl32 ((w0_t[1] ^ w3_t[0] ^ w1_t[2] ^ w1_t[0]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t[0]);
593     w1_t[1] = rotl32 ((w0_t[2] ^ w3_t[1] ^ w1_t[3] ^ w1_t[1]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w1_t[1]);
594     w1_t[2] = rotl32 ((w0_t[3] ^ w3_t[2] ^ w2_t[0] ^ w1_t[2]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w1_t[2]);
595     w1_t[3] = rotl32 ((w1_t[0] ^ w3_t[3] ^ w2_t[1] ^ w1_t[3]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t[3]);
596     w2_t[0] = rotl32 ((w1_t[1] ^ w0_t[0] ^ w2_t[2] ^ w2_t[0]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t[0]);
597     w2_t[1] = rotl32 ((w1_t[2] ^ w0_t[1] ^ w2_t[3] ^ w2_t[1]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w2_t[1]);
598     w2_t[2] = rotl32 ((w1_t[3] ^ w0_t[2] ^ w3_t[0] ^ w2_t[2]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t[2]);
599     w2_t[3] = rotl32 ((w2_t[0] ^ w0_t[3] ^ w3_t[1] ^ w2_t[3]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w2_t[3]);
600     w3_t[0] = rotl32 ((w2_t[1] ^ w1_t[0] ^ w3_t[2] ^ w3_t[0]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w3_t[0]);
601     w3_t[1] = rotl32 ((w2_t[2] ^ w1_t[1] ^ w3_t[3] ^ w3_t[1]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w3_t[1]);
602     w3_t[2] = rotl32 ((w2_t[3] ^ w1_t[2] ^ w0_t[0] ^ w3_t[2]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t[2]);
603     w3_t[3] = rotl32 ((w3_t[0] ^ w1_t[3] ^ w0_t[1] ^ w3_t[3]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w3_t[3]);
604     w0_t[0] = rotl32 ((w3_t[1] ^ w2_t[0] ^ w0_t[2] ^ w0_t[0]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t[0]);
605     w0_t[1] = rotl32 ((w3_t[2] ^ w2_t[1] ^ w0_t[3] ^ w0_t[1]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w0_t[1]);
606     w0_t[2] = rotl32 ((w3_t[3] ^ w2_t[2] ^ w1_t[0] ^ w0_t[2]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t[2]);
607     w0_t[3] = rotl32 ((w0_t[0] ^ w2_t[3] ^ w1_t[1] ^ w0_t[3]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w0_t[3]);
608     w1_t[0] = rotl32 ((w0_t[1] ^ w3_t[0] ^ w1_t[2] ^ w1_t[0]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w1_t[0]);
609     w1_t[1] = rotl32 ((w0_t[2] ^ w3_t[1] ^ w1_t[3] ^ w1_t[1]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w1_t[1]);
610     w1_t[2] = rotl32 ((w0_t[3] ^ w3_t[2] ^ w2_t[0] ^ w1_t[2]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t[2]);
611     w1_t[3] = rotl32 ((w1_t[0] ^ w3_t[3] ^ w2_t[1] ^ w1_t[3]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w1_t[3]);
612
613     #undef K
614     #define K SHA1C02
615
616     w2_t[0] = rotl32 ((w1_t[1] ^ w0_t[0] ^ w2_t[2] ^ w2_t[0]), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t[0]);
617     w2_t[1] = rotl32 ((w1_t[2] ^ w0_t[1] ^ w2_t[3] ^ w2_t[1]), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w2_t[1]);
618     w2_t[2] = rotl32 ((w1_t[3] ^ w0_t[2] ^ w3_t[0] ^ w2_t[2]), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w2_t[2]);
619     w2_t[3] = rotl32 ((w2_t[0] ^ w0_t[3] ^ w3_t[1] ^ w2_t[3]), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w2_t[3]);
620     w3_t[0] = rotl32 ((w2_t[1] ^ w1_t[0] ^ w3_t[2] ^ w3_t[0]), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w3_t[0]);
621     w3_t[1] = rotl32 ((w2_t[2] ^ w1_t[1] ^ w3_t[3] ^ w3_t[1]), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w3_t[1]);
622     w3_t[2] = rotl32 ((w2_t[3] ^ w1_t[2] ^ w0_t[0] ^ w3_t[2]), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t[2]);
623     w3_t[3] = rotl32 ((w3_t[0] ^ w1_t[3] ^ w0_t[1] ^ w3_t[3]), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w3_t[3]);
624     w0_t[0] = rotl32 ((w3_t[1] ^ w2_t[0] ^ w0_t[2] ^ w0_t[0]), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t[0]);
625     w0_t[1] = rotl32 ((w3_t[2] ^ w2_t[1] ^ w0_t[3] ^ w0_t[1]), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w0_t[1]);
626     w0_t[2] = rotl32 ((w3_t[3] ^ w2_t[2] ^ w1_t[0] ^ w0_t[2]), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w0_t[2]);
627     w0_t[3] = rotl32 ((w0_t[0] ^ w2_t[3] ^ w1_t[1] ^ w0_t[3]), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w0_t[3]);
628     w1_t[0] = rotl32 ((w0_t[1] ^ w3_t[0] ^ w1_t[2] ^ w1_t[0]), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w1_t[0]);
629     w1_t[1] = rotl32 ((w0_t[2] ^ w3_t[1] ^ w1_t[3] ^ w1_t[1]), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w1_t[1]);
630     w1_t[2] = rotl32 ((w0_t[3] ^ w3_t[2] ^ w2_t[0] ^ w1_t[2]), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t[2]);
631     w1_t[3] = rotl32 ((w1_t[0] ^ w3_t[3] ^ w2_t[1] ^ w1_t[3]), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w1_t[3]);
632     w2_t[0] = rotl32 ((w1_t[1] ^ w0_t[0] ^ w2_t[2] ^ w2_t[0]), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w2_t[0]);
633     w2_t[1] = rotl32 ((w1_t[2] ^ w0_t[1] ^ w2_t[3] ^ w2_t[1]), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w2_t[1]);
634     w2_t[2] = rotl32 ((w1_t[3] ^ w0_t[2] ^ w3_t[0] ^ w2_t[2]), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w2_t[2]);
635     w2_t[3] = rotl32 ((w2_t[0] ^ w0_t[3] ^ w3_t[1] ^ w2_t[3]), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w2_t[3]);
636
637     #undef K
638     #define K SHA1C03
639
640     w3_t[0] = rotl32 ((w2_t[1] ^ w1_t[0] ^ w3_t[2] ^ w3_t[0]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t[0]);
641     w3_t[1] = rotl32 ((w2_t[2] ^ w1_t[1] ^ w3_t[3] ^ w3_t[1]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w3_t[1]);
642     w3_t[2] = rotl32 ((w2_t[3] ^ w1_t[2] ^ w0_t[0] ^ w3_t[2]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t[2]);
643     w3_t[3] = rotl32 ((w3_t[0] ^ w1_t[3] ^ w0_t[1] ^ w3_t[3]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w3_t[3]);
644     w0_t[0] = rotl32 ((w3_t[1] ^ w2_t[0] ^ w0_t[2] ^ w0_t[0]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t[0]);
645     w0_t[1] = rotl32 ((w3_t[2] ^ w2_t[1] ^ w0_t[3] ^ w0_t[1]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w0_t[1]);
646     w0_t[2] = rotl32 ((w3_t[3] ^ w2_t[2] ^ w1_t[0] ^ w0_t[2]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w0_t[2]);
647     w0_t[3] = rotl32 ((w0_t[0] ^ w2_t[3] ^ w1_t[1] ^ w0_t[3]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t[3]);
648     w1_t[0] = rotl32 ((w0_t[1] ^ w3_t[0] ^ w1_t[2] ^ w1_t[0]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t[0]);
649     w1_t[1] = rotl32 ((w0_t[2] ^ w3_t[1] ^ w1_t[3] ^ w1_t[1]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w1_t[1]);
650     w1_t[2] = rotl32 ((w0_t[3] ^ w3_t[2] ^ w2_t[0] ^ w1_t[2]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t[2]);
651     w1_t[3] = rotl32 ((w1_t[0] ^ w3_t[3] ^ w2_t[1] ^ w1_t[3]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w1_t[3]);
652     w2_t[0] = rotl32 ((w1_t[1] ^ w0_t[0] ^ w2_t[2] ^ w2_t[0]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w2_t[0]);
653     w2_t[1] = rotl32 ((w1_t[2] ^ w0_t[1] ^ w2_t[3] ^ w2_t[1]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w2_t[1]);
654     w2_t[2] = rotl32 ((w1_t[3] ^ w0_t[2] ^ w3_t[0] ^ w2_t[2]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t[2]);
655     w2_t[3] = rotl32 ((w2_t[0] ^ w0_t[3] ^ w3_t[1] ^ w2_t[3]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w2_t[3]);
656     w3_t[0] = rotl32 ((w2_t[1] ^ w1_t[0] ^ w3_t[2] ^ w3_t[0]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w3_t[0]);
657
658     if (allx (e != e_rev)) continue;
659
660     w3_t[1] = rotl32 ((w2_t[2] ^ w1_t[1] ^ w3_t[3] ^ w3_t[1]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t[1]);
661     w3_t[2] = rotl32 ((w2_t[3] ^ w1_t[2] ^ w0_t[0] ^ w3_t[2]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w3_t[2]);
662     w3_t[3] = rotl32 ((w3_t[0] ^ w1_t[3] ^ w0_t[1] ^ w3_t[3]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w3_t[3]);
663
664
665     const u32x r0 = d;
666     const u32x r1 = e;
667     const u32x r2 = c;
668     const u32x r3 = b;
669
670     #include VECT_COMPARE_S
671   }
672 }
673
674 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00140_s08 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
675 {
676 }
677
678 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00140_s16 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
679 {
680 }