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