From fcccd9f4ec3da81d859ae7da2a505db55850e162 Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Mon, 21 Jul 2025 22:00:01 +0200 Subject: [PATCH] Improve BitLocker -m 22100 performance by: - Removing OPTI_TYPE_REGISTER_LIMIT - Removing OPTS_TYPE_MP_MULTI_DISABLE - Enabling REAL_SHM - Fixing loop value to allow autotune to find better accel value - Increasing minimum password length from 4 to 6 Fix compiler warning Rename HASH_NAME for -m 31100 Reorder changes.txt (new hash modes only) --- OpenCL/inc_hash_sha224.cl | 138 ++++++++++++++++--------------- OpenCL/inc_hash_sha256.cl | 138 ++++++++++++++++--------------- OpenCL/inc_hash_sha384.cl | 146 +++++++++++++++++---------------- OpenCL/inc_hash_sha512.cl | 140 ++++++++++++++++--------------- OpenCL/m22100-pure.cl | 2 +- docs/changes.txt | 74 ++++++++++++----- src/modules/module_22100.c | 23 ++++-- src/modules/module_31100.c | 2 +- tunings/Modules_default.hctune | 1 + 9 files changed, 360 insertions(+), 304 deletions(-) diff --git a/OpenCL/inc_hash_sha224.cl b/OpenCL/inc_hash_sha224.cl index 6ca4ab0cb..098311eb2 100644 --- a/OpenCL/inc_hash_sha224.cl +++ b/OpenCL/inc_hash_sha224.cl @@ -9,25 +9,27 @@ #include "inc_common.h" #include "inc_hash_sha224.h" -// CONSTANT_VK u32a k_sha224[64] = -// { -// SHA224C00, SHA224C01, SHA224C02, SHA224C03, -// SHA224C04, SHA224C05, SHA224C06, SHA224C07, -// SHA224C08, SHA224C09, SHA224C0a, SHA224C0b, -// SHA224C0c, SHA224C0d, SHA224C0e, SHA224C0f, -// SHA224C10, SHA224C11, SHA224C12, SHA224C13, -// SHA224C14, SHA224C15, SHA224C16, SHA224C17, -// SHA224C18, SHA224C19, SHA224C1a, SHA224C1b, -// SHA224C1c, SHA224C1d, SHA224C1e, SHA224C1f, -// SHA224C20, SHA224C21, SHA224C22, SHA224C23, -// SHA224C24, SHA224C25, SHA224C26, SHA224C27, -// SHA224C28, SHA224C29, SHA224C2a, SHA224C2b, -// SHA224C2c, SHA224C2d, SHA224C2e, SHA224C2f, -// SHA224C30, SHA224C31, SHA224C32, SHA224C33, -// SHA224C34, SHA224C35, SHA224C36, SHA224C37, -// SHA224C38, SHA224C39, SHA224C3a, SHA224C3b, -// SHA224C3c, SHA224C3d, SHA224C3e, SHA224C3f, -// }; +/* v7: outdated +CONSTANT_VK u32a k_sha224[64] = +{ + SHA224C00, SHA224C01, SHA224C02, SHA224C03, + SHA224C04, SHA224C05, SHA224C06, SHA224C07, + SHA224C08, SHA224C09, SHA224C0a, SHA224C0b, + SHA224C0c, SHA224C0d, SHA224C0e, SHA224C0f, + SHA224C10, SHA224C11, SHA224C12, SHA224C13, + SHA224C14, SHA224C15, SHA224C16, SHA224C17, + SHA224C18, SHA224C19, SHA224C1a, SHA224C1b, + SHA224C1c, SHA224C1d, SHA224C1e, SHA224C1f, + SHA224C20, SHA224C21, SHA224C22, SHA224C23, + SHA224C24, SHA224C25, SHA224C26, SHA224C27, + SHA224C28, SHA224C29, SHA224C2a, SHA224C2b, + SHA224C2c, SHA224C2d, SHA224C2e, SHA224C2f, + SHA224C30, SHA224C31, SHA224C32, SHA224C33, + SHA224C34, SHA224C35, SHA224C36, SHA224C37, + SHA224C38, SHA224C39, SHA224C3a, SHA224C3b, + SHA224C3c, SHA224C3d, SHA224C3e, SHA224C3f, +}; +*/ // important notes on this: // input buf unused bytes needs to be set to zero @@ -62,58 +64,60 @@ DECLSPEC void sha224_transform (PRIVATE_AS const u32 *w0, PRIVATE_AS const u32 * u32 we_t = w3[2]; u32 wf_t = w3[3]; - // #define ROUND_EXPAND_S() \ - // { \ - // w0_t = SHA224_EXPAND_S (we_t, w9_t, w1_t, w0_t); \ - // w1_t = SHA224_EXPAND_S (wf_t, wa_t, w2_t, w1_t); \ - // w2_t = SHA224_EXPAND_S (w0_t, wb_t, w3_t, w2_t); \ - // w3_t = SHA224_EXPAND_S (w1_t, wc_t, w4_t, w3_t); \ - // w4_t = SHA224_EXPAND_S (w2_t, wd_t, w5_t, w4_t); \ - // w5_t = SHA224_EXPAND_S (w3_t, we_t, w6_t, w5_t); \ - // w6_t = SHA224_EXPAND_S (w4_t, wf_t, w7_t, w6_t); \ - // w7_t = SHA224_EXPAND_S (w5_t, w0_t, w8_t, w7_t); \ - // w8_t = SHA224_EXPAND_S (w6_t, w1_t, w9_t, w8_t); \ - // w9_t = SHA224_EXPAND_S (w7_t, w2_t, wa_t, w9_t); \ - // wa_t = SHA224_EXPAND_S (w8_t, w3_t, wb_t, wa_t); \ - // wb_t = SHA224_EXPAND_S (w9_t, w4_t, wc_t, wb_t); \ - // wc_t = SHA224_EXPAND_S (wa_t, w5_t, wd_t, wc_t); \ - // wd_t = SHA224_EXPAND_S (wb_t, w6_t, we_t, wd_t); \ - // we_t = SHA224_EXPAND_S (wc_t, w7_t, wf_t, we_t); \ - // wf_t = SHA224_EXPAND_S (wd_t, w8_t, w0_t, wf_t); \ - // } + /* v7: outdated + #define ROUND_EXPAND_S() \ + { \ + w0_t = SHA224_EXPAND_S (we_t, w9_t, w1_t, w0_t); \ + w1_t = SHA224_EXPAND_S (wf_t, wa_t, w2_t, w1_t); \ + w2_t = SHA224_EXPAND_S (w0_t, wb_t, w3_t, w2_t); \ + w3_t = SHA224_EXPAND_S (w1_t, wc_t, w4_t, w3_t); \ + w4_t = SHA224_EXPAND_S (w2_t, wd_t, w5_t, w4_t); \ + w5_t = SHA224_EXPAND_S (w3_t, we_t, w6_t, w5_t); \ + w6_t = SHA224_EXPAND_S (w4_t, wf_t, w7_t, w6_t); \ + w7_t = SHA224_EXPAND_S (w5_t, w0_t, w8_t, w7_t); \ + w8_t = SHA224_EXPAND_S (w6_t, w1_t, w9_t, w8_t); \ + w9_t = SHA224_EXPAND_S (w7_t, w2_t, wa_t, w9_t); \ + wa_t = SHA224_EXPAND_S (w8_t, w3_t, wb_t, wa_t); \ + wb_t = SHA224_EXPAND_S (w9_t, w4_t, wc_t, wb_t); \ + wc_t = SHA224_EXPAND_S (wa_t, w5_t, wd_t, wc_t); \ + wd_t = SHA224_EXPAND_S (wb_t, w6_t, we_t, wd_t); \ + we_t = SHA224_EXPAND_S (wc_t, w7_t, wf_t, we_t); \ + wf_t = SHA224_EXPAND_S (wd_t, w8_t, w0_t, wf_t); \ + } - // #define ROUND_STEP_S(i) \ - // { \ - // SHA224_STEP_S (SHA224_F0o, SHA224_F1o, a, b, c, d, e, f, g, h, w0_t, k_sha224[i + 0]); \ - // SHA224_STEP_S (SHA224_F0o, SHA224_F1o, h, a, b, c, d, e, f, g, w1_t, k_sha224[i + 1]); \ - // SHA224_STEP_S (SHA224_F0o, SHA224_F1o, g, h, a, b, c, d, e, f, w2_t, k_sha224[i + 2]); \ - // SHA224_STEP_S (SHA224_F0o, SHA224_F1o, f, g, h, a, b, c, d, e, w3_t, k_sha224[i + 3]); \ - // SHA224_STEP_S (SHA224_F0o, SHA224_F1o, e, f, g, h, a, b, c, d, w4_t, k_sha224[i + 4]); \ - // SHA224_STEP_S (SHA224_F0o, SHA224_F1o, d, e, f, g, h, a, b, c, w5_t, k_sha224[i + 5]); \ - // SHA224_STEP_S (SHA224_F0o, SHA224_F1o, c, d, e, f, g, h, a, b, w6_t, k_sha224[i + 6]); \ - // SHA224_STEP_S (SHA224_F0o, SHA224_F1o, b, c, d, e, f, g, h, a, w7_t, k_sha224[i + 7]); \ - // SHA224_STEP_S (SHA224_F0o, SHA224_F1o, a, b, c, d, e, f, g, h, w8_t, k_sha224[i + 8]); \ - // SHA224_STEP_S (SHA224_F0o, SHA224_F1o, h, a, b, c, d, e, f, g, w9_t, k_sha224[i + 9]); \ - // SHA224_STEP_S (SHA224_F0o, SHA224_F1o, g, h, a, b, c, d, e, f, wa_t, k_sha224[i + 10]); \ - // SHA224_STEP_S (SHA224_F0o, SHA224_F1o, f, g, h, a, b, c, d, e, wb_t, k_sha224[i + 11]); \ - // SHA224_STEP_S (SHA224_F0o, SHA224_F1o, e, f, g, h, a, b, c, d, wc_t, k_sha224[i + 12]); \ - // SHA224_STEP_S (SHA224_F0o, SHA224_F1o, d, e, f, g, h, a, b, c, wd_t, k_sha224[i + 13]); \ - // SHA224_STEP_S (SHA224_F0o, SHA224_F1o, c, d, e, f, g, h, a, b, we_t, k_sha224[i + 14]); \ - // SHA224_STEP_S (SHA224_F0o, SHA224_F1o, b, c, d, e, f, g, h, a, wf_t, k_sha224[i + 15]); \ - // } + #define ROUND_STEP_S(i) \ + { \ + SHA224_STEP_S (SHA224_F0o, SHA224_F1o, a, b, c, d, e, f, g, h, w0_t, k_sha224[i + 0]); \ + SHA224_STEP_S (SHA224_F0o, SHA224_F1o, h, a, b, c, d, e, f, g, w1_t, k_sha224[i + 1]); \ + SHA224_STEP_S (SHA224_F0o, SHA224_F1o, g, h, a, b, c, d, e, f, w2_t, k_sha224[i + 2]); \ + SHA224_STEP_S (SHA224_F0o, SHA224_F1o, f, g, h, a, b, c, d, e, w3_t, k_sha224[i + 3]); \ + SHA224_STEP_S (SHA224_F0o, SHA224_F1o, e, f, g, h, a, b, c, d, w4_t, k_sha224[i + 4]); \ + SHA224_STEP_S (SHA224_F0o, SHA224_F1o, d, e, f, g, h, a, b, c, w5_t, k_sha224[i + 5]); \ + SHA224_STEP_S (SHA224_F0o, SHA224_F1o, c, d, e, f, g, h, a, b, w6_t, k_sha224[i + 6]); \ + SHA224_STEP_S (SHA224_F0o, SHA224_F1o, b, c, d, e, f, g, h, a, w7_t, k_sha224[i + 7]); \ + SHA224_STEP_S (SHA224_F0o, SHA224_F1o, a, b, c, d, e, f, g, h, w8_t, k_sha224[i + 8]); \ + SHA224_STEP_S (SHA224_F0o, SHA224_F1o, h, a, b, c, d, e, f, g, w9_t, k_sha224[i + 9]); \ + SHA224_STEP_S (SHA224_F0o, SHA224_F1o, g, h, a, b, c, d, e, f, wa_t, k_sha224[i + 10]); \ + SHA224_STEP_S (SHA224_F0o, SHA224_F1o, f, g, h, a, b, c, d, e, wb_t, k_sha224[i + 11]); \ + SHA224_STEP_S (SHA224_F0o, SHA224_F1o, e, f, g, h, a, b, c, d, wc_t, k_sha224[i + 12]); \ + SHA224_STEP_S (SHA224_F0o, SHA224_F1o, d, e, f, g, h, a, b, c, wd_t, k_sha224[i + 13]); \ + SHA224_STEP_S (SHA224_F0o, SHA224_F1o, c, d, e, f, g, h, a, b, we_t, k_sha224[i + 14]); \ + SHA224_STEP_S (SHA224_F0o, SHA224_F1o, b, c, d, e, f, g, h, a, wf_t, k_sha224[i + 15]); \ + } - // ROUND_STEP_S (0); + ROUND_STEP_S (0); - // #ifdef _unroll - // #pragma unroll - // #endif - // for (int i = 16; i < 64; i += 16) - // { - // ROUND_EXPAND_S (); ROUND_STEP_S (i); - // } + #ifdef _unroll + #pragma unroll + #endif + for (int i = 16; i < 64; i += 16) + { + ROUND_EXPAND_S (); ROUND_STEP_S (i); + } - // #undef ROUND_EXPAND_S - // #undef ROUND_STEP_S + #undef ROUND_EXPAND_S + #undef ROUND_STEP_S + */ SHA224_STEP_S (SHA224_F0o, SHA224_F1o, a, b, c, d, e, f, g, h, w0_t, SHA224C00); SHA224_STEP_S (SHA224_F0o, SHA224_F1o, h, a, b, c, d, e, f, g, w1_t, SHA224C01); diff --git a/OpenCL/inc_hash_sha256.cl b/OpenCL/inc_hash_sha256.cl index 6209f8f6c..205d2d50b 100644 --- a/OpenCL/inc_hash_sha256.cl +++ b/OpenCL/inc_hash_sha256.cl @@ -9,25 +9,27 @@ #include "inc_common.h" #include "inc_hash_sha256.h" -// CONSTANT_VK u32a k_sha256[64] = -// { -// SHA256C00, SHA256C01, SHA256C02, SHA256C03, -// SHA256C04, SHA256C05, SHA256C06, SHA256C07, -// SHA256C08, SHA256C09, SHA256C0a, SHA256C0b, -// SHA256C0c, SHA256C0d, SHA256C0e, SHA256C0f, -// SHA256C10, SHA256C11, SHA256C12, SHA256C13, -// SHA256C14, SHA256C15, SHA256C16, SHA256C17, -// SHA256C18, SHA256C19, SHA256C1a, SHA256C1b, -// SHA256C1c, SHA256C1d, SHA256C1e, SHA256C1f, -// SHA256C20, SHA256C21, SHA256C22, SHA256C23, -// SHA256C24, SHA256C25, SHA256C26, SHA256C27, -// SHA256C28, SHA256C29, SHA256C2a, SHA256C2b, -// SHA256C2c, SHA256C2d, SHA256C2e, SHA256C2f, -// SHA256C30, SHA256C31, SHA256C32, SHA256C33, -// SHA256C34, SHA256C35, SHA256C36, SHA256C37, -// SHA256C38, SHA256C39, SHA256C3a, SHA256C3b, -// SHA256C3c, SHA256C3d, SHA256C3e, SHA256C3f, -// }; +/* v7: outdated +CONSTANT_VK u32a k_sha256[64] = +{ + SHA256C00, SHA256C01, SHA256C02, SHA256C03, + SHA256C04, SHA256C05, SHA256C06, SHA256C07, + SHA256C08, SHA256C09, SHA256C0a, SHA256C0b, + SHA256C0c, SHA256C0d, SHA256C0e, SHA256C0f, + SHA256C10, SHA256C11, SHA256C12, SHA256C13, + SHA256C14, SHA256C15, SHA256C16, SHA256C17, + SHA256C18, SHA256C19, SHA256C1a, SHA256C1b, + SHA256C1c, SHA256C1d, SHA256C1e, SHA256C1f, + SHA256C20, SHA256C21, SHA256C22, SHA256C23, + SHA256C24, SHA256C25, SHA256C26, SHA256C27, + SHA256C28, SHA256C29, SHA256C2a, SHA256C2b, + SHA256C2c, SHA256C2d, SHA256C2e, SHA256C2f, + SHA256C30, SHA256C31, SHA256C32, SHA256C33, + SHA256C34, SHA256C35, SHA256C36, SHA256C37, + SHA256C38, SHA256C39, SHA256C3a, SHA256C3b, + SHA256C3c, SHA256C3d, SHA256C3e, SHA256C3f, +}; +*/ // important notes on this: // input buf unused bytes needs to be set to zero @@ -62,58 +64,60 @@ DECLSPEC void sha256_transform (PRIVATE_AS const u32 *w0, PRIVATE_AS const u32 * u32 we_t = w3[2]; u32 wf_t = w3[3]; - // #define ROUND_EXPAND_S() \ - // { \ - // w0_t = SHA256_EXPAND_S (we_t, w9_t, w1_t, w0_t); \ - // w1_t = SHA256_EXPAND_S (wf_t, wa_t, w2_t, w1_t); \ - // w2_t = SHA256_EXPAND_S (w0_t, wb_t, w3_t, w2_t); \ - // w3_t = SHA256_EXPAND_S (w1_t, wc_t, w4_t, w3_t); \ - // w4_t = SHA256_EXPAND_S (w2_t, wd_t, w5_t, w4_t); \ - // w5_t = SHA256_EXPAND_S (w3_t, we_t, w6_t, w5_t); \ - // w6_t = SHA256_EXPAND_S (w4_t, wf_t, w7_t, w6_t); \ - // w7_t = SHA256_EXPAND_S (w5_t, w0_t, w8_t, w7_t); \ - // w8_t = SHA256_EXPAND_S (w6_t, w1_t, w9_t, w8_t); \ - // w9_t = SHA256_EXPAND_S (w7_t, w2_t, wa_t, w9_t); \ - // wa_t = SHA256_EXPAND_S (w8_t, w3_t, wb_t, wa_t); \ - // wb_t = SHA256_EXPAND_S (w9_t, w4_t, wc_t, wb_t); \ - // wc_t = SHA256_EXPAND_S (wa_t, w5_t, wd_t, wc_t); \ - // wd_t = SHA256_EXPAND_S (wb_t, w6_t, we_t, wd_t); \ - // we_t = SHA256_EXPAND_S (wc_t, w7_t, wf_t, we_t); \ - // wf_t = SHA256_EXPAND_S (wd_t, w8_t, w0_t, wf_t); \ - // } + /* v7: outdated + #define ROUND_EXPAND_S() \ + { \ + w0_t = SHA256_EXPAND_S (we_t, w9_t, w1_t, w0_t); \ + w1_t = SHA256_EXPAND_S (wf_t, wa_t, w2_t, w1_t); \ + w2_t = SHA256_EXPAND_S (w0_t, wb_t, w3_t, w2_t); \ + w3_t = SHA256_EXPAND_S (w1_t, wc_t, w4_t, w3_t); \ + w4_t = SHA256_EXPAND_S (w2_t, wd_t, w5_t, w4_t); \ + w5_t = SHA256_EXPAND_S (w3_t, we_t, w6_t, w5_t); \ + w6_t = SHA256_EXPAND_S (w4_t, wf_t, w7_t, w6_t); \ + w7_t = SHA256_EXPAND_S (w5_t, w0_t, w8_t, w7_t); \ + w8_t = SHA256_EXPAND_S (w6_t, w1_t, w9_t, w8_t); \ + w9_t = SHA256_EXPAND_S (w7_t, w2_t, wa_t, w9_t); \ + wa_t = SHA256_EXPAND_S (w8_t, w3_t, wb_t, wa_t); \ + wb_t = SHA256_EXPAND_S (w9_t, w4_t, wc_t, wb_t); \ + wc_t = SHA256_EXPAND_S (wa_t, w5_t, wd_t, wc_t); \ + wd_t = SHA256_EXPAND_S (wb_t, w6_t, we_t, wd_t); \ + we_t = SHA256_EXPAND_S (wc_t, w7_t, wf_t, we_t); \ + wf_t = SHA256_EXPAND_S (wd_t, w8_t, w0_t, wf_t); \ + } - // #define ROUND_STEP_S(i) \ - // { \ - // SHA256_STEP_S (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w0_t, k_sha256[i + 0]); \ - // SHA256_STEP_S (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w1_t, k_sha256[i + 1]); \ - // SHA256_STEP_S (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, w2_t, k_sha256[i + 2]); \ - // SHA256_STEP_S (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, w3_t, k_sha256[i + 3]); \ - // SHA256_STEP_S (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, w4_t, k_sha256[i + 4]); \ - // SHA256_STEP_S (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, w5_t, k_sha256[i + 5]); \ - // SHA256_STEP_S (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, w6_t, k_sha256[i + 6]); \ - // SHA256_STEP_S (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, w7_t, k_sha256[i + 7]); \ - // SHA256_STEP_S (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w8_t, k_sha256[i + 8]); \ - // SHA256_STEP_S (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w9_t, k_sha256[i + 9]); \ - // SHA256_STEP_S (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, wa_t, k_sha256[i + 10]); \ - // SHA256_STEP_S (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, wb_t, k_sha256[i + 11]); \ - // SHA256_STEP_S (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, wc_t, k_sha256[i + 12]); \ - // SHA256_STEP_S (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, wd_t, k_sha256[i + 13]); \ - // SHA256_STEP_S (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, we_t, k_sha256[i + 14]); \ - // SHA256_STEP_S (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, wf_t, k_sha256[i + 15]); \ - // } + #define ROUND_STEP_S(i) \ + { \ + SHA256_STEP_S (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w0_t, k_sha256[i + 0]); \ + SHA256_STEP_S (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w1_t, k_sha256[i + 1]); \ + SHA256_STEP_S (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, w2_t, k_sha256[i + 2]); \ + SHA256_STEP_S (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, w3_t, k_sha256[i + 3]); \ + SHA256_STEP_S (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, w4_t, k_sha256[i + 4]); \ + SHA256_STEP_S (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, w5_t, k_sha256[i + 5]); \ + SHA256_STEP_S (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, w6_t, k_sha256[i + 6]); \ + SHA256_STEP_S (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, w7_t, k_sha256[i + 7]); \ + SHA256_STEP_S (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w8_t, k_sha256[i + 8]); \ + SHA256_STEP_S (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w9_t, k_sha256[i + 9]); \ + SHA256_STEP_S (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, wa_t, k_sha256[i + 10]); \ + SHA256_STEP_S (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, wb_t, k_sha256[i + 11]); \ + SHA256_STEP_S (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, wc_t, k_sha256[i + 12]); \ + SHA256_STEP_S (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, wd_t, k_sha256[i + 13]); \ + SHA256_STEP_S (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, we_t, k_sha256[i + 14]); \ + SHA256_STEP_S (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, wf_t, k_sha256[i + 15]); \ + } - // ROUND_STEP_S (0); + ROUND_STEP_S (0); - // #ifdef _unroll - // #pragma unroll - // #endif - // for (int i = 16; i < 64; i += 16) - // { - // ROUND_EXPAND_S (); ROUND_STEP_S (i); - // } + #ifdef _unroll + #pragma unroll + #endif + for (int i = 16; i < 64; i += 16) + { + ROUND_EXPAND_S (); ROUND_STEP_S (i); + } - // #undef ROUND_EXPAND_S - // #undef ROUND_STEP_S + #undef ROUND_EXPAND_S + #undef ROUND_STEP_S + */ SHA256_STEP_S (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w0_t, SHA256C00); SHA256_STEP_S (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w1_t, SHA256C01); diff --git a/OpenCL/inc_hash_sha384.cl b/OpenCL/inc_hash_sha384.cl index 42aa33beb..194894e43 100644 --- a/OpenCL/inc_hash_sha384.cl +++ b/OpenCL/inc_hash_sha384.cl @@ -9,29 +9,31 @@ #include "inc_common.h" #include "inc_hash_sha384.h" -// CONSTANT_VK u64a k_sha384[80] = -// { -// SHA512C00, SHA512C01, SHA512C02, SHA512C03, -// SHA512C04, SHA512C05, SHA512C06, SHA512C07, -// SHA512C08, SHA512C09, SHA512C0a, SHA512C0b, -// SHA512C0c, SHA512C0d, SHA512C0e, SHA512C0f, -// SHA512C10, SHA512C11, SHA512C12, SHA512C13, -// SHA512C14, SHA512C15, SHA512C16, SHA512C17, -// SHA512C18, SHA512C19, SHA512C1a, SHA512C1b, -// SHA512C1c, SHA512C1d, SHA512C1e, SHA512C1f, -// SHA512C20, SHA512C21, SHA512C22, SHA512C23, -// SHA512C24, SHA512C25, SHA512C26, SHA512C27, -// SHA512C28, SHA512C29, SHA512C2a, SHA512C2b, -// SHA512C2c, SHA512C2d, SHA512C2e, SHA512C2f, -// SHA512C30, SHA512C31, SHA512C32, SHA512C33, -// SHA512C34, SHA512C35, SHA512C36, SHA512C37, -// SHA512C38, SHA512C39, SHA512C3a, SHA512C3b, -// SHA512C3c, SHA512C3d, SHA512C3e, SHA512C3f, -// SHA512C40, SHA512C41, SHA512C42, SHA512C43, -// SHA512C44, SHA512C45, SHA512C46, SHA512C47, -// SHA512C48, SHA512C49, SHA512C4a, SHA512C4b, -// SHA512C4c, SHA512C4d, SHA512C4e, SHA512C4f, -// }; +/* v7: outdated +CONSTANT_VK u64a k_sha384[80] = +{ + SHA512C00, SHA512C01, SHA512C02, SHA512C03, + SHA512C04, SHA512C05, SHA512C06, SHA512C07, + SHA512C08, SHA512C09, SHA512C0a, SHA512C0b, + SHA512C0c, SHA512C0d, SHA512C0e, SHA512C0f, + SHA512C10, SHA512C11, SHA512C12, SHA512C13, + SHA512C14, SHA512C15, SHA512C16, SHA512C17, + SHA512C18, SHA512C19, SHA512C1a, SHA512C1b, + SHA512C1c, SHA512C1d, SHA512C1e, SHA512C1f, + SHA512C20, SHA512C21, SHA512C22, SHA512C23, + SHA512C24, SHA512C25, SHA512C26, SHA512C27, + SHA512C28, SHA512C29, SHA512C2a, SHA512C2b, + SHA512C2c, SHA512C2d, SHA512C2e, SHA512C2f, + SHA512C30, SHA512C31, SHA512C32, SHA512C33, + SHA512C34, SHA512C35, SHA512C36, SHA512C37, + SHA512C38, SHA512C39, SHA512C3a, SHA512C3b, + SHA512C3c, SHA512C3d, SHA512C3e, SHA512C3f, + SHA512C40, SHA512C41, SHA512C42, SHA512C43, + SHA512C44, SHA512C45, SHA512C46, SHA512C47, + SHA512C48, SHA512C49, SHA512C4a, SHA512C4b, + SHA512C4c, SHA512C4d, SHA512C4e, SHA512C4f, +}; +*/ // important notes on this: // input buf unused bytes needs to be set to zero @@ -66,58 +68,60 @@ DECLSPEC void sha384_transform (PRIVATE_AS const u32 *w0, PRIVATE_AS const u32 * u64 we_t = hl32_to_64_S (w7[0], w7[1]); u64 wf_t = hl32_to_64_S (w7[2], w7[3]); - // #define ROUND_EXPAND_S() \ - // { \ - // w0_t = SHA384_EXPAND_S (we_t, w9_t, w1_t, w0_t); \ - // w1_t = SHA384_EXPAND_S (wf_t, wa_t, w2_t, w1_t); \ - // w2_t = SHA384_EXPAND_S (w0_t, wb_t, w3_t, w2_t); \ - // w3_t = SHA384_EXPAND_S (w1_t, wc_t, w4_t, w3_t); \ - // w4_t = SHA384_EXPAND_S (w2_t, wd_t, w5_t, w4_t); \ - // w5_t = SHA384_EXPAND_S (w3_t, we_t, w6_t, w5_t); \ - // w6_t = SHA384_EXPAND_S (w4_t, wf_t, w7_t, w6_t); \ - // w7_t = SHA384_EXPAND_S (w5_t, w0_t, w8_t, w7_t); \ - // w8_t = SHA384_EXPAND_S (w6_t, w1_t, w9_t, w8_t); \ - // w9_t = SHA384_EXPAND_S (w7_t, w2_t, wa_t, w9_t); \ - // wa_t = SHA384_EXPAND_S (w8_t, w3_t, wb_t, wa_t); \ - // wb_t = SHA384_EXPAND_S (w9_t, w4_t, wc_t, wb_t); \ - // wc_t = SHA384_EXPAND_S (wa_t, w5_t, wd_t, wc_t); \ - // wd_t = SHA384_EXPAND_S (wb_t, w6_t, we_t, wd_t); \ - // we_t = SHA384_EXPAND_S (wc_t, w7_t, wf_t, we_t); \ - // wf_t = SHA384_EXPAND_S (wd_t, w8_t, w0_t, wf_t); \ - // } + /* v7: outdated + #define ROUND_EXPAND_S() \ + { \ + w0_t = SHA384_EXPAND_S (we_t, w9_t, w1_t, w0_t); \ + w1_t = SHA384_EXPAND_S (wf_t, wa_t, w2_t, w1_t); \ + w2_t = SHA384_EXPAND_S (w0_t, wb_t, w3_t, w2_t); \ + w3_t = SHA384_EXPAND_S (w1_t, wc_t, w4_t, w3_t); \ + w4_t = SHA384_EXPAND_S (w2_t, wd_t, w5_t, w4_t); \ + w5_t = SHA384_EXPAND_S (w3_t, we_t, w6_t, w5_t); \ + w6_t = SHA384_EXPAND_S (w4_t, wf_t, w7_t, w6_t); \ + w7_t = SHA384_EXPAND_S (w5_t, w0_t, w8_t, w7_t); \ + w8_t = SHA384_EXPAND_S (w6_t, w1_t, w9_t, w8_t); \ + w9_t = SHA384_EXPAND_S (w7_t, w2_t, wa_t, w9_t); \ + wa_t = SHA384_EXPAND_S (w8_t, w3_t, wb_t, wa_t); \ + wb_t = SHA384_EXPAND_S (w9_t, w4_t, wc_t, wb_t); \ + wc_t = SHA384_EXPAND_S (wa_t, w5_t, wd_t, wc_t); \ + wd_t = SHA384_EXPAND_S (wb_t, w6_t, we_t, wd_t); \ + we_t = SHA384_EXPAND_S (wc_t, w7_t, wf_t, we_t); \ + wf_t = SHA384_EXPAND_S (wd_t, w8_t, w0_t, wf_t); \ + } - // #define ROUND_STEP_S(i) \ - // { \ - // SHA384_STEP_S (SHA384_F0o, SHA384_F1o, a, b, c, d, e, f, g, h, w0_t, k_sha384[i + 0]); \ - // SHA384_STEP_S (SHA384_F0o, SHA384_F1o, h, a, b, c, d, e, f, g, w1_t, k_sha384[i + 1]); \ - // SHA384_STEP_S (SHA384_F0o, SHA384_F1o, g, h, a, b, c, d, e, f, w2_t, k_sha384[i + 2]); \ - // SHA384_STEP_S (SHA384_F0o, SHA384_F1o, f, g, h, a, b, c, d, e, w3_t, k_sha384[i + 3]); \ - // SHA384_STEP_S (SHA384_F0o, SHA384_F1o, e, f, g, h, a, b, c, d, w4_t, k_sha384[i + 4]); \ - // SHA384_STEP_S (SHA384_F0o, SHA384_F1o, d, e, f, g, h, a, b, c, w5_t, k_sha384[i + 5]); \ - // SHA384_STEP_S (SHA384_F0o, SHA384_F1o, c, d, e, f, g, h, a, b, w6_t, k_sha384[i + 6]); \ - // SHA384_STEP_S (SHA384_F0o, SHA384_F1o, b, c, d, e, f, g, h, a, w7_t, k_sha384[i + 7]); \ - // SHA384_STEP_S (SHA384_F0o, SHA384_F1o, a, b, c, d, e, f, g, h, w8_t, k_sha384[i + 8]); \ - // SHA384_STEP_S (SHA384_F0o, SHA384_F1o, h, a, b, c, d, e, f, g, w9_t, k_sha384[i + 9]); \ - // SHA384_STEP_S (SHA384_F0o, SHA384_F1o, g, h, a, b, c, d, e, f, wa_t, k_sha384[i + 10]); \ - // SHA384_STEP_S (SHA384_F0o, SHA384_F1o, f, g, h, a, b, c, d, e, wb_t, k_sha384[i + 11]); \ - // SHA384_STEP_S (SHA384_F0o, SHA384_F1o, e, f, g, h, a, b, c, d, wc_t, k_sha384[i + 12]); \ - // SHA384_STEP_S (SHA384_F0o, SHA384_F1o, d, e, f, g, h, a, b, c, wd_t, k_sha384[i + 13]); \ - // SHA384_STEP_S (SHA384_F0o, SHA384_F1o, c, d, e, f, g, h, a, b, we_t, k_sha384[i + 14]); \ - // SHA384_STEP_S (SHA384_F0o, SHA384_F1o, b, c, d, e, f, g, h, a, wf_t, k_sha384[i + 15]); \ - // } + #define ROUND_STEP_S(i) \ + { \ + SHA384_STEP_S (SHA384_F0o, SHA384_F1o, a, b, c, d, e, f, g, h, w0_t, k_sha384[i + 0]); \ + SHA384_STEP_S (SHA384_F0o, SHA384_F1o, h, a, b, c, d, e, f, g, w1_t, k_sha384[i + 1]); \ + SHA384_STEP_S (SHA384_F0o, SHA384_F1o, g, h, a, b, c, d, e, f, w2_t, k_sha384[i + 2]); \ + SHA384_STEP_S (SHA384_F0o, SHA384_F1o, f, g, h, a, b, c, d, e, w3_t, k_sha384[i + 3]); \ + SHA384_STEP_S (SHA384_F0o, SHA384_F1o, e, f, g, h, a, b, c, d, w4_t, k_sha384[i + 4]); \ + SHA384_STEP_S (SHA384_F0o, SHA384_F1o, d, e, f, g, h, a, b, c, w5_t, k_sha384[i + 5]); \ + SHA384_STEP_S (SHA384_F0o, SHA384_F1o, c, d, e, f, g, h, a, b, w6_t, k_sha384[i + 6]); \ + SHA384_STEP_S (SHA384_F0o, SHA384_F1o, b, c, d, e, f, g, h, a, w7_t, k_sha384[i + 7]); \ + SHA384_STEP_S (SHA384_F0o, SHA384_F1o, a, b, c, d, e, f, g, h, w8_t, k_sha384[i + 8]); \ + SHA384_STEP_S (SHA384_F0o, SHA384_F1o, h, a, b, c, d, e, f, g, w9_t, k_sha384[i + 9]); \ + SHA384_STEP_S (SHA384_F0o, SHA384_F1o, g, h, a, b, c, d, e, f, wa_t, k_sha384[i + 10]); \ + SHA384_STEP_S (SHA384_F0o, SHA384_F1o, f, g, h, a, b, c, d, e, wb_t, k_sha384[i + 11]); \ + SHA384_STEP_S (SHA384_F0o, SHA384_F1o, e, f, g, h, a, b, c, d, wc_t, k_sha384[i + 12]); \ + SHA384_STEP_S (SHA384_F0o, SHA384_F1o, d, e, f, g, h, a, b, c, wd_t, k_sha384[i + 13]); \ + SHA384_STEP_S (SHA384_F0o, SHA384_F1o, c, d, e, f, g, h, a, b, we_t, k_sha384[i + 14]); \ + SHA384_STEP_S (SHA384_F0o, SHA384_F1o, b, c, d, e, f, g, h, a, wf_t, k_sha384[i + 15]); \ + } - // ROUND_STEP_S (0); + ROUND_STEP_S (0); - // #ifdef _unroll - // #pragma unroll - // #endif - // for (int i = 16; i < 80; i += 16) - // { - // ROUND_EXPAND_S (); ROUND_STEP_S (i); - // } + #ifdef _unroll + #pragma unroll + #endif + for (int i = 16; i < 80; i += 16) + { + ROUND_EXPAND_S (); ROUND_STEP_S (i); + } - // #undef ROUND_EXPAND_S - // #undef ROUND_STEP_S + #undef ROUND_EXPAND_S + #undef ROUND_STEP_S + */ SHA384_STEP_S (SHA384_F0o, SHA384_F1o, a, b, c, d, e, f, g, h, w0_t, SHA512C00); SHA384_STEP_S (SHA384_F0o, SHA384_F1o, h, a, b, c, d, e, f, g, w1_t, SHA512C01); diff --git a/OpenCL/inc_hash_sha512.cl b/OpenCL/inc_hash_sha512.cl index 8e4378360..40ba6281b 100644 --- a/OpenCL/inc_hash_sha512.cl +++ b/OpenCL/inc_hash_sha512.cl @@ -9,29 +9,31 @@ #include "inc_common.h" #include "inc_hash_sha512.h" -// CONSTANT_VK u64a k_sha512[80] = -// { -// SHA512C00, SHA512C01, SHA512C02, SHA512C03, -// SHA512C04, SHA512C05, SHA512C06, SHA512C07, -// SHA512C08, SHA512C09, SHA512C0a, SHA512C0b, -// SHA512C0c, SHA512C0d, SHA512C0e, SHA512C0f, -// SHA512C10, SHA512C11, SHA512C12, SHA512C13, -// SHA512C14, SHA512C15, SHA512C16, SHA512C17, -// SHA512C18, SHA512C19, SHA512C1a, SHA512C1b, -// SHA512C1c, SHA512C1d, SHA512C1e, SHA512C1f, -// SHA512C20, SHA512C21, SHA512C22, SHA512C23, -// SHA512C24, SHA512C25, SHA512C26, SHA512C27, -// SHA512C28, SHA512C29, SHA512C2a, SHA512C2b, -// SHA512C2c, SHA512C2d, SHA512C2e, SHA512C2f, -// SHA512C30, SHA512C31, SHA512C32, SHA512C33, -// SHA512C34, SHA512C35, SHA512C36, SHA512C37, -// SHA512C38, SHA512C39, SHA512C3a, SHA512C3b, -// SHA512C3c, SHA512C3d, SHA512C3e, SHA512C3f, -// SHA512C40, SHA512C41, SHA512C42, SHA512C43, -// SHA512C44, SHA512C45, SHA512C46, SHA512C47, -// SHA512C48, SHA512C49, SHA512C4a, SHA512C4b, -// SHA512C4c, SHA512C4d, SHA512C4e, SHA512C4f, -// }; +/* v7: outdated +CONSTANT_VK u64a k_sha512[80] = +{ + SHA512C00, SHA512C01, SHA512C02, SHA512C03, + SHA512C04, SHA512C05, SHA512C06, SHA512C07, + SHA512C08, SHA512C09, SHA512C0a, SHA512C0b, + SHA512C0c, SHA512C0d, SHA512C0e, SHA512C0f, + SHA512C10, SHA512C11, SHA512C12, SHA512C13, + SHA512C14, SHA512C15, SHA512C16, SHA512C17, + SHA512C18, SHA512C19, SHA512C1a, SHA512C1b, + SHA512C1c, SHA512C1d, SHA512C1e, SHA512C1f, + SHA512C20, SHA512C21, SHA512C22, SHA512C23, + SHA512C24, SHA512C25, SHA512C26, SHA512C27, + SHA512C28, SHA512C29, SHA512C2a, SHA512C2b, + SHA512C2c, SHA512C2d, SHA512C2e, SHA512C2f, + SHA512C30, SHA512C31, SHA512C32, SHA512C33, + SHA512C34, SHA512C35, SHA512C36, SHA512C37, + SHA512C38, SHA512C39, SHA512C3a, SHA512C3b, + SHA512C3c, SHA512C3d, SHA512C3e, SHA512C3f, + SHA512C40, SHA512C41, SHA512C42, SHA512C43, + SHA512C44, SHA512C45, SHA512C46, SHA512C47, + SHA512C48, SHA512C49, SHA512C4a, SHA512C4b, + SHA512C4c, SHA512C4d, SHA512C4e, SHA512C4f, +}; +*/ // important notes on this: // input buf unused bytes needs to be set to zero @@ -66,55 +68,57 @@ DECLSPEC void sha512_transform (PRIVATE_AS const u32 *w0, PRIVATE_AS const u32 * u64 we_t = hl32_to_64_S (w7[0], w7[1]); u64 wf_t = hl32_to_64_S (w7[2], w7[3]); - // #define ROUND_EXPAND_S() \ - // { \ - // w0_t = SHA512_EXPAND_S (we_t, w9_t, w1_t, w0_t); \ - // w1_t = SHA512_EXPAND_S (wf_t, wa_t, w2_t, w1_t); \ - // w2_t = SHA512_EXPAND_S (w0_t, wb_t, w3_t, w2_t); \ - // w3_t = SHA512_EXPAND_S (w1_t, wc_t, w4_t, w3_t); \ - // w4_t = SHA512_EXPAND_S (w2_t, wd_t, w5_t, w4_t); \ - // w5_t = SHA512_EXPAND_S (w3_t, we_t, w6_t, w5_t); \ - // w6_t = SHA512_EXPAND_S (w4_t, wf_t, w7_t, w6_t); \ - // w7_t = SHA512_EXPAND_S (w5_t, w0_t, w8_t, w7_t); \ - // w8_t = SHA512_EXPAND_S (w6_t, w1_t, w9_t, w8_t); \ - // w9_t = SHA512_EXPAND_S (w7_t, w2_t, wa_t, w9_t); \ - // wa_t = SHA512_EXPAND_S (w8_t, w3_t, wb_t, wa_t); \ - // wb_t = SHA512_EXPAND_S (w9_t, w4_t, wc_t, wb_t); \ - // wc_t = SHA512_EXPAND_S (wa_t, w5_t, wd_t, wc_t); \ - // wd_t = SHA512_EXPAND_S (wb_t, w6_t, we_t, wd_t); \ - // we_t = SHA512_EXPAND_S (wc_t, w7_t, wf_t, we_t); \ - // wf_t = SHA512_EXPAND_S (wd_t, w8_t, w0_t, wf_t); \ - // } + /* v7: outdated + #define ROUND_EXPAND_S() \ + { \ + w0_t = SHA512_EXPAND_S (we_t, w9_t, w1_t, w0_t); \ + w1_t = SHA512_EXPAND_S (wf_t, wa_t, w2_t, w1_t); \ + w2_t = SHA512_EXPAND_S (w0_t, wb_t, w3_t, w2_t); \ + w3_t = SHA512_EXPAND_S (w1_t, wc_t, w4_t, w3_t); \ + w4_t = SHA512_EXPAND_S (w2_t, wd_t, w5_t, w4_t); \ + w5_t = SHA512_EXPAND_S (w3_t, we_t, w6_t, w5_t); \ + w6_t = SHA512_EXPAND_S (w4_t, wf_t, w7_t, w6_t); \ + w7_t = SHA512_EXPAND_S (w5_t, w0_t, w8_t, w7_t); \ + w8_t = SHA512_EXPAND_S (w6_t, w1_t, w9_t, w8_t); \ + w9_t = SHA512_EXPAND_S (w7_t, w2_t, wa_t, w9_t); \ + wa_t = SHA512_EXPAND_S (w8_t, w3_t, wb_t, wa_t); \ + wb_t = SHA512_EXPAND_S (w9_t, w4_t, wc_t, wb_t); \ + wc_t = SHA512_EXPAND_S (wa_t, w5_t, wd_t, wc_t); \ + wd_t = SHA512_EXPAND_S (wb_t, w6_t, we_t, wd_t); \ + we_t = SHA512_EXPAND_S (wc_t, w7_t, wf_t, we_t); \ + wf_t = SHA512_EXPAND_S (wd_t, w8_t, w0_t, wf_t); \ + } - // #define ROUND_STEP_S(i) \ - // { \ - // SHA512_STEP_S (SHA512_F0o, SHA512_F1o, a, b, c, d, e, f, g, h, w0_t, k_sha512[i + 0]); \ - // SHA512_STEP_S (SHA512_F0o, SHA512_F1o, h, a, b, c, d, e, f, g, w1_t, k_sha512[i + 1]); \ - // SHA512_STEP_S (SHA512_F0o, SHA512_F1o, g, h, a, b, c, d, e, f, w2_t, k_sha512[i + 2]); \ - // SHA512_STEP_S (SHA512_F0o, SHA512_F1o, f, g, h, a, b, c, d, e, w3_t, k_sha512[i + 3]); \ - // SHA512_STEP_S (SHA512_F0o, SHA512_F1o, e, f, g, h, a, b, c, d, w4_t, k_sha512[i + 4]); \ - // SHA512_STEP_S (SHA512_F0o, SHA512_F1o, d, e, f, g, h, a, b, c, w5_t, k_sha512[i + 5]); \ - // SHA512_STEP_S (SHA512_F0o, SHA512_F1o, c, d, e, f, g, h, a, b, w6_t, k_sha512[i + 6]); \ - // SHA512_STEP_S (SHA512_F0o, SHA512_F1o, b, c, d, e, f, g, h, a, w7_t, k_sha512[i + 7]); \ - // SHA512_STEP_S (SHA512_F0o, SHA512_F1o, a, b, c, d, e, f, g, h, w8_t, k_sha512[i + 8]); \ - // SHA512_STEP_S (SHA512_F0o, SHA512_F1o, h, a, b, c, d, e, f, g, w9_t, k_sha512[i + 9]); \ - // SHA512_STEP_S (SHA512_F0o, SHA512_F1o, g, h, a, b, c, d, e, f, wa_t, k_sha512[i + 10]); \ - // SHA512_STEP_S (SHA512_F0o, SHA512_F1o, f, g, h, a, b, c, d, e, wb_t, k_sha512[i + 11]); \ - // SHA512_STEP_S (SHA512_F0o, SHA512_F1o, e, f, g, h, a, b, c, d, wc_t, k_sha512[i + 12]); \ - // SHA512_STEP_S (SHA512_F0o, SHA512_F1o, d, e, f, g, h, a, b, c, wd_t, k_sha512[i + 13]); \ - // SHA512_STEP_S (SHA512_F0o, SHA512_F1o, c, d, e, f, g, h, a, b, we_t, k_sha512[i + 14]); \ - // SHA512_STEP_S (SHA512_F0o, SHA512_F1o, b, c, d, e, f, g, h, a, wf_t, k_sha512[i + 15]); \ - // } + #define ROUND_STEP_S(i) \ + { \ + SHA512_STEP_S (SHA512_F0o, SHA512_F1o, a, b, c, d, e, f, g, h, w0_t, k_sha512[i + 0]); \ + SHA512_STEP_S (SHA512_F0o, SHA512_F1o, h, a, b, c, d, e, f, g, w1_t, k_sha512[i + 1]); \ + SHA512_STEP_S (SHA512_F0o, SHA512_F1o, g, h, a, b, c, d, e, f, w2_t, k_sha512[i + 2]); \ + SHA512_STEP_S (SHA512_F0o, SHA512_F1o, f, g, h, a, b, c, d, e, w3_t, k_sha512[i + 3]); \ + SHA512_STEP_S (SHA512_F0o, SHA512_F1o, e, f, g, h, a, b, c, d, w4_t, k_sha512[i + 4]); \ + SHA512_STEP_S (SHA512_F0o, SHA512_F1o, d, e, f, g, h, a, b, c, w5_t, k_sha512[i + 5]); \ + SHA512_STEP_S (SHA512_F0o, SHA512_F1o, c, d, e, f, g, h, a, b, w6_t, k_sha512[i + 6]); \ + SHA512_STEP_S (SHA512_F0o, SHA512_F1o, b, c, d, e, f, g, h, a, w7_t, k_sha512[i + 7]); \ + SHA512_STEP_S (SHA512_F0o, SHA512_F1o, a, b, c, d, e, f, g, h, w8_t, k_sha512[i + 8]); \ + SHA512_STEP_S (SHA512_F0o, SHA512_F1o, h, a, b, c, d, e, f, g, w9_t, k_sha512[i + 9]); \ + SHA512_STEP_S (SHA512_F0o, SHA512_F1o, g, h, a, b, c, d, e, f, wa_t, k_sha512[i + 10]); \ + SHA512_STEP_S (SHA512_F0o, SHA512_F1o, f, g, h, a, b, c, d, e, wb_t, k_sha512[i + 11]); \ + SHA512_STEP_S (SHA512_F0o, SHA512_F1o, e, f, g, h, a, b, c, d, wc_t, k_sha512[i + 12]); \ + SHA512_STEP_S (SHA512_F0o, SHA512_F1o, d, e, f, g, h, a, b, c, wd_t, k_sha512[i + 13]); \ + SHA512_STEP_S (SHA512_F0o, SHA512_F1o, c, d, e, f, g, h, a, b, we_t, k_sha512[i + 14]); \ + SHA512_STEP_S (SHA512_F0o, SHA512_F1o, b, c, d, e, f, g, h, a, wf_t, k_sha512[i + 15]); \ + } - // ROUND_STEP_S (0); + ROUND_STEP_S (0); - // for (int i = 16; i < 80; i += 16) - // { - // ROUND_EXPAND_S (); ROUND_STEP_S (i); - // } + for (int i = 16; i < 80; i += 16) + { + ROUND_EXPAND_S (); ROUND_STEP_S (i); + } - // #undef ROUND_EXPAND_S - // #undef ROUND_STEP_S + #undef ROUND_EXPAND_S + #undef ROUND_STEP_S + */ SHA512_STEP_S (SHA512_F0o, SHA512_F1o, a, b, c, d, e, f, g, h, w0_t, SHA512C00); SHA512_STEP_S (SHA512_F0o, SHA512_F1o, h, a, b, c, d, e, f, g, w1_t, SHA512C01); diff --git a/OpenCL/m22100-pure.cl b/OpenCL/m22100-pure.cl index 7de15021e..895b77054 100644 --- a/OpenCL/m22100-pure.cl +++ b/OpenCL/m22100-pure.cl @@ -264,7 +264,7 @@ KERNEL_FQ KERNEL_FA void m22100_loop (KERN_ATTR_TMPS_ESALT (bitlocker_tmp_t, bit * in order for this to work we need to set a fixed loop count to FIXED_ITER_TOTAL in module */ - #define FIXED_ITER_TOTAL 4096 + #define FIXED_ITER_TOTAL 1024 #define FIXED_ITER_INCR 8 // seems to be a good trade-off between memory reads and available registers #ifdef REAL_SHM diff --git a/docs/changes.txt b/docs/changes.txt index c7e939c8b..23e0f0a7d 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -1,62 +1,96 @@ * changes v6.2.6 -> v6.2.x ## -## Algorithms +## New Algorithms ## +## Primitives, KDFs + +- Added hash-mode: Argon2 +- Added hash-mode: BLAKE2s-256 +- Added hash-mode: PBKDF1-SHA1 +- Added hash-mode: RIPEMD-320 +- Added hash-mode: ShangMi 3 (SM3) +- Added hash-mode: HMAC-BLAKE2S (key = $pass) +- Added hash-mode: HMAC-RIPEMD160 (key = $pass) +- Added hash-mode: HMAC-RIPEMD160 (key = $salt) +- Added hash-mode: HMAC-RIPEMD320 (key = $pass) +- Added hash-mode: HMAC-RIPEMD320 (key = $salt) + +## Bridged + +- Added hash-mode: argon2id [Bridged: reference implementation + tunings] +- Added hash-mode: scrypt [Bridged: Scrypt-Jane ROMix] +- Added hash-mode: scrypt [Bridged: Scrypt-Yescrypt] +- Added hash-mode: Generic Hash [Bridged: Python Interpreter free-threading] +- Added hash-mode: Generic Hash [Bridged: Python Interpreter with GIL] + +## Endpoint + - Added hash-mode: 1Password, mobilekeychain (1Password 8) - Added hash-mode: Adobe AEM (SSPR, SHA-256 with Salt) - Added hash-mode: Adobe AEM (SSPR, SHA-512 with Salt) - Added hash-mode: Anope IRC Services (enc_sha256) -- Added hash-mode: BLAKE2s-256 +- Added hash-mode: Apache Shiro 1 SHA-512 - Added hash-mode: BestCrypt v4 Volume Encryption - Added hash-mode: Bisq .wallet (scrypt) -- Added hash-mode: Bitcoin raw private key (P2PKH) -- Added hash-mode: Bitcoin raw private key (P2SH(P2WPKH)) -- Added hash-mode: Bitcoin raw private key (P2WPKH, Bech32) -- Added hash-mode: CubeCart (Whirlpool($salt.$pass.$salt) +- Added hash-mode: Bitcoin raw private key (P2PKH), compressed +- Added hash-mode: Bitcoin raw private key (P2PKH), uncompressed +- Added hash-mode: Bitcoin raw private key (P2SH(P2WPKH)), compressed +- Added hash-mode: Bitcoin raw private key (P2SH(P2WPKH)), uncompressed +- Added hash-mode: Bitcoin raw private key (P2WPKH, Bech32), compressed +- Added hash-mode: Bitcoin raw private key (P2WPKH, Bech32), uncompressed +- Added hash-mode: Citrix NetScaler (PBKDF2-HMAC-SHA256) +- Added hash-mode: CubeCart (whirlpool($salt.$pass.$salt)) - Added hash-mode: DANE RFC7929/RFC8162 SHA2-256 -- Added hash-mode: Dahua NVR/DVR/HVR (md5($salt1.strtoupper(md5($salt2.$pass)))) - Added hash-mode: Dogechain.info Wallet -- Added hash-mode: Domain Cached Credentials (DCC), MS Cache (NT) - Added hash-mode: Domain Cached Credentials 2 (DCC2), MS Cache 2, (NT) +- Added hash-mode: Domain Cached Credentials (DCC), MS Cache (NT) +- Added hash-mode: Empire CMS (Admin password) - Added hash-mode: ENCsecurity Datavault (MD5/keychain) - Added hash-mode: ENCsecurity Datavault (MD5/no keychain) - Added hash-mode: ENCsecurity Datavault (PBKDF2/keychain) - Added hash-mode: ENCsecurity Datavault (PBKDF2/no keychain) -- Added hash-mode: Empire CMS (Admin password) -- Added hash-mode: GPG (AES-128/AES-256 (SHA-1($pass))) - Added hash-mode: GPG (AES-128/AES-256 (SHA-256($pass))) - Added hash-mode: GPG (AES-128/AES-256 (SHA-512($pass))) - Added hash-mode: GPG (CAST5 (SHA-1($pass))) -- Added hash-mode: HMAC-RIPEMD160 (key = $pass) -- Added hash-mode: HMAC-RIPEMD160 (key = $salt) -- Added hash-mode: HMAC-RIPEMD320 (key = $pass) -- Added hash-mode: HMAC-RIPEMD320 (key = $salt) +- Added hash-mode: IPMI2 RAKP HMAC-MD5 - Added hash-mode: Kerberos 5, etype 17, AS-REP - Added hash-mode: Kerberos 5, etype 18, AS-REP +- Added hash-mode: Kremlin Encrypt 3.0 w/NewDES +- Added hash-mode: mega.nz password-protected link (PBKDF2-HMAC-SHA512) - Added hash-mode: MetaMask Mobile Wallet - Added hash-mode: MetaMask Wallet (short hash, plaintext check) - Added hash-mode: Microsoft Online Account (PBKDF2-HMAC-SHA256 + AES256) +- Added hash-mode: MS SNTP - Added hash-mode: NetIQ SSPR (MD5) - Added hash-mode: NetIQ SSPR (PBKDF2WithHmacSHA1) - Added hash-mode: NetIQ SSPR (PBKDF2WithHmacSHA256) - Added hash-mode: NetIQ SSPR (PBKDF2WithHmacSHA512) +- Added hash-mode: NetIQ SSPR (SHA1) - Added hash-mode: NetIQ SSPR (SHA-1 with Salt) - Added hash-mode: NetIQ SSPR (SHA-256 with Salt) - Added hash-mode: NetIQ SSPR (SHA-512 with Salt) -- Added hash-mode: NetIQ SSPR (SHA1) +- Added hash-mode: PDF 1.3 - 1.6 (Acrobat 4 - 8) w/ RC4-40 +- Added hash-mode: Perl Mojolicious session cookie (HMAC-SHA256, >= v9.19) +- Added hash-mode: QNX 7 /etc/shadow (SHA512) +- Added hash-mode: RACF KDFAES - Added hash-mode: RC4 104-bit DropN - Added hash-mode: RC4 40-bit DropN - Added hash-mode: RC4 72-bit DropN -- Added hash-mode: RIPEMD-320 - Added hash-mode: RSA Security Analytics / NetWitness (sha256) - Added hash-mode: SecureCRT MasterPassphrase v2 -- Added hash-mode: Veeam VB -- Added hash-mode: bcrypt(sha256($pass)) -- Added hash-mode: md5($salt.md5($pass).$salt) +- Added hash-mode: Veeam VBK +- Added hash-mode: WBB4 (Woltlab Burning Board) Plugin [bcrypt(bcrypt($pass))] + +## Constructs + +- Added hash-mode: bcrypt(sha256($pass)) / bcryptsha256 +- Added hash-mode: bcrypt-sha256 v2 bcrypt(HMAC-SHA256($pass)) - Added hash-mode: md5($salt1.$pass.$salt2) - Added hash-mode: md5($salt1.sha1($salt2.$pass)) +- Added hash-mode: md5($salt1.strtoupper(md5($salt2.$pass))) +- Added hash-mode: md5($salt.md5($pass).$salt) - Added hash-mode: md5(md5($pass.$salt)) - Added hash-mode: md5(md5($salt).md5(md5($pass))) - Added hash-mode: md5(md5(md5($pass)).$salt) @@ -65,7 +99,7 @@ - Added hash-mode: md5(sha1($pass.$salt)) - Added hash-mode: md5(sha1($salt.$pass)) - Added hash-mode: md5(sha1(md5($pass))) -- Added hash-mode: mega.nz password-protected link (PBKDF2-HMAC-SHA512) +- Added hash-mode: sha256(sha256($pass.$salt)) - Added hash-mode: sha512(sha512($pass).$salt) - Added hash-mode: sha512(sha512_bin($pass).$salt) diff --git a/src/modules/module_22100.c b/src/modules/module_22100.c index 3b049a74e..f12a01d19 100644 --- a/src/modules/module_22100.c +++ b/src/modules/module_22100.c @@ -20,11 +20,9 @@ static const u32 DGST_SIZE = DGST_SIZE_4_4; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "BitLocker"; static const u64 KERN_TYPE = 22100; -static const u32 OPTI_TYPE = OPTI_TYPE_SLOW_HASH_SIMD_LOOP - | OPTI_TYPE_REGISTER_LIMIT; +static const u32 OPTI_TYPE = OPTI_TYPE_SLOW_HASH_SIMD_LOOP; static const u64 OPTS_TYPE = OPTS_TYPE_STOCK_MODULE - | OPTS_TYPE_PT_GENERATE_LE - | OPTS_TYPE_MP_MULTI_DISABLE; + | OPTS_TYPE_PT_GENERATE_LE; static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; static const char *ST_PASS = "hashcat"; static const char *ST_HASH = "$bitlocker$1$16$6f972989ddc209f1eccf07313a7266a2$1048576$12$3a33a8eaff5e6f81d907b591$60$316b0f6d4cb445fb056f0e3e0633c413526ff4481bbf588917b70a4e8f8075f5ceb45958a800b42cb7ff9b7f5e17c6145bf8561ea86f52d3592059fb"; @@ -80,7 +78,7 @@ char *module_jit_build_options (MAYBE_UNUSED const hashconfig_t *hashconfig, MAY // NVIDIA GPU if (device_param->opencl_device_vendor_id == VENDOR_ID_NV) { - hc_asprintf (&jit_build_options, "-D _unroll -D FORCE_DISABLE_SHM"); + hc_asprintf (&jit_build_options, "-D _unroll"); } // AMD-GPU-PRO @@ -120,24 +118,31 @@ u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED c u32 module_kernel_loops_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u32 kernel_loops_min = 4096; + const u32 kernel_loops_min = 1024; return kernel_loops_min; } u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u32 kernel_loops_max = 4096; + const u32 kernel_loops_max = 1024; return kernel_loops_max; } +u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_threads_max = 512; + + return kernel_threads_max; +} + u32 module_pw_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { // https://docs.microsoft.com/en-us/windows/security/information-protection/bitlocker/bitlocker-group-policy-settings // The startup PIN must have a minimum length of 4 digits, and it can have a maximum length of 20 digits. By default, the minimum PIN length is 6. - const u32 pw_min = 4; + const u32 pw_min = 6; return pw_min; } @@ -466,7 +471,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_kernel_accel_min = MODULE_DEFAULT; module_ctx->module_kernel_loops_max = module_kernel_loops_max; module_ctx->module_kernel_loops_min = module_kernel_loops_min; - module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = module_kernel_threads_max; module_ctx->module_kernel_threads_min = MODULE_DEFAULT; module_ctx->module_kern_type = module_kern_type; module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; diff --git a/src/modules/module_31100.c b/src/modules/module_31100.c index 6a4125041..402f7b888 100644 --- a/src/modules/module_31100.c +++ b/src/modules/module_31100.c @@ -17,7 +17,7 @@ static const u32 DGST_POS2 = 1; static const u32 DGST_POS3 = 5; static const u32 DGST_SIZE = DGST_SIZE_4_8; static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; -static const char *HASH_NAME = "SM3"; +static const char *HASH_NAME = "ShangMi 3 (SM3)"; static const u64 KERN_TYPE = 31100; static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE | OPTI_TYPE_PRECOMPUTE_INIT diff --git a/tunings/Modules_default.hctune b/tunings/Modules_default.hctune index 59ba53a3a..44d946d4d 100644 --- a/tunings/Modules_default.hctune +++ b/tunings/Modules_default.hctune @@ -94,6 +94,7 @@ ALIAS_AMD 3 5500 4 A ALIAS_AMD 3 9900 4 A A ALIAS_AMD 3 16400 4 A A ALIAS_AMD 3 18700 4 A A +ALIAS_AMD 3 21200 4 A A ALIAS_AMD 3 99999 8 A A ##