2 * Author......: Jens Steube <jens.steube@gmail.com>
9 //#define NEW_SIMD_CODE
11 #include "inc_hash_constants.h"
12 #include "inc_vendor.cl"
19 #include "inc_hash_functions.cl"
20 #include "inc_types.cl"
21 #include "inc_common.cl"
22 #include "inc_simd.cl"
24 __constant u32 k_sha256[64] =
26 SHA256C00, SHA256C01, SHA256C02, SHA256C03,
27 SHA256C04, SHA256C05, SHA256C06, SHA256C07,
28 SHA256C08, SHA256C09, SHA256C0a, SHA256C0b,
29 SHA256C0c, SHA256C0d, SHA256C0e, SHA256C0f,
30 SHA256C10, SHA256C11, SHA256C12, SHA256C13,
31 SHA256C14, SHA256C15, SHA256C16, SHA256C17,
32 SHA256C18, SHA256C19, SHA256C1a, SHA256C1b,
33 SHA256C1c, SHA256C1d, SHA256C1e, SHA256C1f,
34 SHA256C20, SHA256C21, SHA256C22, SHA256C23,
35 SHA256C24, SHA256C25, SHA256C26, SHA256C27,
36 SHA256C28, SHA256C29, SHA256C2a, SHA256C2b,
37 SHA256C2c, SHA256C2d, SHA256C2e, SHA256C2f,
38 SHA256C30, SHA256C31, SHA256C32, SHA256C33,
39 SHA256C34, SHA256C35, SHA256C36, SHA256C37,
40 SHA256C38, SHA256C39, SHA256C3a, SHA256C3b,
41 SHA256C3c, SHA256C3d, SHA256C3e, SHA256C3f,
44 void sha256_transform (const u32x w[16], u32x digest[8])
72 #define ROUND_EXPAND() \
74 w0_t = SHA256_EXPAND (we_t, w9_t, w1_t, w0_t); \
75 w1_t = SHA256_EXPAND (wf_t, wa_t, w2_t, w1_t); \
76 w2_t = SHA256_EXPAND (w0_t, wb_t, w3_t, w2_t); \
77 w3_t = SHA256_EXPAND (w1_t, wc_t, w4_t, w3_t); \
78 w4_t = SHA256_EXPAND (w2_t, wd_t, w5_t, w4_t); \
79 w5_t = SHA256_EXPAND (w3_t, we_t, w6_t, w5_t); \
80 w6_t = SHA256_EXPAND (w4_t, wf_t, w7_t, w6_t); \
81 w7_t = SHA256_EXPAND (w5_t, w0_t, w8_t, w7_t); \
82 w8_t = SHA256_EXPAND (w6_t, w1_t, w9_t, w8_t); \
83 w9_t = SHA256_EXPAND (w7_t, w2_t, wa_t, w9_t); \
84 wa_t = SHA256_EXPAND (w8_t, w3_t, wb_t, wa_t); \
85 wb_t = SHA256_EXPAND (w9_t, w4_t, wc_t, wb_t); \
86 wc_t = SHA256_EXPAND (wa_t, w5_t, wd_t, wc_t); \
87 wd_t = SHA256_EXPAND (wb_t, w6_t, we_t, wd_t); \
88 we_t = SHA256_EXPAND (wc_t, w7_t, wf_t, we_t); \
89 wf_t = SHA256_EXPAND (wd_t, w8_t, w0_t, wf_t); \
92 #define ROUND_STEP(i) \
94 SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w0_t, k_sha256[i + 0]); \
95 SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w1_t, k_sha256[i + 1]); \
96 SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, w2_t, k_sha256[i + 2]); \
97 SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, w3_t, k_sha256[i + 3]); \
98 SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, w4_t, k_sha256[i + 4]); \
99 SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, w5_t, k_sha256[i + 5]); \
100 SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, w6_t, k_sha256[i + 6]); \
101 SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, w7_t, k_sha256[i + 7]); \
102 SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w8_t, k_sha256[i + 8]); \
103 SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w9_t, k_sha256[i + 9]); \
104 SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, wa_t, k_sha256[i + 10]); \
105 SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, wb_t, k_sha256[i + 11]); \
106 SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, wc_t, k_sha256[i + 12]); \
107 SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, wd_t, k_sha256[i + 13]); \
108 SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, we_t, k_sha256[i + 14]); \
109 SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, wf_t, k_sha256[i + 15]); \
117 for (int i = 16; i < 64; i += 16)
119 ROUND_EXPAND (); ROUND_STEP (i);
132 void memcat64c_be (u32x block[16], const u32 offset, u32x carry[16])
134 const u32 mod = offset & 3;
135 const u32 div = offset / 4;
156 const int selector = (0x76543210 >> ((offset & 3) * 4)) & 0xffff;
158 tmp00 = __byte_perm (carry[ 0], 0, selector);
159 tmp01 = __byte_perm (carry[ 1], carry[ 0], selector);
160 tmp02 = __byte_perm (carry[ 2], carry[ 1], selector);
161 tmp03 = __byte_perm (carry[ 3], carry[ 2], selector);
162 tmp04 = __byte_perm (carry[ 4], carry[ 3], selector);
163 tmp05 = __byte_perm (carry[ 5], carry[ 4], selector);
164 tmp06 = __byte_perm (carry[ 6], carry[ 5], selector);
165 tmp07 = __byte_perm (carry[ 7], carry[ 6], selector);
166 tmp08 = __byte_perm (carry[ 8], carry[ 7], selector);
167 tmp09 = __byte_perm (carry[ 9], carry[ 8], selector);
168 tmp10 = __byte_perm (carry[10], carry[ 9], selector);
169 tmp11 = __byte_perm (carry[11], carry[10], selector);
170 tmp12 = __byte_perm (carry[12], carry[11], selector);
171 tmp13 = __byte_perm (carry[13], carry[12], selector);
172 tmp14 = __byte_perm (carry[14], carry[13], selector);
173 tmp15 = __byte_perm (carry[15], carry[14], selector);
174 tmp16 = __byte_perm ( 0, carry[15], selector);
177 #if defined IS_AMD || defined IS_GENERIC
178 tmp00 = amd_bytealign ( 0, carry[ 0], offset);
179 tmp01 = amd_bytealign (carry[ 0], carry[ 1], offset);
180 tmp02 = amd_bytealign (carry[ 1], carry[ 2], offset);
181 tmp03 = amd_bytealign (carry[ 2], carry[ 3], offset);
182 tmp04 = amd_bytealign (carry[ 3], carry[ 4], offset);
183 tmp05 = amd_bytealign (carry[ 4], carry[ 5], offset);
184 tmp06 = amd_bytealign (carry[ 5], carry[ 6], offset);
185 tmp07 = amd_bytealign (carry[ 6], carry[ 7], offset);
186 tmp08 = amd_bytealign (carry[ 7], carry[ 8], offset);
187 tmp09 = amd_bytealign (carry[ 8], carry[ 9], offset);
188 tmp10 = amd_bytealign (carry[ 9], carry[10], offset);
189 tmp11 = amd_bytealign (carry[10], carry[11], offset);
190 tmp12 = amd_bytealign (carry[11], carry[12], offset);
191 tmp13 = amd_bytealign (carry[12], carry[13], offset);
192 tmp14 = amd_bytealign (carry[13], carry[14], offset);
193 tmp15 = amd_bytealign (carry[14], carry[15], offset);
194 tmp16 = amd_bytealign (carry[15], 0, offset);
216 case 0: block[ 0] |= tmp00;
234 case 1: block[ 1] |= tmp00;
252 case 2: block[ 2] |= tmp00;
270 case 3: block[ 3] |= tmp00;
288 case 4: block[ 4] |= tmp00;
306 case 5: block[ 5] |= tmp00;
324 case 6: block[ 6] |= tmp00;
342 case 7: block[ 7] |= tmp00;
360 case 8: block[ 8] |= tmp00;
378 case 9: block[ 9] |= tmp00;
396 case 10: block[10] |= tmp00;
414 case 11: block[11] |= tmp00;
432 case 12: block[12] |= tmp00;
450 case 13: block[13] |= tmp00;
468 case 14: block[14] |= tmp00;
486 case 15: block[15] |= tmp00;
507 __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_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
513 const u32 gid = get_global_id (0);
514 const u32 lid = get_local_id (0);
515 const u32 lsz = get_local_size (0);
524 pw_buf0[0] = pws[gid].i[0];
525 pw_buf0[1] = pws[gid].i[1];
526 pw_buf0[2] = pws[gid].i[2];
527 pw_buf0[3] = pws[gid].i[3];
528 pw_buf1[0] = pws[gid].i[4];
529 pw_buf1[1] = pws[gid].i[5];
530 pw_buf1[2] = pws[gid].i[6];
531 pw_buf1[3] = pws[gid].i[7];
533 const u32 pw_l_len = pws[gid].pw_len;
539 __local u32 s_esalt[32];
541 for (u32 i = lid; i < 32; i += lsz)
543 s_esalt[i] = esalt_bufs[salt_pos].salt_buf[i];
546 barrier (CLK_LOCAL_MEM_FENCE);
548 if (gid >= gid_max) return;
554 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
556 const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
558 const u32x pw_len = pw_l_len + pw_r_len;
561 * concat password candidate
564 u32x wordl0[4] = { 0 };
565 u32x wordl1[4] = { 0 };
566 u32x wordl2[4] = { 0 };
567 u32x wordl3[4] = { 0 };
569 wordl0[0] = pw_buf0[0];
570 wordl0[1] = pw_buf0[1];
571 wordl0[2] = pw_buf0[2];
572 wordl0[3] = pw_buf0[3];
573 wordl1[0] = pw_buf1[0];
574 wordl1[1] = pw_buf1[1];
575 wordl1[2] = pw_buf1[2];
576 wordl1[3] = pw_buf1[3];
578 u32x wordr0[4] = { 0 };
579 u32x wordr1[4] = { 0 };
580 u32x wordr2[4] = { 0 };
581 u32x wordr3[4] = { 0 };
583 wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
584 wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
585 wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
586 wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
587 wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
588 wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
589 wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
590 wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
592 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
594 switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
598 switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
606 w0[0] = wordl0[0] | wordr0[0];
607 w0[1] = wordl0[1] | wordr0[1];
608 w0[2] = wordl0[2] | wordr0[2];
609 w0[3] = wordl0[3] | wordr0[3];
610 w1[0] = wordl1[0] | wordr1[0];
611 w1[1] = wordl1[1] | wordr1[1];
612 w1[2] = wordl1[2] | wordr1[2];
613 w1[3] = wordl1[3] | wordr1[3];
619 const u32x pw_len2 = pw_len * 2;
621 make_unicode (w1, w2, w3);
622 make_unicode (w0, w0, w1);
626 w[ 0] = swap32 (w0[0]);
627 w[ 1] = swap32 (w0[1]);
628 w[ 2] = swap32 (w0[2]);
629 w[ 3] = swap32 (w0[3]);
630 w[ 4] = swap32 (w1[0]);
631 w[ 5] = swap32 (w1[1]);
632 w[ 6] = swap32 (w1[2]);
633 w[ 7] = swap32 (w1[3]);
634 w[ 8] = swap32 (w2[0]);
635 w[ 9] = swap32 (w2[1]);
636 w[10] = swap32 (w2[2]);
637 w[11] = swap32 (w2[3]);
638 w[12] = swap32 (w3[0]);
639 w[13] = swap32 (w3[1]);
640 w[14] = swap32 (w3[2]);
641 w[15] = swap32 (w3[3]);
645 carry[ 0] = s_esalt[ 0];
646 carry[ 1] = s_esalt[ 1];
647 carry[ 2] = s_esalt[ 2];
648 carry[ 3] = s_esalt[ 3];
649 carry[ 4] = s_esalt[ 4];
650 carry[ 5] = s_esalt[ 5];
651 carry[ 6] = s_esalt[ 6];
652 carry[ 7] = s_esalt[ 7];
653 carry[ 8] = s_esalt[ 8];
654 carry[ 9] = s_esalt[ 9];
655 carry[10] = s_esalt[10];
656 carry[11] = s_esalt[11];
657 carry[12] = s_esalt[12];
658 carry[13] = s_esalt[13];
659 carry[14] = s_esalt[14];
660 carry[15] = s_esalt[15];
662 // we can always use pw_len here, since we add exactly the hash buffer size
663 memcat64c_be (w, pw_len2, carry);
667 digest[0] = SHA256M_A;
668 digest[1] = SHA256M_B;
669 digest[2] = SHA256M_C;
670 digest[3] = SHA256M_D;
671 digest[4] = SHA256M_E;
672 digest[5] = SHA256M_F;
673 digest[6] = SHA256M_G;
674 digest[7] = SHA256M_H;
676 sha256_transform (w, digest);
695 carry[ 0] = s_esalt[16];
696 carry[ 1] = s_esalt[17];
697 carry[ 2] = s_esalt[18];
698 carry[ 3] = s_esalt[19];
699 carry[ 4] = s_esalt[20];
700 carry[ 5] = s_esalt[21];
701 carry[ 6] = s_esalt[22];
702 carry[ 7] = s_esalt[23];
703 carry[ 8] = s_esalt[24];
704 carry[ 9] = s_esalt[25];
705 carry[10] = s_esalt[26];
706 carry[11] = s_esalt[27];
707 carry[12] = s_esalt[28];
708 carry[13] = s_esalt[29];
709 carry[14] = s_esalt[30];
710 carry[15] = s_esalt[31];
712 // we can always use pw_len here, since we add exactly the hash buffer size
713 memcat64c_be (w, pw_len2, carry);
715 sha256_transform (w, digest);
734 // we can always use pw_len here, since we add exactly the hash buffer size
735 append_0x80_4x4 (w + 0, w + 4, w + 8, w + 12, pw_len2 ^ 3);
738 w[15] = (pw_len2 + 128) * 8;
740 sha256_transform (w, digest);
742 const u32x d = digest[DGST_R0];
743 const u32x h = digest[DGST_R1];
744 const u32x c = digest[DGST_R2];
745 const u32x g = digest[DGST_R3];
747 COMPARE_M_SIMD (d, h, c, g);
751 __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_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
755 __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_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
759 __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_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
765 const u32 gid = get_global_id (0);
766 const u32 lid = get_local_id (0);
767 const u32 lsz = get_local_size (0);
776 pw_buf0[0] = pws[gid].i[0];
777 pw_buf0[1] = pws[gid].i[1];
778 pw_buf0[2] = pws[gid].i[2];
779 pw_buf0[3] = pws[gid].i[3];
780 pw_buf1[0] = pws[gid].i[4];
781 pw_buf1[1] = pws[gid].i[5];
782 pw_buf1[2] = pws[gid].i[6];
783 pw_buf1[3] = pws[gid].i[7];
785 const u32 pw_l_len = pws[gid].pw_len;
791 __local u32 s_esalt[32];
793 for (u32 i = lid; i < 32; i += lsz)
795 s_esalt[i] = esalt_bufs[salt_pos].salt_buf[i];
798 barrier (CLK_LOCAL_MEM_FENCE);
800 if (gid >= gid_max) return;
806 const u32 search[4] =
808 digests_buf[digests_offset].digest_buf[DGST_R0],
809 digests_buf[digests_offset].digest_buf[DGST_R1],
810 digests_buf[digests_offset].digest_buf[DGST_R2],
811 digests_buf[digests_offset].digest_buf[DGST_R3]
818 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
820 const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
822 const u32x pw_len = pw_l_len + pw_r_len;
825 * concat password candidate
828 u32x wordl0[4] = { 0 };
829 u32x wordl1[4] = { 0 };
830 u32x wordl2[4] = { 0 };
831 u32x wordl3[4] = { 0 };
833 wordl0[0] = pw_buf0[0];
834 wordl0[1] = pw_buf0[1];
835 wordl0[2] = pw_buf0[2];
836 wordl0[3] = pw_buf0[3];
837 wordl1[0] = pw_buf1[0];
838 wordl1[1] = pw_buf1[1];
839 wordl1[2] = pw_buf1[2];
840 wordl1[3] = pw_buf1[3];
842 u32x wordr0[4] = { 0 };
843 u32x wordr1[4] = { 0 };
844 u32x wordr2[4] = { 0 };
845 u32x wordr3[4] = { 0 };
847 wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
848 wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
849 wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
850 wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
851 wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
852 wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
853 wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
854 wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
856 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
858 switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
862 switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
870 w0[0] = wordl0[0] | wordr0[0];
871 w0[1] = wordl0[1] | wordr0[1];
872 w0[2] = wordl0[2] | wordr0[2];
873 w0[3] = wordl0[3] | wordr0[3];
874 w1[0] = wordl1[0] | wordr1[0];
875 w1[1] = wordl1[1] | wordr1[1];
876 w1[2] = wordl1[2] | wordr1[2];
877 w1[3] = wordl1[3] | wordr1[3];
883 const u32x pw_len2 = pw_len * 2;
885 make_unicode (w1, w2, w3);
886 make_unicode (w0, w0, w1);
890 w[ 0] = swap32 (w0[0]);
891 w[ 1] = swap32 (w0[1]);
892 w[ 2] = swap32 (w0[2]);
893 w[ 3] = swap32 (w0[3]);
894 w[ 4] = swap32 (w1[0]);
895 w[ 5] = swap32 (w1[1]);
896 w[ 6] = swap32 (w1[2]);
897 w[ 7] = swap32 (w1[3]);
898 w[ 8] = swap32 (w2[0]);
899 w[ 9] = swap32 (w2[1]);
900 w[10] = swap32 (w2[2]);
901 w[11] = swap32 (w2[3]);
902 w[12] = swap32 (w3[0]);
903 w[13] = swap32 (w3[1]);
904 w[14] = swap32 (w3[2]);
905 w[15] = swap32 (w3[3]);
909 carry[ 0] = s_esalt[ 0];
910 carry[ 1] = s_esalt[ 1];
911 carry[ 2] = s_esalt[ 2];
912 carry[ 3] = s_esalt[ 3];
913 carry[ 4] = s_esalt[ 4];
914 carry[ 5] = s_esalt[ 5];
915 carry[ 6] = s_esalt[ 6];
916 carry[ 7] = s_esalt[ 7];
917 carry[ 8] = s_esalt[ 8];
918 carry[ 9] = s_esalt[ 9];
919 carry[10] = s_esalt[10];
920 carry[11] = s_esalt[11];
921 carry[12] = s_esalt[12];
922 carry[13] = s_esalt[13];
923 carry[14] = s_esalt[14];
924 carry[15] = s_esalt[15];
926 // we can always use pw_len here, since we add exactly the hash buffer size
927 memcat64c_be (w, pw_len2, carry);
931 digest[0] = SHA256M_A;
932 digest[1] = SHA256M_B;
933 digest[2] = SHA256M_C;
934 digest[3] = SHA256M_D;
935 digest[4] = SHA256M_E;
936 digest[5] = SHA256M_F;
937 digest[6] = SHA256M_G;
938 digest[7] = SHA256M_H;
940 sha256_transform (w, digest);
959 carry[ 0] = s_esalt[16];
960 carry[ 1] = s_esalt[17];
961 carry[ 2] = s_esalt[18];
962 carry[ 3] = s_esalt[19];
963 carry[ 4] = s_esalt[20];
964 carry[ 5] = s_esalt[21];
965 carry[ 6] = s_esalt[22];
966 carry[ 7] = s_esalt[23];
967 carry[ 8] = s_esalt[24];
968 carry[ 9] = s_esalt[25];
969 carry[10] = s_esalt[26];
970 carry[11] = s_esalt[27];
971 carry[12] = s_esalt[28];
972 carry[13] = s_esalt[29];
973 carry[14] = s_esalt[30];
974 carry[15] = s_esalt[31];
976 // we can always use pw_len here, since we add exactly the hash buffer size
977 memcat64c_be (w, pw_len2, carry);
979 sha256_transform (w, digest);
998 // we can always use pw_len here, since we add exactly the hash buffer size
999 append_0x80_4x4 (w + 0, w + 4, w + 8, w + 12, pw_len2 ^ 3);
1002 w[15] = (pw_len2 + 128) * 8;
1004 sha256_transform (w, digest);
1006 const u32x d = digest[DGST_R0];
1007 const u32x h = digest[DGST_R1];
1008 const u32x c = digest[DGST_R2];
1009 const u32x g = digest[DGST_R3];
1011 COMPARE_S_SIMD (d, h, c, g);
1015 __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_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
1019 __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_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)