2 * Author......: Jens Steube <jens.steube@gmail.com>
10 #include "inc_vendor.cl"
11 #include "inc_hash_constants.h"
12 #include "inc_hash_functions.cl"
13 #include "inc_types.cl"
14 #include "inc_common.cl"
15 #include "inc_simd.cl"
17 __constant u32 k_sha256[64] =
19 SHA256C00, SHA256C01, SHA256C02, SHA256C03,
20 SHA256C04, SHA256C05, SHA256C06, SHA256C07,
21 SHA256C08, SHA256C09, SHA256C0a, SHA256C0b,
22 SHA256C0c, SHA256C0d, SHA256C0e, SHA256C0f,
23 SHA256C10, SHA256C11, SHA256C12, SHA256C13,
24 SHA256C14, SHA256C15, SHA256C16, SHA256C17,
25 SHA256C18, SHA256C19, SHA256C1a, SHA256C1b,
26 SHA256C1c, SHA256C1d, SHA256C1e, SHA256C1f,
27 SHA256C20, SHA256C21, SHA256C22, SHA256C23,
28 SHA256C24, SHA256C25, SHA256C26, SHA256C27,
29 SHA256C28, SHA256C29, SHA256C2a, SHA256C2b,
30 SHA256C2c, SHA256C2d, SHA256C2e, SHA256C2f,
31 SHA256C30, SHA256C31, SHA256C32, SHA256C33,
32 SHA256C34, SHA256C35, SHA256C36, SHA256C37,
33 SHA256C38, SHA256C39, SHA256C3a, SHA256C3b,
34 SHA256C3c, SHA256C3d, SHA256C3e, SHA256C3f,
37 void sha256_transform (const u32x w0[4], const u32x w1[4], const u32x w2[4], const u32x w3[4], u32x digest[8])
65 #define ROUND_EXPAND() \
67 w0_t = SHA256_EXPAND (we_t, w9_t, w1_t, w0_t); \
68 w1_t = SHA256_EXPAND (wf_t, wa_t, w2_t, w1_t); \
69 w2_t = SHA256_EXPAND (w0_t, wb_t, w3_t, w2_t); \
70 w3_t = SHA256_EXPAND (w1_t, wc_t, w4_t, w3_t); \
71 w4_t = SHA256_EXPAND (w2_t, wd_t, w5_t, w4_t); \
72 w5_t = SHA256_EXPAND (w3_t, we_t, w6_t, w5_t); \
73 w6_t = SHA256_EXPAND (w4_t, wf_t, w7_t, w6_t); \
74 w7_t = SHA256_EXPAND (w5_t, w0_t, w8_t, w7_t); \
75 w8_t = SHA256_EXPAND (w6_t, w1_t, w9_t, w8_t); \
76 w9_t = SHA256_EXPAND (w7_t, w2_t, wa_t, w9_t); \
77 wa_t = SHA256_EXPAND (w8_t, w3_t, wb_t, wa_t); \
78 wb_t = SHA256_EXPAND (w9_t, w4_t, wc_t, wb_t); \
79 wc_t = SHA256_EXPAND (wa_t, w5_t, wd_t, wc_t); \
80 wd_t = SHA256_EXPAND (wb_t, w6_t, we_t, wd_t); \
81 we_t = SHA256_EXPAND (wc_t, w7_t, wf_t, we_t); \
82 wf_t = SHA256_EXPAND (wd_t, w8_t, w0_t, wf_t); \
85 #define ROUND_STEP(i) \
87 SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w0_t, k_sha256[i + 0]); \
88 SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w1_t, k_sha256[i + 1]); \
89 SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, w2_t, k_sha256[i + 2]); \
90 SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, w3_t, k_sha256[i + 3]); \
91 SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, w4_t, k_sha256[i + 4]); \
92 SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, w5_t, k_sha256[i + 5]); \
93 SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, w6_t, k_sha256[i + 6]); \
94 SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, w7_t, k_sha256[i + 7]); \
95 SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w8_t, k_sha256[i + 8]); \
96 SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w9_t, k_sha256[i + 9]); \
97 SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, wa_t, k_sha256[i + 10]); \
98 SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, wb_t, k_sha256[i + 11]); \
99 SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, wc_t, k_sha256[i + 12]); \
100 SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, wd_t, k_sha256[i + 13]); \
101 SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, we_t, k_sha256[i + 14]); \
102 SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, wf_t, k_sha256[i + 15]); \
110 for (int i = 16; i < 64; i += 16)
112 ROUND_EXPAND (); ROUND_STEP (i);
125 void hmac_sha256_pad (u32x w0[4], u32x w1[4], u32x w2[4], u32x w3[4], u32x ipad[8], u32x opad[8])
127 w0[0] = w0[0] ^ 0x36363636;
128 w0[1] = w0[1] ^ 0x36363636;
129 w0[2] = w0[2] ^ 0x36363636;
130 w0[3] = w0[3] ^ 0x36363636;
131 w1[0] = w1[0] ^ 0x36363636;
132 w1[1] = w1[1] ^ 0x36363636;
133 w1[2] = w1[2] ^ 0x36363636;
134 w1[3] = w1[3] ^ 0x36363636;
135 w2[0] = w2[0] ^ 0x36363636;
136 w2[1] = w2[1] ^ 0x36363636;
137 w2[2] = w2[2] ^ 0x36363636;
138 w2[3] = w2[3] ^ 0x36363636;
139 w3[0] = w3[0] ^ 0x36363636;
140 w3[1] = w3[1] ^ 0x36363636;
141 w3[2] = w3[2] ^ 0x36363636;
142 w3[3] = w3[3] ^ 0x36363636;
153 sha256_transform (w0, w1, w2, w3, ipad);
155 w0[0] = w0[0] ^ 0x6a6a6a6a;
156 w0[1] = w0[1] ^ 0x6a6a6a6a;
157 w0[2] = w0[2] ^ 0x6a6a6a6a;
158 w0[3] = w0[3] ^ 0x6a6a6a6a;
159 w1[0] = w1[0] ^ 0x6a6a6a6a;
160 w1[1] = w1[1] ^ 0x6a6a6a6a;
161 w1[2] = w1[2] ^ 0x6a6a6a6a;
162 w1[3] = w1[3] ^ 0x6a6a6a6a;
163 w2[0] = w2[0] ^ 0x6a6a6a6a;
164 w2[1] = w2[1] ^ 0x6a6a6a6a;
165 w2[2] = w2[2] ^ 0x6a6a6a6a;
166 w2[3] = w2[3] ^ 0x6a6a6a6a;
167 w3[0] = w3[0] ^ 0x6a6a6a6a;
168 w3[1] = w3[1] ^ 0x6a6a6a6a;
169 w3[2] = w3[2] ^ 0x6a6a6a6a;
170 w3[3] = w3[3] ^ 0x6a6a6a6a;
181 sha256_transform (w0, w1, w2, w3, opad);
184 void hmac_sha256_run (u32x w0[4], u32x w1[4], u32x w2[4], u32x w3[4], u32x ipad[8], u32x opad[8], u32x digest[8])
195 sha256_transform (w0, w1, w2, w3, digest);
212 w3[3] = (64 + 32) * 8;
223 sha256_transform (w0, w1, w2, w3, digest);
226 __kernel void m01450_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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
232 const u32 lid = get_local_id (0);
238 const u32 gid = get_global_id (0);
240 if (gid >= gid_max) return;
245 pw_buf0[0] = pws[gid].i[0];
246 pw_buf0[1] = pws[gid].i[1];
247 pw_buf0[2] = pws[gid].i[2];
248 pw_buf0[3] = pws[gid].i[3];
249 pw_buf1[0] = pws[gid].i[4];
250 pw_buf1[1] = pws[gid].i[5];
251 pw_buf1[2] = pws[gid].i[6];
252 pw_buf1[3] = pws[gid].i[7];
254 const u32 pw_l_len = pws[gid].pw_len;
265 salt_buf0[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 0]);
266 salt_buf0[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 1]);
267 salt_buf0[2] = swap32_S (salt_bufs[salt_pos].salt_buf[ 2]);
268 salt_buf0[3] = swap32_S (salt_bufs[salt_pos].salt_buf[ 3]);
269 salt_buf1[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 4]);
270 salt_buf1[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 5]);
271 salt_buf1[2] = swap32_S (salt_bufs[salt_pos].salt_buf[ 6]);
272 salt_buf1[3] = swap32_S (salt_bufs[salt_pos].salt_buf[ 7]);
273 salt_buf2[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 8]);
274 salt_buf2[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 9]);
275 salt_buf2[2] = swap32_S (salt_bufs[salt_pos].salt_buf[10]);
276 salt_buf2[3] = swap32_S (salt_bufs[salt_pos].salt_buf[11]);
277 salt_buf3[0] = swap32_S (salt_bufs[salt_pos].salt_buf[12]);
278 salt_buf3[1] = swap32_S (salt_bufs[salt_pos].salt_buf[13]);
279 salt_buf3[2] = swap32_S (salt_bufs[salt_pos].salt_buf[14]);
280 salt_buf3[3] = swap32_S (salt_bufs[salt_pos].salt_buf[15]);
282 const u32 salt_len = salt_bufs[salt_pos].salt_len;
288 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
290 const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
292 const u32x pw_len = pw_l_len + pw_r_len;
295 * concat password candidate
298 u32x wordl0[4] = { 0 };
299 u32x wordl1[4] = { 0 };
300 u32x wordl2[4] = { 0 };
301 u32x wordl3[4] = { 0 };
303 wordl0[0] = pw_buf0[0];
304 wordl0[1] = pw_buf0[1];
305 wordl0[2] = pw_buf0[2];
306 wordl0[3] = pw_buf0[3];
307 wordl1[0] = pw_buf1[0];
308 wordl1[1] = pw_buf1[1];
309 wordl1[2] = pw_buf1[2];
310 wordl1[3] = pw_buf1[3];
312 u32x wordr0[4] = { 0 };
313 u32x wordr1[4] = { 0 };
314 u32x wordr2[4] = { 0 };
315 u32x wordr3[4] = { 0 };
317 wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
318 wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
319 wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
320 wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
321 wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
322 wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
323 wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
324 wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
326 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
328 switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
332 switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
340 w0[0] = wordl0[0] | wordr0[0];
341 w0[1] = wordl0[1] | wordr0[1];
342 w0[2] = wordl0[2] | wordr0[2];
343 w0[3] = wordl0[3] | wordr0[3];
344 w1[0] = wordl1[0] | wordr1[0];
345 w1[1] = wordl1[1] | wordr1[1];
346 w1[2] = wordl1[2] | wordr1[2];
347 w1[3] = wordl1[3] | wordr1[3];
348 w2[0] = wordl2[0] | wordr2[0];
349 w2[1] = wordl2[1] | wordr2[1];
350 w2[2] = wordl2[2] | wordr2[2];
351 w2[3] = wordl2[3] | wordr2[3];
352 w3[0] = wordl3[0] | wordr3[0];
353 w3[1] = wordl3[1] | wordr3[1];
354 w3[2] = wordl3[2] | wordr3[2];
355 w3[3] = wordl3[3] | wordr3[3];
357 w0[0] = swap32 (w0[0]);
358 w0[1] = swap32 (w0[1]);
359 w0[2] = swap32 (w0[2]);
360 w0[3] = swap32 (w0[3]);
361 w1[0] = swap32 (w1[0]);
362 w1[1] = swap32 (w1[1]);
363 w1[2] = swap32 (w1[2]);
364 w1[3] = swap32 (w1[3]);
365 w2[0] = swap32 (w2[0]);
366 w2[1] = swap32 (w2[1]);
367 w2[2] = swap32 (w2[2]);
368 w2[3] = swap32 (w2[3]);
369 w3[0] = swap32 (w3[0]);
370 w3[1] = swap32 (w3[1]);
371 w3[2] = swap32 (w3[2]);
372 w3[3] = swap32 (w3[3]);
381 hmac_sha256_pad (w0, w1, w2, w3, ipad, opad);
383 w0[0] = salt_buf0[0];
384 w0[1] = salt_buf0[1];
385 w0[2] = salt_buf0[2];
386 w0[3] = salt_buf0[3];
387 w1[0] = salt_buf1[0];
388 w1[1] = salt_buf1[1];
389 w1[2] = salt_buf1[2];
390 w1[3] = salt_buf1[3];
391 w2[0] = salt_buf2[0];
392 w2[1] = salt_buf2[1];
393 w2[2] = salt_buf2[2];
394 w2[3] = salt_buf2[3];
395 w3[0] = salt_buf3[0];
396 w3[1] = salt_buf3[1];
398 w3[3] = (64 + salt_len) * 8;
402 hmac_sha256_run (w0, w1, w2, w3, ipad, opad, digest);
404 COMPARE_M_SIMD (digest[3], digest[7], digest[2], digest[6]);
408 __kernel void m01450_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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
412 __kernel void m01450_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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
416 __kernel void m01450_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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
422 const u32 lid = get_local_id (0);
428 const u32 gid = get_global_id (0);
430 if (gid >= gid_max) return;
435 pw_buf0[0] = pws[gid].i[0];
436 pw_buf0[1] = pws[gid].i[1];
437 pw_buf0[2] = pws[gid].i[2];
438 pw_buf0[3] = pws[gid].i[3];
439 pw_buf1[0] = pws[gid].i[4];
440 pw_buf1[1] = pws[gid].i[5];
441 pw_buf1[2] = pws[gid].i[6];
442 pw_buf1[3] = pws[gid].i[7];
444 const u32 pw_l_len = pws[gid].pw_len;
455 salt_buf0[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 0]);
456 salt_buf0[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 1]);
457 salt_buf0[2] = swap32_S (salt_bufs[salt_pos].salt_buf[ 2]);
458 salt_buf0[3] = swap32_S (salt_bufs[salt_pos].salt_buf[ 3]);
459 salt_buf1[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 4]);
460 salt_buf1[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 5]);
461 salt_buf1[2] = swap32_S (salt_bufs[salt_pos].salt_buf[ 6]);
462 salt_buf1[3] = swap32_S (salt_bufs[salt_pos].salt_buf[ 7]);
463 salt_buf2[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 8]);
464 salt_buf2[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 9]);
465 salt_buf2[2] = swap32_S (salt_bufs[salt_pos].salt_buf[10]);
466 salt_buf2[3] = swap32_S (salt_bufs[salt_pos].salt_buf[11]);
467 salt_buf3[0] = swap32_S (salt_bufs[salt_pos].salt_buf[12]);
468 salt_buf3[1] = swap32_S (salt_bufs[salt_pos].salt_buf[13]);
469 salt_buf3[2] = swap32_S (salt_bufs[salt_pos].salt_buf[14]);
470 salt_buf3[3] = swap32_S (salt_bufs[salt_pos].salt_buf[15]);
472 const u32 salt_len = salt_bufs[salt_pos].salt_len;
478 const u32 search[4] =
480 digests_buf[digests_offset].digest_buf[DGST_R0],
481 digests_buf[digests_offset].digest_buf[DGST_R1],
482 digests_buf[digests_offset].digest_buf[DGST_R2],
483 digests_buf[digests_offset].digest_buf[DGST_R3]
490 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
492 const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
494 const u32x pw_len = pw_l_len + pw_r_len;
497 * concat password candidate
500 u32x wordl0[4] = { 0 };
501 u32x wordl1[4] = { 0 };
502 u32x wordl2[4] = { 0 };
503 u32x wordl3[4] = { 0 };
505 wordl0[0] = pw_buf0[0];
506 wordl0[1] = pw_buf0[1];
507 wordl0[2] = pw_buf0[2];
508 wordl0[3] = pw_buf0[3];
509 wordl1[0] = pw_buf1[0];
510 wordl1[1] = pw_buf1[1];
511 wordl1[2] = pw_buf1[2];
512 wordl1[3] = pw_buf1[3];
514 u32x wordr0[4] = { 0 };
515 u32x wordr1[4] = { 0 };
516 u32x wordr2[4] = { 0 };
517 u32x wordr3[4] = { 0 };
519 wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
520 wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
521 wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
522 wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
523 wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
524 wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
525 wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
526 wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
528 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
530 switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
534 switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
542 w0[0] = wordl0[0] | wordr0[0];
543 w0[1] = wordl0[1] | wordr0[1];
544 w0[2] = wordl0[2] | wordr0[2];
545 w0[3] = wordl0[3] | wordr0[3];
546 w1[0] = wordl1[0] | wordr1[0];
547 w1[1] = wordl1[1] | wordr1[1];
548 w1[2] = wordl1[2] | wordr1[2];
549 w1[3] = wordl1[3] | wordr1[3];
550 w2[0] = wordl2[0] | wordr2[0];
551 w2[1] = wordl2[1] | wordr2[1];
552 w2[2] = wordl2[2] | wordr2[2];
553 w2[3] = wordl2[3] | wordr2[3];
554 w3[0] = wordl3[0] | wordr3[0];
555 w3[1] = wordl3[1] | wordr3[1];
556 w3[2] = wordl3[2] | wordr3[2];
557 w3[3] = wordl3[3] | wordr3[3];
559 w0[0] = swap32 (w0[0]);
560 w0[1] = swap32 (w0[1]);
561 w0[2] = swap32 (w0[2]);
562 w0[3] = swap32 (w0[3]);
563 w1[0] = swap32 (w1[0]);
564 w1[1] = swap32 (w1[1]);
565 w1[2] = swap32 (w1[2]);
566 w1[3] = swap32 (w1[3]);
567 w2[0] = swap32 (w2[0]);
568 w2[1] = swap32 (w2[1]);
569 w2[2] = swap32 (w2[2]);
570 w2[3] = swap32 (w2[3]);
571 w3[0] = swap32 (w3[0]);
572 w3[1] = swap32 (w3[1]);
573 w3[2] = swap32 (w3[2]);
574 w3[3] = swap32 (w3[3]);
583 hmac_sha256_pad (w0, w1, w2, w3, ipad, opad);
585 w0[0] = salt_buf0[0];
586 w0[1] = salt_buf0[1];
587 w0[2] = salt_buf0[2];
588 w0[3] = salt_buf0[3];
589 w1[0] = salt_buf1[0];
590 w1[1] = salt_buf1[1];
591 w1[2] = salt_buf1[2];
592 w1[3] = salt_buf1[3];
593 w2[0] = salt_buf2[0];
594 w2[1] = salt_buf2[1];
595 w2[2] = salt_buf2[2];
596 w2[3] = salt_buf2[3];
597 w3[0] = salt_buf3[0];
598 w3[1] = salt_buf3[1];
600 w3[3] = (64 + salt_len) * 8;
604 hmac_sha256_run (w0, w1, w2, w3, ipad, opad, digest);
606 COMPARE_S_SIMD (digest[3], digest[7], digest[2], digest[6]);
610 __kernel void m01450_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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
614 __kernel void m01450_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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)