2 * Author......: Jens Steube <jens.steube@gmail.com>
10 #include "include/constants.h"
11 #include "include/kernel_vendor.h"
18 #include "include/kernel_functions.c"
19 #include "OpenCL/types_ocl.c"
20 #include "OpenCL/common.c"
21 #include "OpenCL/simd.c"
23 __kernel void m04900_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)
29 const u32 lid = get_local_id (0);
35 const u32 gid = get_global_id (0);
37 if (gid >= gid_max) return;
42 pws0[0] = pws[gid].i[0];
43 pws0[1] = pws[gid].i[1];
44 pws0[2] = pws[gid].i[2];
45 pws0[3] = pws[gid].i[3];
46 pws1[0] = pws[gid].i[4];
47 pws1[1] = pws[gid].i[5];
48 pws1[2] = pws[gid].i[6];
49 pws1[3] = pws[gid].i[7];
51 const u32 pw_l_len = pws[gid].pw_len;
59 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
60 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
61 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
62 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
66 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
67 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
68 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
69 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
85 const u32 salt_len = salt_bufs[salt_pos].salt_len;
91 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos += VECT_SIZE)
93 const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
95 const u32x pw_len = pw_l_len + pw_r_len;
97 u32x wordr0[4] = { 0 };
98 u32x wordr1[4] = { 0 };
99 u32x wordr2[4] = { 0 };
100 u32x wordr3[4] = { 0 };
102 wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
103 wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
104 wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
105 wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
106 wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
107 wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
108 wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
109 wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
111 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
113 switch_buffer_by_offset_le (wordr0, wordr1, wordr2, wordr3, pw_l_len);
118 w0_t[0] = wordl0[0] | wordr0[0];
119 w0_t[1] = wordl0[1] | wordr0[1];
120 w0_t[2] = wordl0[2] | wordr0[2];
121 w0_t[3] = wordl0[3] | wordr0[3];
125 w1_t[0] = wordl1[0] | wordr1[0];
126 w1_t[1] = wordl1[1] | wordr1[1];
127 w1_t[2] = wordl1[2] | wordr1[2];
128 w1_t[3] = wordl1[3] | wordr1[3];
132 w2_t[0] = wordl2[0] | wordr2[0];
133 w2_t[1] = wordl2[1] | wordr2[1];
134 w2_t[2] = wordl2[2] | wordr2[2];
135 w2_t[3] = wordl2[3] | wordr2[3];
139 w3_t[0] = wordl3[0] | wordr3[0];
140 w3_t[1] = wordl3[1] | wordr3[1];
148 switch_buffer_by_offset_le (w0_t, w1_t, w2_t, w3_t, salt_len);
150 w0_t[0] |= salt_buf0[0];
151 w0_t[1] |= salt_buf0[1];
152 w0_t[2] |= salt_buf0[2];
153 w0_t[3] |= salt_buf0[3];
154 w1_t[0] |= salt_buf1[0];
155 w1_t[1] |= salt_buf1[1];
156 w1_t[2] |= salt_buf1[2];
157 w1_t[3] |= salt_buf1[3];
158 w2_t[0] |= salt_buf2[0];
159 w2_t[1] |= salt_buf2[1];
160 w2_t[2] |= salt_buf2[2];
161 w2_t[3] |= salt_buf2[3];
162 w3_t[0] |= salt_buf3[0];
163 w3_t[1] |= salt_buf3[1];
164 w3_t[2] |= salt_buf3[2];
165 w3_t[3] |= salt_buf3[3];
173 s0[0] = salt_buf0[0];
174 s0[1] = salt_buf0[1];
175 s0[2] = salt_buf0[2];
176 s0[3] = salt_buf0[3];
180 s1[0] = salt_buf1[0];
181 s1[1] = salt_buf1[1];
182 s1[2] = salt_buf1[2];
183 s1[3] = salt_buf1[3];
199 switch_buffer_by_offset_le (s0, s1, s2, s3, salt_len + pw_len);
218 const u32 pw_salt_len = salt_len + pw_len + salt_len;
220 append_0x80_4x4 (w0_t, w1_t, w2_t, w3_t, pw_salt_len);
222 u32x w0 = swap32 (w0_t[0]);
223 u32x w1 = swap32 (w0_t[1]);
224 u32x w2 = swap32 (w0_t[2]);
225 u32x w3 = swap32 (w0_t[3]);
226 u32x w4 = swap32 (w1_t[0]);
227 u32x w5 = swap32 (w1_t[1]);
228 u32x w6 = swap32 (w1_t[2]);
229 u32x w7 = swap32 (w1_t[3]);
230 u32x w8 = swap32 (w2_t[0]);
231 u32x w9 = swap32 (w2_t[1]);
232 u32x wa = swap32 (w2_t[2]);
233 u32x wb = swap32 (w2_t[3]);
234 u32x wc = swap32 (w3_t[0]);
235 u32x wd = swap32 (w3_t[1]);
237 u32x wf = pw_salt_len * 8;
252 SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0);
253 SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1);
254 SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2);
255 SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3);
256 SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4);
257 SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5);
258 SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6);
259 SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7);
260 SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8);
261 SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9);
262 SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa);
263 SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb);
264 SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc);
265 SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd);
266 SHA1_STEP (SHA1_F0o, b, c, d, e, a, we);
267 SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf);
268 w0 = rotl32 ((wd ^ w8 ^ w2 ^ w0), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0);
269 w1 = rotl32 ((we ^ w9 ^ w3 ^ w1), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1);
270 w2 = rotl32 ((wf ^ wa ^ w4 ^ w2), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2);
271 w3 = rotl32 ((w0 ^ wb ^ w5 ^ w3), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3);
276 w4 = rotl32 ((w1 ^ wc ^ w6 ^ w4), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4);
277 w5 = rotl32 ((w2 ^ wd ^ w7 ^ w5), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5);
278 w6 = rotl32 ((w3 ^ we ^ w8 ^ w6), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6);
279 w7 = rotl32 ((w4 ^ wf ^ w9 ^ w7), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7);
280 w8 = rotl32 ((w5 ^ w0 ^ wa ^ w8), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8);
281 w9 = rotl32 ((w6 ^ w1 ^ wb ^ w9), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9);
282 wa = rotl32 ((w7 ^ w2 ^ wc ^ wa), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa);
283 wb = rotl32 ((w8 ^ w3 ^ wd ^ wb), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb);
284 wc = rotl32 ((w9 ^ w4 ^ we ^ wc), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc);
285 wd = rotl32 ((wa ^ w5 ^ wf ^ wd), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd);
286 we = rotl32 ((wb ^ w6 ^ w0 ^ we), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we);
287 wf = rotl32 ((wc ^ w7 ^ w1 ^ wf), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf);
288 w0 = rotl32 ((wd ^ w8 ^ w2 ^ w0), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0);
289 w1 = rotl32 ((we ^ w9 ^ w3 ^ w1), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1);
290 w2 = rotl32 ((wf ^ wa ^ w4 ^ w2), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2);
291 w3 = rotl32 ((w0 ^ wb ^ w5 ^ w3), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3);
292 w4 = rotl32 ((w1 ^ wc ^ w6 ^ w4), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4);
293 w5 = rotl32 ((w2 ^ wd ^ w7 ^ w5), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5);
294 w6 = rotl32 ((w3 ^ we ^ w8 ^ w6), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6);
295 w7 = rotl32 ((w4 ^ wf ^ w9 ^ w7), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7);
300 w8 = rotl32 ((w5 ^ w0 ^ wa ^ w8), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8);
301 w9 = rotl32 ((w6 ^ w1 ^ wb ^ w9), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9);
302 wa = rotl32 ((w7 ^ w2 ^ wc ^ wa), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa);
303 wb = rotl32 ((w8 ^ w3 ^ wd ^ wb), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb);
304 wc = rotl32 ((w9 ^ w4 ^ we ^ wc), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc);
305 wd = rotl32 ((wa ^ w5 ^ wf ^ wd), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd);
306 we = rotl32 ((wb ^ w6 ^ w0 ^ we), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we);
307 wf = rotl32 ((wc ^ w7 ^ w1 ^ wf), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf);
308 w0 = rotl32 ((wd ^ w8 ^ w2 ^ w0), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0);
309 w1 = rotl32 ((we ^ w9 ^ w3 ^ w1), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1);
310 w2 = rotl32 ((wf ^ wa ^ w4 ^ w2), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2);
311 w3 = rotl32 ((w0 ^ wb ^ w5 ^ w3), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3);
312 w4 = rotl32 ((w1 ^ wc ^ w6 ^ w4), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4);
313 w5 = rotl32 ((w2 ^ wd ^ w7 ^ w5), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5);
314 w6 = rotl32 ((w3 ^ we ^ w8 ^ w6), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6);
315 w7 = rotl32 ((w4 ^ wf ^ w9 ^ w7), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7);
316 w8 = rotl32 ((w5 ^ w0 ^ wa ^ w8), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8);
317 w9 = rotl32 ((w6 ^ w1 ^ wb ^ w9), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9);
318 wa = rotl32 ((w7 ^ w2 ^ wc ^ wa), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa);
319 wb = rotl32 ((w8 ^ w3 ^ wd ^ wb), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb);
324 wc = rotl32 ((w9 ^ w4 ^ we ^ wc), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc);
325 wd = rotl32 ((wa ^ w5 ^ wf ^ wd), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd);
326 we = rotl32 ((wb ^ w6 ^ w0 ^ we), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we);
327 wf = rotl32 ((wc ^ w7 ^ w1 ^ wf), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf);
328 w0 = rotl32 ((wd ^ w8 ^ w2 ^ w0), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0);
329 w1 = rotl32 ((we ^ w9 ^ w3 ^ w1), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1);
330 w2 = rotl32 ((wf ^ wa ^ w4 ^ w2), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2);
331 w3 = rotl32 ((w0 ^ wb ^ w5 ^ w3), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3);
332 w4 = rotl32 ((w1 ^ wc ^ w6 ^ w4), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4);
333 w5 = rotl32 ((w2 ^ wd ^ w7 ^ w5), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5);
334 w6 = rotl32 ((w3 ^ we ^ w8 ^ w6), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6);
335 w7 = rotl32 ((w4 ^ wf ^ w9 ^ w7), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7);
336 w8 = rotl32 ((w5 ^ w0 ^ wa ^ w8), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8);
337 w9 = rotl32 ((w6 ^ w1 ^ wb ^ w9), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9);
338 wa = rotl32 ((w7 ^ w2 ^ wc ^ wa), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa);
339 wb = rotl32 ((w8 ^ w3 ^ wd ^ wb), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb);
340 wc = rotl32 ((w9 ^ w4 ^ we ^ wc), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc);
341 wd = rotl32 ((wa ^ w5 ^ wf ^ wd), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd);
342 we = rotl32 ((wb ^ w6 ^ w0 ^ we), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we);
343 wf = rotl32 ((wc ^ w7 ^ w1 ^ wf), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf);
344 COMPARE_M_SIMD (a, d, c, b);
348 __kernel void m04900_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)
352 __kernel void m04900_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)
356 __kernel void m04900_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)
362 const u32 lid = get_local_id (0);
368 const u32 gid = get_global_id (0);
370 if (gid >= gid_max) return;
375 pws0[0] = pws[gid].i[0];
376 pws0[1] = pws[gid].i[1];
377 pws0[2] = pws[gid].i[2];
378 pws0[3] = pws[gid].i[3];
379 pws1[0] = pws[gid].i[4];
380 pws1[1] = pws[gid].i[5];
381 pws1[2] = pws[gid].i[6];
382 pws1[3] = pws[gid].i[7];
384 const u32 pw_l_len = pws[gid].pw_len;
392 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
393 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
394 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
395 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
399 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
400 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
401 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
402 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
418 const u32 salt_len = salt_bufs[salt_pos].salt_len;
424 const u32 search[4] =
426 digests_buf[digests_offset].digest_buf[DGST_R0],
427 digests_buf[digests_offset].digest_buf[DGST_R1],
428 digests_buf[digests_offset].digest_buf[DGST_R2],
429 digests_buf[digests_offset].digest_buf[DGST_R3]
436 const u32 e_rev = rotl32_S (search[1], 2u);
442 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos += VECT_SIZE)
444 const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
446 const u32x pw_len = pw_l_len + pw_r_len;
448 u32x wordr0[4] = { 0 };
449 u32x wordr1[4] = { 0 };
450 u32x wordr2[4] = { 0 };
451 u32x wordr3[4] = { 0 };
453 wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
454 wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
455 wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
456 wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
457 wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
458 wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
459 wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
460 wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
462 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
464 switch_buffer_by_offset_le (wordr0, wordr1, wordr2, wordr3, pw_l_len);
469 w0_t[0] = wordl0[0] | wordr0[0];
470 w0_t[1] = wordl0[1] | wordr0[1];
471 w0_t[2] = wordl0[2] | wordr0[2];
472 w0_t[3] = wordl0[3] | wordr0[3];
476 w1_t[0] = wordl1[0] | wordr1[0];
477 w1_t[1] = wordl1[1] | wordr1[1];
478 w1_t[2] = wordl1[2] | wordr1[2];
479 w1_t[3] = wordl1[3] | wordr1[3];
483 w2_t[0] = wordl2[0] | wordr2[0];
484 w2_t[1] = wordl2[1] | wordr2[1];
485 w2_t[2] = wordl2[2] | wordr2[2];
486 w2_t[3] = wordl2[3] | wordr2[3];
490 w3_t[0] = wordl3[0] | wordr3[0];
491 w3_t[1] = wordl3[1] | wordr3[1];
499 switch_buffer_by_offset_le (w0_t, w1_t, w2_t, w3_t, salt_len);
501 w0_t[0] |= salt_buf0[0];
502 w0_t[1] |= salt_buf0[1];
503 w0_t[2] |= salt_buf0[2];
504 w0_t[3] |= salt_buf0[3];
505 w1_t[0] |= salt_buf1[0];
506 w1_t[1] |= salt_buf1[1];
507 w1_t[2] |= salt_buf1[2];
508 w1_t[3] |= salt_buf1[3];
509 w2_t[0] |= salt_buf2[0];
510 w2_t[1] |= salt_buf2[1];
511 w2_t[2] |= salt_buf2[2];
512 w2_t[3] |= salt_buf2[3];
513 w3_t[0] |= salt_buf3[0];
514 w3_t[1] |= salt_buf3[1];
515 w3_t[2] |= salt_buf3[2];
516 w3_t[3] |= salt_buf3[3];
524 s0[0] = salt_buf0[0];
525 s0[1] = salt_buf0[1];
526 s0[2] = salt_buf0[2];
527 s0[3] = salt_buf0[3];
531 s1[0] = salt_buf1[0];
532 s1[1] = salt_buf1[1];
533 s1[2] = salt_buf1[2];
534 s1[3] = salt_buf1[3];
550 switch_buffer_by_offset_le (s0, s1, s2, s3, salt_len + pw_len);
569 const u32 pw_salt_len = salt_len + pw_len + salt_len;
571 append_0x80_4x4 (w0_t, w1_t, w2_t, w3_t, pw_salt_len);
573 u32x w0 = swap32 (w0_t[0]);
574 u32x w1 = swap32 (w0_t[1]);
575 u32x w2 = swap32 (w0_t[2]);
576 u32x w3 = swap32 (w0_t[3]);
577 u32x w4 = swap32 (w1_t[0]);
578 u32x w5 = swap32 (w1_t[1]);
579 u32x w6 = swap32 (w1_t[2]);
580 u32x w7 = swap32 (w1_t[3]);
581 u32x w8 = swap32 (w2_t[0]);
582 u32x w9 = swap32 (w2_t[1]);
583 u32x wa = swap32 (w2_t[2]);
584 u32x wb = swap32 (w2_t[3]);
585 u32x wc = swap32 (w3_t[0]);
586 u32x wd = swap32 (w3_t[1]);
588 u32x wf = pw_salt_len * 8;
603 SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0);
604 SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1);
605 SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2);
606 SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3);
607 SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4);
608 SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5);
609 SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6);
610 SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7);
611 SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8);
612 SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9);
613 SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa);
614 SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb);
615 SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc);
616 SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd);
617 SHA1_STEP (SHA1_F0o, b, c, d, e, a, we);
618 SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf);
619 w0 = rotl32 ((wd ^ w8 ^ w2 ^ w0), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0);
620 w1 = rotl32 ((we ^ w9 ^ w3 ^ w1), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1);
621 w2 = rotl32 ((wf ^ wa ^ w4 ^ w2), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2);
622 w3 = rotl32 ((w0 ^ wb ^ w5 ^ w3), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3);
627 w4 = rotl32 ((w1 ^ wc ^ w6 ^ w4), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4);
628 w5 = rotl32 ((w2 ^ wd ^ w7 ^ w5), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5);
629 w6 = rotl32 ((w3 ^ we ^ w8 ^ w6), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6);
630 w7 = rotl32 ((w4 ^ wf ^ w9 ^ w7), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7);
631 w8 = rotl32 ((w5 ^ w0 ^ wa ^ w8), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8);
632 w9 = rotl32 ((w6 ^ w1 ^ wb ^ w9), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9);
633 wa = rotl32 ((w7 ^ w2 ^ wc ^ wa), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa);
634 wb = rotl32 ((w8 ^ w3 ^ wd ^ wb), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb);
635 wc = rotl32 ((w9 ^ w4 ^ we ^ wc), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc);
636 wd = rotl32 ((wa ^ w5 ^ wf ^ wd), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd);
637 we = rotl32 ((wb ^ w6 ^ w0 ^ we), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we);
638 wf = rotl32 ((wc ^ w7 ^ w1 ^ wf), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf);
639 w0 = rotl32 ((wd ^ w8 ^ w2 ^ w0), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0);
640 w1 = rotl32 ((we ^ w9 ^ w3 ^ w1), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1);
641 w2 = rotl32 ((wf ^ wa ^ w4 ^ w2), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2);
642 w3 = rotl32 ((w0 ^ wb ^ w5 ^ w3), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3);
643 w4 = rotl32 ((w1 ^ wc ^ w6 ^ w4), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4);
644 w5 = rotl32 ((w2 ^ wd ^ w7 ^ w5), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5);
645 w6 = rotl32 ((w3 ^ we ^ w8 ^ w6), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6);
646 w7 = rotl32 ((w4 ^ wf ^ w9 ^ w7), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7);
651 w8 = rotl32 ((w5 ^ w0 ^ wa ^ w8), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8);
652 w9 = rotl32 ((w6 ^ w1 ^ wb ^ w9), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9);
653 wa = rotl32 ((w7 ^ w2 ^ wc ^ wa), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa);
654 wb = rotl32 ((w8 ^ w3 ^ wd ^ wb), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb);
655 wc = rotl32 ((w9 ^ w4 ^ we ^ wc), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc);
656 wd = rotl32 ((wa ^ w5 ^ wf ^ wd), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd);
657 we = rotl32 ((wb ^ w6 ^ w0 ^ we), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we);
658 wf = rotl32 ((wc ^ w7 ^ w1 ^ wf), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf);
659 w0 = rotl32 ((wd ^ w8 ^ w2 ^ w0), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0);
660 w1 = rotl32 ((we ^ w9 ^ w3 ^ w1), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1);
661 w2 = rotl32 ((wf ^ wa ^ w4 ^ w2), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2);
662 w3 = rotl32 ((w0 ^ wb ^ w5 ^ w3), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3);
663 w4 = rotl32 ((w1 ^ wc ^ w6 ^ w4), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4);
664 w5 = rotl32 ((w2 ^ wd ^ w7 ^ w5), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5);
665 w6 = rotl32 ((w3 ^ we ^ w8 ^ w6), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6);
666 w7 = rotl32 ((w4 ^ wf ^ w9 ^ w7), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7);
667 w8 = rotl32 ((w5 ^ w0 ^ wa ^ w8), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8);
668 w9 = rotl32 ((w6 ^ w1 ^ wb ^ w9), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9);
669 wa = rotl32 ((w7 ^ w2 ^ wc ^ wa), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa);
670 wb = rotl32 ((w8 ^ w3 ^ wd ^ wb), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb);
675 wc = rotl32 ((w9 ^ w4 ^ we ^ wc), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc);
676 wd = rotl32 ((wa ^ w5 ^ wf ^ wd), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd);
677 we = rotl32 ((wb ^ w6 ^ w0 ^ we), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we);
678 wf = rotl32 ((wc ^ w7 ^ w1 ^ wf), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf);
679 w0 = rotl32 ((wd ^ w8 ^ w2 ^ w0), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0);
680 w1 = rotl32 ((we ^ w9 ^ w3 ^ w1), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1);
681 w2 = rotl32 ((wf ^ wa ^ w4 ^ w2), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2);
682 w3 = rotl32 ((w0 ^ wb ^ w5 ^ w3), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3);
683 w4 = rotl32 ((w1 ^ wc ^ w6 ^ w4), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4);
684 w5 = rotl32 ((w2 ^ wd ^ w7 ^ w5), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5);
685 w6 = rotl32 ((w3 ^ we ^ w8 ^ w6), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6);
686 w7 = rotl32 ((w4 ^ wf ^ w9 ^ w7), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7);
687 w8 = rotl32 ((w5 ^ w0 ^ wa ^ w8), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8);
688 w9 = rotl32 ((w6 ^ w1 ^ wb ^ w9), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9);
689 wa = rotl32 ((w7 ^ w2 ^ wc ^ wa), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa);
690 wb = rotl32 ((w8 ^ w3 ^ wd ^ wb), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb);
692 if (MATCHES_NONE_VS (e, e_rev)) continue;
694 wc = rotl32 ((w9 ^ w4 ^ we ^ wc), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc);
695 wd = rotl32 ((wa ^ w5 ^ wf ^ wd), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd);
696 we = rotl32 ((wb ^ w6 ^ w0 ^ we), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we);
697 wf = rotl32 ((wc ^ w7 ^ w1 ^ wf), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf);
698 COMPARE_S_SIMD (a, d, c, b);
702 __kernel void m04900_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)
706 __kernel void m04900_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)