2 * Author......: Jens Steube <jens.steube@gmail.com>
9 //#define NEW_SIMD_CODE
11 #include "inc_vendor.cl"
12 #include "inc_hash_constants.h"
13 #include "inc_hash_functions.cl"
14 #include "inc_types.cl"
15 #include "inc_common.cl"
16 #include "inc_simd.cl"
18 __constant u32 k_sha256[64] =
20 SHA256C00, SHA256C01, SHA256C02, SHA256C03,
21 SHA256C04, SHA256C05, SHA256C06, SHA256C07,
22 SHA256C08, SHA256C09, SHA256C0a, SHA256C0b,
23 SHA256C0c, SHA256C0d, SHA256C0e, SHA256C0f,
24 SHA256C10, SHA256C11, SHA256C12, SHA256C13,
25 SHA256C14, SHA256C15, SHA256C16, SHA256C17,
26 SHA256C18, SHA256C19, SHA256C1a, SHA256C1b,
27 SHA256C1c, SHA256C1d, SHA256C1e, SHA256C1f,
28 SHA256C20, SHA256C21, SHA256C22, SHA256C23,
29 SHA256C24, SHA256C25, SHA256C26, SHA256C27,
30 SHA256C28, SHA256C29, SHA256C2a, SHA256C2b,
31 SHA256C2c, SHA256C2d, SHA256C2e, SHA256C2f,
32 SHA256C30, SHA256C31, SHA256C32, SHA256C33,
33 SHA256C34, SHA256C35, SHA256C36, SHA256C37,
34 SHA256C38, SHA256C39, SHA256C3a, SHA256C3b,
35 SHA256C3c, SHA256C3d, SHA256C3e, SHA256C3f,
38 void sha256_transform (const u32x w[16], u32x digest[8])
66 #define ROUND_EXPAND() \
68 w0_t = SHA256_EXPAND (we_t, w9_t, w1_t, w0_t); \
69 w1_t = SHA256_EXPAND (wf_t, wa_t, w2_t, w1_t); \
70 w2_t = SHA256_EXPAND (w0_t, wb_t, w3_t, w2_t); \
71 w3_t = SHA256_EXPAND (w1_t, wc_t, w4_t, w3_t); \
72 w4_t = SHA256_EXPAND (w2_t, wd_t, w5_t, w4_t); \
73 w5_t = SHA256_EXPAND (w3_t, we_t, w6_t, w5_t); \
74 w6_t = SHA256_EXPAND (w4_t, wf_t, w7_t, w6_t); \
75 w7_t = SHA256_EXPAND (w5_t, w0_t, w8_t, w7_t); \
76 w8_t = SHA256_EXPAND (w6_t, w1_t, w9_t, w8_t); \
77 w9_t = SHA256_EXPAND (w7_t, w2_t, wa_t, w9_t); \
78 wa_t = SHA256_EXPAND (w8_t, w3_t, wb_t, wa_t); \
79 wb_t = SHA256_EXPAND (w9_t, w4_t, wc_t, wb_t); \
80 wc_t = SHA256_EXPAND (wa_t, w5_t, wd_t, wc_t); \
81 wd_t = SHA256_EXPAND (wb_t, w6_t, we_t, wd_t); \
82 we_t = SHA256_EXPAND (wc_t, w7_t, wf_t, we_t); \
83 wf_t = SHA256_EXPAND (wd_t, w8_t, w0_t, wf_t); \
86 #define ROUND_STEP(i) \
88 SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w0_t, k_sha256[i + 0]); \
89 SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w1_t, k_sha256[i + 1]); \
90 SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, w2_t, k_sha256[i + 2]); \
91 SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, w3_t, k_sha256[i + 3]); \
92 SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, w4_t, k_sha256[i + 4]); \
93 SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, w5_t, k_sha256[i + 5]); \
94 SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, w6_t, k_sha256[i + 6]); \
95 SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, w7_t, k_sha256[i + 7]); \
96 SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w8_t, k_sha256[i + 8]); \
97 SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w9_t, k_sha256[i + 9]); \
98 SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, wa_t, k_sha256[i + 10]); \
99 SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, wb_t, k_sha256[i + 11]); \
100 SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, wc_t, k_sha256[i + 12]); \
101 SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, wd_t, k_sha256[i + 13]); \
102 SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, we_t, k_sha256[i + 14]); \
103 SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, wf_t, k_sha256[i + 15]); \
111 for (int i = 16; i < 64; i += 16)
113 ROUND_EXPAND (); ROUND_STEP (i);
126 void memcat64c_be (u32x block[16], const u32 offset, u32x carry[16])
128 const u32 mod = offset & 3;
129 const u32 div = offset / 4;
150 const int selector = (0x76543210 >> ((offset & 3) * 4)) & 0xffff;
152 tmp00 = __byte_perm (carry[ 0], 0, selector);
153 tmp01 = __byte_perm (carry[ 1], carry[ 0], selector);
154 tmp02 = __byte_perm (carry[ 2], carry[ 1], selector);
155 tmp03 = __byte_perm (carry[ 3], carry[ 2], selector);
156 tmp04 = __byte_perm (carry[ 4], carry[ 3], selector);
157 tmp05 = __byte_perm (carry[ 5], carry[ 4], selector);
158 tmp06 = __byte_perm (carry[ 6], carry[ 5], selector);
159 tmp07 = __byte_perm (carry[ 7], carry[ 6], selector);
160 tmp08 = __byte_perm (carry[ 8], carry[ 7], selector);
161 tmp09 = __byte_perm (carry[ 9], carry[ 8], selector);
162 tmp10 = __byte_perm (carry[10], carry[ 9], selector);
163 tmp11 = __byte_perm (carry[11], carry[10], selector);
164 tmp12 = __byte_perm (carry[12], carry[11], selector);
165 tmp13 = __byte_perm (carry[13], carry[12], selector);
166 tmp14 = __byte_perm (carry[14], carry[13], selector);
167 tmp15 = __byte_perm (carry[15], carry[14], selector);
168 tmp16 = __byte_perm ( 0, carry[15], selector);
171 #if defined IS_AMD || defined IS_GENERIC
172 tmp00 = amd_bytealign ( 0, carry[ 0], offset);
173 tmp01 = amd_bytealign (carry[ 0], carry[ 1], offset);
174 tmp02 = amd_bytealign (carry[ 1], carry[ 2], offset);
175 tmp03 = amd_bytealign (carry[ 2], carry[ 3], offset);
176 tmp04 = amd_bytealign (carry[ 3], carry[ 4], offset);
177 tmp05 = amd_bytealign (carry[ 4], carry[ 5], offset);
178 tmp06 = amd_bytealign (carry[ 5], carry[ 6], offset);
179 tmp07 = amd_bytealign (carry[ 6], carry[ 7], offset);
180 tmp08 = amd_bytealign (carry[ 7], carry[ 8], offset);
181 tmp09 = amd_bytealign (carry[ 8], carry[ 9], offset);
182 tmp10 = amd_bytealign (carry[ 9], carry[10], offset);
183 tmp11 = amd_bytealign (carry[10], carry[11], offset);
184 tmp12 = amd_bytealign (carry[11], carry[12], offset);
185 tmp13 = amd_bytealign (carry[12], carry[13], offset);
186 tmp14 = amd_bytealign (carry[13], carry[14], offset);
187 tmp15 = amd_bytealign (carry[14], carry[15], offset);
188 tmp16 = amd_bytealign (carry[15], 0, offset);
210 case 0: block[ 0] |= tmp00;
228 case 1: block[ 1] |= tmp00;
246 case 2: block[ 2] |= tmp00;
264 case 3: block[ 3] |= tmp00;
282 case 4: block[ 4] |= tmp00;
300 case 5: block[ 5] |= tmp00;
318 case 6: block[ 6] |= tmp00;
336 case 7: block[ 7] |= tmp00;
354 case 8: block[ 8] |= tmp00;
372 case 9: block[ 9] |= tmp00;
390 case 10: block[10] |= tmp00;
408 case 11: block[11] |= tmp00;
426 case 12: block[12] |= tmp00;
444 case 13: block[13] |= tmp00;
462 case 14: block[14] |= tmp00;
480 case 15: block[15] |= tmp00;
501 __kernel void m13800_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 win8phone_t *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)
507 const u32 gid = get_global_id (0);
508 const u32 lid = get_local_id (0);
509 const u32 lsz = get_local_size (0);
518 pw_buf0[0] = pws[gid].i[0];
519 pw_buf0[1] = pws[gid].i[1];
520 pw_buf0[2] = pws[gid].i[2];
521 pw_buf0[3] = pws[gid].i[3];
522 pw_buf1[0] = pws[gid].i[4];
523 pw_buf1[1] = pws[gid].i[5];
524 pw_buf1[2] = pws[gid].i[6];
525 pw_buf1[3] = pws[gid].i[7];
527 const u32 pw_l_len = pws[gid].pw_len;
533 __local u32 s_esalt[32];
535 for (u32 i = lid; i < 32; i += lsz)
537 s_esalt[i] = esalt_bufs[salt_pos].salt_buf[i];
540 barrier (CLK_LOCAL_MEM_FENCE);
542 if (gid >= gid_max) return;
548 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
550 const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
552 const u32x pw_len = pw_l_len + pw_r_len;
555 * concat password candidate
558 u32x wordl0[4] = { 0 };
559 u32x wordl1[4] = { 0 };
560 u32x wordl2[4] = { 0 };
561 u32x wordl3[4] = { 0 };
563 wordl0[0] = pw_buf0[0];
564 wordl0[1] = pw_buf0[1];
565 wordl0[2] = pw_buf0[2];
566 wordl0[3] = pw_buf0[3];
567 wordl1[0] = pw_buf1[0];
568 wordl1[1] = pw_buf1[1];
569 wordl1[2] = pw_buf1[2];
570 wordl1[3] = pw_buf1[3];
572 u32x wordr0[4] = { 0 };
573 u32x wordr1[4] = { 0 };
574 u32x wordr2[4] = { 0 };
575 u32x wordr3[4] = { 0 };
577 wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
578 wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
579 wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
580 wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
581 wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
582 wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
583 wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
584 wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
586 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
588 switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
592 switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
600 w0[0] = wordl0[0] | wordr0[0];
601 w0[1] = wordl0[1] | wordr0[1];
602 w0[2] = wordl0[2] | wordr0[2];
603 w0[3] = wordl0[3] | wordr0[3];
604 w1[0] = wordl1[0] | wordr1[0];
605 w1[1] = wordl1[1] | wordr1[1];
606 w1[2] = wordl1[2] | wordr1[2];
607 w1[3] = wordl1[3] | wordr1[3];
613 const u32x pw_len2 = pw_len * 2;
615 make_unicode (w1, w2, w3);
616 make_unicode (w0, w0, w1);
620 w[ 0] = swap32 (w0[0]);
621 w[ 1] = swap32 (w0[1]);
622 w[ 2] = swap32 (w0[2]);
623 w[ 3] = swap32 (w0[3]);
624 w[ 4] = swap32 (w1[0]);
625 w[ 5] = swap32 (w1[1]);
626 w[ 6] = swap32 (w1[2]);
627 w[ 7] = swap32 (w1[3]);
628 w[ 8] = swap32 (w2[0]);
629 w[ 9] = swap32 (w2[1]);
630 w[10] = swap32 (w2[2]);
631 w[11] = swap32 (w2[3]);
632 w[12] = swap32 (w3[0]);
633 w[13] = swap32 (w3[1]);
634 w[14] = swap32 (w3[2]);
635 w[15] = swap32 (w3[3]);
639 carry[ 0] = s_esalt[ 0];
640 carry[ 1] = s_esalt[ 1];
641 carry[ 2] = s_esalt[ 2];
642 carry[ 3] = s_esalt[ 3];
643 carry[ 4] = s_esalt[ 4];
644 carry[ 5] = s_esalt[ 5];
645 carry[ 6] = s_esalt[ 6];
646 carry[ 7] = s_esalt[ 7];
647 carry[ 8] = s_esalt[ 8];
648 carry[ 9] = s_esalt[ 9];
649 carry[10] = s_esalt[10];
650 carry[11] = s_esalt[11];
651 carry[12] = s_esalt[12];
652 carry[13] = s_esalt[13];
653 carry[14] = s_esalt[14];
654 carry[15] = s_esalt[15];
656 // we can always use pw_len here, since we add exactly the hash buffer size
657 memcat64c_be (w, pw_len2, carry);
661 digest[0] = SHA256M_A;
662 digest[1] = SHA256M_B;
663 digest[2] = SHA256M_C;
664 digest[3] = SHA256M_D;
665 digest[4] = SHA256M_E;
666 digest[5] = SHA256M_F;
667 digest[6] = SHA256M_G;
668 digest[7] = SHA256M_H;
670 sha256_transform (w, digest);
689 carry[ 0] = s_esalt[16];
690 carry[ 1] = s_esalt[17];
691 carry[ 2] = s_esalt[18];
692 carry[ 3] = s_esalt[19];
693 carry[ 4] = s_esalt[20];
694 carry[ 5] = s_esalt[21];
695 carry[ 6] = s_esalt[22];
696 carry[ 7] = s_esalt[23];
697 carry[ 8] = s_esalt[24];
698 carry[ 9] = s_esalt[25];
699 carry[10] = s_esalt[26];
700 carry[11] = s_esalt[27];
701 carry[12] = s_esalt[28];
702 carry[13] = s_esalt[29];
703 carry[14] = s_esalt[30];
704 carry[15] = s_esalt[31];
706 // we can always use pw_len here, since we add exactly the hash buffer size
707 memcat64c_be (w, pw_len2, carry);
709 sha256_transform (w, digest);
728 // we can always use pw_len here, since we add exactly the hash buffer size
729 append_0x80_4x4 (w + 0, w + 4, w + 8, w + 12, pw_len2 ^ 3);
732 w[15] = (pw_len2 + 128) * 8;
734 sha256_transform (w, digest);
736 const u32x d = digest[DGST_R0];
737 const u32x h = digest[DGST_R1];
738 const u32x c = digest[DGST_R2];
739 const u32x g = digest[DGST_R3];
741 COMPARE_M_SIMD (d, h, c, g);
745 __kernel void m13800_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 win8phone_t *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)
749 __kernel void m13800_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 win8phone_t *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)
753 __kernel void m13800_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 win8phone_t *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)
759 const u32 gid = get_global_id (0);
760 const u32 lid = get_local_id (0);
761 const u32 lsz = get_local_size (0);
770 pw_buf0[0] = pws[gid].i[0];
771 pw_buf0[1] = pws[gid].i[1];
772 pw_buf0[2] = pws[gid].i[2];
773 pw_buf0[3] = pws[gid].i[3];
774 pw_buf1[0] = pws[gid].i[4];
775 pw_buf1[1] = pws[gid].i[5];
776 pw_buf1[2] = pws[gid].i[6];
777 pw_buf1[3] = pws[gid].i[7];
779 const u32 pw_l_len = pws[gid].pw_len;
785 __local u32 s_esalt[32];
787 for (u32 i = lid; i < 32; i += lsz)
789 s_esalt[i] = esalt_bufs[salt_pos].salt_buf[i];
792 barrier (CLK_LOCAL_MEM_FENCE);
794 if (gid >= gid_max) return;
800 const u32 search[4] =
802 digests_buf[digests_offset].digest_buf[DGST_R0],
803 digests_buf[digests_offset].digest_buf[DGST_R1],
804 digests_buf[digests_offset].digest_buf[DGST_R2],
805 digests_buf[digests_offset].digest_buf[DGST_R3]
812 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
814 const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
816 const u32x pw_len = pw_l_len + pw_r_len;
819 * concat password candidate
822 u32x wordl0[4] = { 0 };
823 u32x wordl1[4] = { 0 };
824 u32x wordl2[4] = { 0 };
825 u32x wordl3[4] = { 0 };
827 wordl0[0] = pw_buf0[0];
828 wordl0[1] = pw_buf0[1];
829 wordl0[2] = pw_buf0[2];
830 wordl0[3] = pw_buf0[3];
831 wordl1[0] = pw_buf1[0];
832 wordl1[1] = pw_buf1[1];
833 wordl1[2] = pw_buf1[2];
834 wordl1[3] = pw_buf1[3];
836 u32x wordr0[4] = { 0 };
837 u32x wordr1[4] = { 0 };
838 u32x wordr2[4] = { 0 };
839 u32x wordr3[4] = { 0 };
841 wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
842 wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
843 wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
844 wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
845 wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
846 wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
847 wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
848 wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
850 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
852 switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
856 switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
864 w0[0] = wordl0[0] | wordr0[0];
865 w0[1] = wordl0[1] | wordr0[1];
866 w0[2] = wordl0[2] | wordr0[2];
867 w0[3] = wordl0[3] | wordr0[3];
868 w1[0] = wordl1[0] | wordr1[0];
869 w1[1] = wordl1[1] | wordr1[1];
870 w1[2] = wordl1[2] | wordr1[2];
871 w1[3] = wordl1[3] | wordr1[3];
877 const u32x pw_len2 = pw_len * 2;
879 make_unicode (w1, w2, w3);
880 make_unicode (w0, w0, w1);
884 w[ 0] = swap32 (w0[0]);
885 w[ 1] = swap32 (w0[1]);
886 w[ 2] = swap32 (w0[2]);
887 w[ 3] = swap32 (w0[3]);
888 w[ 4] = swap32 (w1[0]);
889 w[ 5] = swap32 (w1[1]);
890 w[ 6] = swap32 (w1[2]);
891 w[ 7] = swap32 (w1[3]);
892 w[ 8] = swap32 (w2[0]);
893 w[ 9] = swap32 (w2[1]);
894 w[10] = swap32 (w2[2]);
895 w[11] = swap32 (w2[3]);
896 w[12] = swap32 (w3[0]);
897 w[13] = swap32 (w3[1]);
898 w[14] = swap32 (w3[2]);
899 w[15] = swap32 (w3[3]);
903 carry[ 0] = s_esalt[ 0];
904 carry[ 1] = s_esalt[ 1];
905 carry[ 2] = s_esalt[ 2];
906 carry[ 3] = s_esalt[ 3];
907 carry[ 4] = s_esalt[ 4];
908 carry[ 5] = s_esalt[ 5];
909 carry[ 6] = s_esalt[ 6];
910 carry[ 7] = s_esalt[ 7];
911 carry[ 8] = s_esalt[ 8];
912 carry[ 9] = s_esalt[ 9];
913 carry[10] = s_esalt[10];
914 carry[11] = s_esalt[11];
915 carry[12] = s_esalt[12];
916 carry[13] = s_esalt[13];
917 carry[14] = s_esalt[14];
918 carry[15] = s_esalt[15];
920 // we can always use pw_len here, since we add exactly the hash buffer size
921 memcat64c_be (w, pw_len2, carry);
925 digest[0] = SHA256M_A;
926 digest[1] = SHA256M_B;
927 digest[2] = SHA256M_C;
928 digest[3] = SHA256M_D;
929 digest[4] = SHA256M_E;
930 digest[5] = SHA256M_F;
931 digest[6] = SHA256M_G;
932 digest[7] = SHA256M_H;
934 sha256_transform (w, digest);
953 carry[ 0] = s_esalt[16];
954 carry[ 1] = s_esalt[17];
955 carry[ 2] = s_esalt[18];
956 carry[ 3] = s_esalt[19];
957 carry[ 4] = s_esalt[20];
958 carry[ 5] = s_esalt[21];
959 carry[ 6] = s_esalt[22];
960 carry[ 7] = s_esalt[23];
961 carry[ 8] = s_esalt[24];
962 carry[ 9] = s_esalt[25];
963 carry[10] = s_esalt[26];
964 carry[11] = s_esalt[27];
965 carry[12] = s_esalt[28];
966 carry[13] = s_esalt[29];
967 carry[14] = s_esalt[30];
968 carry[15] = s_esalt[31];
970 // we can always use pw_len here, since we add exactly the hash buffer size
971 memcat64c_be (w, pw_len2, carry);
973 sha256_transform (w, digest);
992 // we can always use pw_len here, since we add exactly the hash buffer size
993 append_0x80_4x4 (w + 0, w + 4, w + 8, w + 12, pw_len2 ^ 3);
996 w[15] = (pw_len2 + 128) * 8;
998 sha256_transform (w, digest);
1000 const u32x d = digest[DGST_R0];
1001 const u32x h = digest[DGST_R1];
1002 const u32x c = digest[DGST_R2];
1003 const u32x g = digest[DGST_R3];
1005 COMPARE_S_SIMD (d, h, c, g);
1009 __kernel void m13800_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 win8phone_t *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)
1013 __kernel void m13800_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 win8phone_t *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)