diff --git a/OpenCL/inc_common.cl b/OpenCL/inc_common.cl index 7403868ca..788dcaf5c 100644 --- a/OpenCL/inc_common.cl +++ b/OpenCL/inc_common.cl @@ -36773,6 +36773,44 @@ DECLSPEC void make_utf16be_S (PRIVATE_AS const u32 *in, PRIVATE_AS u32 *out1, PR #endif } +DECLSPEC void make_utf16beN_S (PRIVATE_AS const u32 *in, PRIVATE_AS u32 *out1, PRIVATE_AS u32 *out2) +{ + #if defined IS_NV + + out2[3] = hc_byte_perm_S (in[3], 0, 0x1707); + out2[2] = hc_byte_perm_S (in[3], 0, 0x3727); + out2[1] = hc_byte_perm_S (in[2], 0, 0x1707); + out2[0] = hc_byte_perm_S (in[2], 0, 0x3727); + out1[3] = hc_byte_perm_S (in[1], 0, 0x1707); + out1[2] = hc_byte_perm_S (in[1], 0, 0x3727); + out1[1] = hc_byte_perm_S (in[0], 0, 0x1707); + out1[0] = hc_byte_perm_S (in[0], 0, 0x3727); + + #elif (defined IS_AMD || defined IS_HIP) && HAS_VPERM == 1 + + out2[3] = hc_byte_perm_S (in[3], 0, 0x01070007); + out2[2] = hc_byte_perm_S (in[3], 0, 0x03070207); + out2[1] = hc_byte_perm_S (in[2], 0, 0x01070007); + out2[0] = hc_byte_perm_S (in[2], 0, 0x03070207); + out1[3] = hc_byte_perm_S (in[1], 0, 0x01070007); + out1[2] = hc_byte_perm_S (in[1], 0, 0x03070207); + out1[1] = hc_byte_perm_S (in[0], 0, 0x01070007); + out1[0] = hc_byte_perm_S (in[0], 0, 0x03070207); + + #else + + out2[3] = ((in[3] << 16) & 0xFF000000) | ((in[3] << 8) & 0x0000FF00); + out2[2] = ((in[3] >> 0) & 0xFF000000) | ((in[3] >> 8) & 0x0000FF00); + out2[1] = ((in[2] << 16) & 0xFF000000) | ((in[2] << 8) & 0x0000FF00); + out2[0] = ((in[2] >> 0) & 0xFF000000) | ((in[2] >> 8) & 0x0000FF00); + out1[3] = ((in[1] << 16) & 0xFF000000) | ((in[1] << 8) & 0x0000FF00); + out1[2] = ((in[1] >> 0) & 0xFF000000) | ((in[1] >> 8) & 0x0000FF00); + out1[1] = ((in[0] << 16) & 0xFF000000) | ((in[0] << 8) & 0x0000FF00); + out1[0] = ((in[0] >> 0) & 0xFF000000) | ((in[0] >> 8) & 0x0000FF00); + + #endif +} + DECLSPEC void make_utf16le_S (PRIVATE_AS const u32 *in, PRIVATE_AS u32 *out1, PRIVATE_AS u32 *out2) { #if defined IS_NV @@ -69083,4 +69121,4 @@ DECLSPEC void append_0x3a_4x4_VV (PRIVATE_AS u32x *w0, PRIVATE_AS u32x *w1, PRIV PACKVS44 (t0, t1, t2, t3, w0, w1, w2, w3, f); append_0x3a_4x4_S (t0, t1, t2, t3, offset.sf); PACKSV44 (t0, t1, t2, t3, w0, w1, w2, w3, f); #endif -} \ No newline at end of file +} diff --git a/OpenCL/inc_common.h b/OpenCL/inc_common.h index d842b465d..016d6240a 100644 --- a/OpenCL/inc_common.h +++ b/OpenCL/inc_common.h @@ -315,6 +315,7 @@ DECLSPEC int hc_find_keyboard_layout_map (const u32 search, const int search_len DECLSPEC int hc_execute_keyboard_layout_mapping (PRIVATE_AS u32 *w, const int pw_len, LOCAL_AS keyboard_layout_mapping_t *s_keyboard_layout_mapping_buf, const int keyboard_layout_mapping_cnt); DECLSPEC void make_utf16be (PRIVATE_AS const u32x *in, PRIVATE_AS u32x *out1, PRIVATE_AS u32x *out2); DECLSPEC void make_utf16beN (PRIVATE_AS const u32x *in, PRIVATE_AS u32x *out1, PRIVATE_AS u32x *out2); +DECLSPEC void make_utf16beN_S (PRIVATE_AS const u32 *in, PRIVATE_AS u32 *out1, PRIVATE_AS u32 *out2); DECLSPEC void make_utf16le (PRIVATE_AS const u32x *in, PRIVATE_AS u32x *out1, PRIVATE_AS u32x *out2); DECLSPEC void make_utf16leN (PRIVATE_AS const u32x *in, PRIVATE_AS u32x *out1, PRIVATE_AS u32x *out2); DECLSPEC void undo_utf16be (PRIVATE_AS const u32x *in1, PRIVATE_AS const u32x *in2, PRIVATE_AS u32x *out); diff --git a/OpenCL/inc_hash_sha1.cl b/OpenCL/inc_hash_sha1.cl index abb485189..9d543de19 100644 --- a/OpenCL/inc_hash_sha1.cl +++ b/OpenCL/inc_hash_sha1.cl @@ -839,6 +839,48 @@ DECLSPEC void sha1_update_utf16be (PRIVATE_AS sha1_ctx_t *ctx, PRIVATE_AS const sha1_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); } +DECLSPEC void sha1_update_utf16beN (PRIVATE_AS sha1_ctx_t *ctx, PRIVATE_AS const u32 *w, const int len) +{ + u32 w0[4]; + u32 w1[4]; + u32 w2[4]; + u32 w3[4]; + + int pos1; + int pos4; + + for (pos1 = 0, pos4 = 0; pos1 < len - 32; pos1 += 32, pos4 += 8) + { + w0[0] = w[pos4 + 0]; + w0[1] = w[pos4 + 1]; + w0[2] = w[pos4 + 2]; + w0[3] = w[pos4 + 3]; + w1[0] = w[pos4 + 4]; + w1[1] = w[pos4 + 5]; + w1[2] = w[pos4 + 6]; + w1[3] = w[pos4 + 7]; + + make_utf16beN_S (w1, w2, w3); + make_utf16beN_S (w0, w0, w1); + + sha1_update_64 (ctx, w0, w1, w2, w3, 32 * 2); + } + + w0[0] = w[pos4 + 0]; + w0[1] = w[pos4 + 1]; + w0[2] = w[pos4 + 2]; + w0[3] = w[pos4 + 3]; + w1[0] = w[pos4 + 4]; + w1[1] = w[pos4 + 5]; + w1[2] = w[pos4 + 6]; + w1[3] = w[pos4 + 7]; + + make_utf16beN_S (w1, w2, w3); + make_utf16beN_S (w0, w0, w1); + + sha1_update_64 (ctx, w0, w1, w2, w3, (len - pos1) * 2); +} + DECLSPEC void sha1_update_utf16be_swap (PRIVATE_AS sha1_ctx_t *ctx, PRIVATE_AS const u32 *w, const int len) { u32 w0[4]; diff --git a/OpenCL/inc_hash_sha1.h b/OpenCL/inc_hash_sha1.h index 2d537975e..35bcd0dbc 100644 --- a/OpenCL/inc_hash_sha1.h +++ b/OpenCL/inc_hash_sha1.h @@ -99,6 +99,7 @@ DECLSPEC void sha1_update_utf16le (PRIVATE_AS sha1_ctx_t *ctx, PRIVATE_AS const DECLSPEC void sha1_update_utf16le_swap (PRIVATE_AS sha1_ctx_t *ctx, PRIVATE_AS const u32 *w, const int len); DECLSPEC void sha1_update_utf16be (PRIVATE_AS sha1_ctx_t *ctx, PRIVATE_AS const u32 *w, const int len); DECLSPEC void sha1_update_utf16be_swap (PRIVATE_AS sha1_ctx_t *ctx, PRIVATE_AS const u32 *w, const int len); +DECLSPEC void sha1_update_utf16beN (PRIVATE_AS sha1_ctx_t *ctx, PRIVATE_AS const u32 *w, const int len); DECLSPEC void sha1_update_global (PRIVATE_AS sha1_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len); DECLSPEC void sha1_update_global_swap (PRIVATE_AS sha1_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len); DECLSPEC void sha1_update_global_utf16le (PRIVATE_AS sha1_ctx_t *ctx, GLOBAL_AS const u32 *w, const int len);