2015-12-04 14:47:52 +00:00
|
|
|
/**
|
2016-09-11 20:20:15 +00:00
|
|
|
* Author......: See docs/credits.txt
|
2015-12-04 14:47:52 +00:00
|
|
|
* License.....: MIT
|
|
|
|
*/
|
|
|
|
|
2016-02-04 21:31:51 +00:00
|
|
|
#define NEW_SIMD_CODE
|
|
|
|
|
2019-03-22 14:16:25 +00:00
|
|
|
#ifdef KERNEL_STATIC
|
2022-02-07 08:57:08 +00:00
|
|
|
#include M2S(INCLUDE_PATH/inc_vendor.h)
|
|
|
|
#include M2S(INCLUDE_PATH/inc_types.h)
|
|
|
|
#include M2S(INCLUDE_PATH/inc_platform.cl)
|
|
|
|
#include M2S(INCLUDE_PATH/inc_common.cl)
|
|
|
|
#include M2S(INCLUDE_PATH/inc_rp_optimized.h)
|
|
|
|
#include M2S(INCLUDE_PATH/inc_rp_optimized.cl)
|
|
|
|
#include M2S(INCLUDE_PATH/inc_simd.cl)
|
|
|
|
#include M2S(INCLUDE_PATH/inc_hash_sha1.cl)
|
2019-03-22 14:16:25 +00:00
|
|
|
#endif
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2019-03-22 21:27:58 +00:00
|
|
|
KERNEL_FQ void m11200_m04 (KERN_ATTR_RULES ())
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* modifier
|
|
|
|
*/
|
|
|
|
|
2017-08-19 14:39:22 +00:00
|
|
|
const u64 lid = get_local_id (0);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* base
|
|
|
|
*/
|
|
|
|
|
2017-08-19 14:39:22 +00:00
|
|
|
const u64 gid = get_global_id (0);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2022-01-04 21:57:26 +00:00
|
|
|
if (gid >= GID_CNT) return;
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 pw_buf0[4];
|
2016-04-18 12:39:52 +00:00
|
|
|
u32 pw_buf1[4];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
pw_buf0[0] = pws[gid].i[ 0];
|
|
|
|
pw_buf0[1] = pws[gid].i[ 1];
|
|
|
|
pw_buf0[2] = pws[gid].i[ 2];
|
|
|
|
pw_buf0[3] = pws[gid].i[ 3];
|
|
|
|
pw_buf1[0] = pws[gid].i[ 4];
|
|
|
|
pw_buf1[1] = pws[gid].i[ 5];
|
|
|
|
pw_buf1[2] = pws[gid].i[ 6];
|
|
|
|
pw_buf1[3] = pws[gid].i[ 7];
|
|
|
|
|
2018-11-20 14:26:46 +00:00
|
|
|
const u32 pw_len = pws[gid].pw_len & 63;
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* salt
|
|
|
|
*/
|
|
|
|
|
|
|
|
u32 salt_buf[5];
|
|
|
|
|
2022-01-04 17:07:18 +00:00
|
|
|
salt_buf[0] = hc_swap32_S (salt_bufs[SALT_POS_HOST].salt_buf[0]);
|
|
|
|
salt_buf[1] = hc_swap32_S (salt_bufs[SALT_POS_HOST].salt_buf[1]);
|
|
|
|
salt_buf[2] = hc_swap32_S (salt_bufs[SALT_POS_HOST].salt_buf[2]);
|
|
|
|
salt_buf[3] = hc_swap32_S (salt_bufs[SALT_POS_HOST].salt_buf[3]);
|
|
|
|
salt_buf[4] = hc_swap32_S (salt_bufs[SALT_POS_HOST].salt_buf[4]);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* loop
|
|
|
|
*/
|
|
|
|
|
2022-01-04 17:07:18 +00:00
|
|
|
for (u32 il_pos = 0; il_pos < IL_CNT; il_pos += VECT_SIZE)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-02-04 21:31:51 +00:00
|
|
|
u32x w0[4] = { 0 };
|
|
|
|
u32x w1[4] = { 0 };
|
|
|
|
u32x w2[4] = { 0 };
|
|
|
|
u32x w3[4] = { 0 };
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2019-03-25 11:24:04 +00:00
|
|
|
const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-02-27 16:18:54 +00:00
|
|
|
append_0x80_2x4_VV (w0, w1, out_len);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* sha1 ($pass)
|
|
|
|
*/
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
u32x w0_t = hc_swap32 (w0[0]);
|
|
|
|
u32x w1_t = hc_swap32 (w0[1]);
|
|
|
|
u32x w2_t = hc_swap32 (w0[2]);
|
|
|
|
u32x w3_t = hc_swap32 (w0[3]);
|
|
|
|
u32x w4_t = hc_swap32 (w1[0]);
|
|
|
|
u32x w5_t = hc_swap32 (w1[1]);
|
|
|
|
u32x w6_t = hc_swap32 (w1[2]);
|
|
|
|
u32x w7_t = hc_swap32 (w1[3]);
|
|
|
|
u32x w8_t = hc_swap32 (w2[0]);
|
|
|
|
u32x w9_t = hc_swap32 (w2[1]);
|
|
|
|
u32x wa_t = hc_swap32 (w2[2]);
|
|
|
|
u32x wb_t = hc_swap32 (w2[3]);
|
|
|
|
u32x wc_t = hc_swap32 (w3[0]);
|
|
|
|
u32x wd_t = hc_swap32 (w3[1]);
|
2016-02-04 21:31:51 +00:00
|
|
|
u32x we_t = 0;
|
|
|
|
u32x wf_t = out_len * 8;
|
|
|
|
|
|
|
|
u32x a = SHA1M_A;
|
|
|
|
u32x b = SHA1M_B;
|
|
|
|
u32x c = SHA1M_C;
|
|
|
|
u32x d = SHA1M_D;
|
|
|
|
u32x e = SHA1M_E;
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C00
|
|
|
|
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
|
2019-03-23 21:15:38 +00:00
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C01
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
|
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
|
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
|
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
|
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C02
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
|
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
|
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
|
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
|
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C03
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
|
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
|
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
|
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
|
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2022-02-10 20:53:08 +00:00
|
|
|
const u32x plain_sha1_a = a + make_u32x (SHA1M_A);
|
|
|
|
const u32x plain_sha1_b = b + make_u32x (SHA1M_B);
|
|
|
|
const u32x plain_sha1_c = c + make_u32x (SHA1M_C);
|
|
|
|
const u32x plain_sha1_d = d + make_u32x (SHA1M_D);
|
|
|
|
const u32x plain_sha1_e = e + make_u32x (SHA1M_E);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* sha1 (sha1 ($pass))
|
|
|
|
*/
|
|
|
|
|
|
|
|
w0_t = plain_sha1_a;
|
|
|
|
w1_t = plain_sha1_b;
|
|
|
|
w2_t = plain_sha1_c;
|
|
|
|
w3_t = plain_sha1_d;
|
|
|
|
w4_t = plain_sha1_e;
|
|
|
|
w5_t = 0x80000000;
|
|
|
|
w6_t = 0;
|
|
|
|
w7_t = 0;
|
|
|
|
w8_t = 0;
|
|
|
|
w9_t = 0;
|
|
|
|
wa_t = 0;
|
|
|
|
wb_t = 0;
|
|
|
|
wc_t = 0;
|
|
|
|
wd_t = 0;
|
|
|
|
we_t = 0;
|
|
|
|
wf_t = 20 * 8;
|
|
|
|
|
|
|
|
a = SHA1M_A;
|
|
|
|
b = SHA1M_B;
|
|
|
|
c = SHA1M_C;
|
|
|
|
d = SHA1M_D;
|
|
|
|
e = SHA1M_E;
|
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C00
|
|
|
|
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
|
2019-03-23 21:15:38 +00:00
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C01
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
|
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
|
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
|
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
|
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C02
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
|
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
|
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
|
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
|
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C03
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
|
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
|
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
|
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
|
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2022-02-10 20:53:08 +00:00
|
|
|
a += make_u32x (SHA1M_A);
|
|
|
|
b += make_u32x (SHA1M_B);
|
|
|
|
c += make_u32x (SHA1M_C);
|
|
|
|
d += make_u32x (SHA1M_D);
|
|
|
|
e += make_u32x (SHA1M_E);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* sha1 ($salt . sha1 (sha1 ($pass)))
|
|
|
|
*/
|
|
|
|
|
|
|
|
w0_t = salt_buf[0];
|
|
|
|
w1_t = salt_buf[1];
|
|
|
|
w2_t = salt_buf[2];
|
|
|
|
w3_t = salt_buf[3];
|
|
|
|
w4_t = salt_buf[4];
|
|
|
|
w5_t = a;
|
|
|
|
w6_t = b;
|
|
|
|
w7_t = c;
|
|
|
|
w8_t = d;
|
|
|
|
w9_t = e;
|
|
|
|
wa_t = 0x80000000;
|
|
|
|
wb_t = 0;
|
|
|
|
wc_t = 0;
|
|
|
|
wd_t = 0;
|
|
|
|
we_t = 0;
|
|
|
|
wf_t = 40 * 8;
|
|
|
|
|
|
|
|
a = SHA1M_A;
|
|
|
|
b = SHA1M_B;
|
|
|
|
c = SHA1M_C;
|
|
|
|
d = SHA1M_D;
|
|
|
|
e = SHA1M_E;
|
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C00
|
|
|
|
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
|
2019-03-23 21:15:38 +00:00
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C01
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
|
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
|
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
|
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
|
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C02
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
|
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
|
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
|
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
|
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C03
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
|
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
|
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
|
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
|
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2022-02-10 20:53:08 +00:00
|
|
|
a += make_u32x (SHA1M_A);
|
|
|
|
b += make_u32x (SHA1M_B);
|
|
|
|
c += make_u32x (SHA1M_C);
|
|
|
|
d += make_u32x (SHA1M_D);
|
|
|
|
e += make_u32x (SHA1M_E);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
a ^= plain_sha1_a;
|
|
|
|
b ^= plain_sha1_b;
|
|
|
|
c ^= plain_sha1_c;
|
|
|
|
d ^= plain_sha1_d;
|
|
|
|
e ^= plain_sha1_e;
|
|
|
|
|
2016-02-04 21:31:51 +00:00
|
|
|
COMPARE_M_SIMD (d, e, c, b);
|
2015-12-04 14:47:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-22 21:27:58 +00:00
|
|
|
KERNEL_FQ void m11200_m08 (KERN_ATTR_RULES ())
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-03-22 21:27:58 +00:00
|
|
|
KERNEL_FQ void m11200_m16 (KERN_ATTR_RULES ())
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-03-22 21:27:58 +00:00
|
|
|
KERNEL_FQ void m11200_s04 (KERN_ATTR_RULES ())
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* modifier
|
|
|
|
*/
|
|
|
|
|
2017-08-19 14:39:22 +00:00
|
|
|
const u64 lid = get_local_id (0);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* base
|
|
|
|
*/
|
|
|
|
|
2017-08-19 14:39:22 +00:00
|
|
|
const u64 gid = get_global_id (0);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2022-01-04 21:57:26 +00:00
|
|
|
if (gid >= GID_CNT) return;
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
u32 pw_buf0[4];
|
2016-04-18 12:39:52 +00:00
|
|
|
u32 pw_buf1[4];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
pw_buf0[0] = pws[gid].i[ 0];
|
|
|
|
pw_buf0[1] = pws[gid].i[ 1];
|
|
|
|
pw_buf0[2] = pws[gid].i[ 2];
|
|
|
|
pw_buf0[3] = pws[gid].i[ 3];
|
|
|
|
pw_buf1[0] = pws[gid].i[ 4];
|
|
|
|
pw_buf1[1] = pws[gid].i[ 5];
|
|
|
|
pw_buf1[2] = pws[gid].i[ 6];
|
|
|
|
pw_buf1[3] = pws[gid].i[ 7];
|
|
|
|
|
2018-11-20 14:26:46 +00:00
|
|
|
const u32 pw_len = pws[gid].pw_len & 63;
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* salt
|
|
|
|
*/
|
|
|
|
|
|
|
|
u32 salt_buf[5];
|
|
|
|
|
2022-01-04 17:07:18 +00:00
|
|
|
salt_buf[0] = hc_swap32_S (salt_bufs[SALT_POS_HOST].salt_buf[0]);
|
|
|
|
salt_buf[1] = hc_swap32_S (salt_bufs[SALT_POS_HOST].salt_buf[1]);
|
|
|
|
salt_buf[2] = hc_swap32_S (salt_bufs[SALT_POS_HOST].salt_buf[2]);
|
|
|
|
salt_buf[3] = hc_swap32_S (salt_bufs[SALT_POS_HOST].salt_buf[3]);
|
|
|
|
salt_buf[4] = hc_swap32_S (salt_bufs[SALT_POS_HOST].salt_buf[4]);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-04-18 12:39:52 +00:00
|
|
|
/**
|
|
|
|
* digest
|
|
|
|
*/
|
|
|
|
|
|
|
|
const u32 search[4] =
|
|
|
|
{
|
2022-01-04 17:07:18 +00:00
|
|
|
digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R0],
|
|
|
|
digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R1],
|
|
|
|
digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R2],
|
|
|
|
digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R3]
|
2016-04-18 12:39:52 +00:00
|
|
|
};
|
|
|
|
|
2015-12-04 14:47:52 +00:00
|
|
|
/**
|
|
|
|
* loop
|
|
|
|
*/
|
|
|
|
|
2022-01-04 17:07:18 +00:00
|
|
|
for (u32 il_pos = 0; il_pos < IL_CNT; il_pos += VECT_SIZE)
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2016-02-04 21:31:51 +00:00
|
|
|
u32x w0[4] = { 0 };
|
|
|
|
u32x w1[4] = { 0 };
|
|
|
|
u32x w2[4] = { 0 };
|
|
|
|
u32x w3[4] = { 0 };
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2019-03-25 11:24:04 +00:00
|
|
|
const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-02-27 16:18:54 +00:00
|
|
|
append_0x80_2x4_VV (w0, w1, out_len);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* sha1 ($pass)
|
|
|
|
*/
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
u32x w0_t = hc_swap32 (w0[0]);
|
|
|
|
u32x w1_t = hc_swap32 (w0[1]);
|
|
|
|
u32x w2_t = hc_swap32 (w0[2]);
|
|
|
|
u32x w3_t = hc_swap32 (w0[3]);
|
|
|
|
u32x w4_t = hc_swap32 (w1[0]);
|
|
|
|
u32x w5_t = hc_swap32 (w1[1]);
|
|
|
|
u32x w6_t = hc_swap32 (w1[2]);
|
|
|
|
u32x w7_t = hc_swap32 (w1[3]);
|
|
|
|
u32x w8_t = hc_swap32 (w2[0]);
|
|
|
|
u32x w9_t = hc_swap32 (w2[1]);
|
|
|
|
u32x wa_t = hc_swap32 (w2[2]);
|
|
|
|
u32x wb_t = hc_swap32 (w2[3]);
|
|
|
|
u32x wc_t = hc_swap32 (w3[0]);
|
|
|
|
u32x wd_t = hc_swap32 (w3[1]);
|
2016-02-04 21:31:51 +00:00
|
|
|
u32x we_t = 0;
|
|
|
|
u32x wf_t = out_len * 8;
|
|
|
|
|
|
|
|
u32x a = SHA1M_A;
|
|
|
|
u32x b = SHA1M_B;
|
|
|
|
u32x c = SHA1M_C;
|
|
|
|
u32x d = SHA1M_D;
|
|
|
|
u32x e = SHA1M_E;
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C00
|
|
|
|
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
|
2019-03-23 21:15:38 +00:00
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C01
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
|
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
|
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
|
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
|
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C02
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
|
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
|
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
|
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
|
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C03
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
|
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
|
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
|
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
|
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2022-02-10 20:53:08 +00:00
|
|
|
const u32x plain_sha1_a = a + make_u32x (SHA1M_A);
|
|
|
|
const u32x plain_sha1_b = b + make_u32x (SHA1M_B);
|
|
|
|
const u32x plain_sha1_c = c + make_u32x (SHA1M_C);
|
|
|
|
const u32x plain_sha1_d = d + make_u32x (SHA1M_D);
|
|
|
|
const u32x plain_sha1_e = e + make_u32x (SHA1M_E);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* sha1 (sha1 ($pass))
|
|
|
|
*/
|
|
|
|
|
|
|
|
w0_t = plain_sha1_a;
|
|
|
|
w1_t = plain_sha1_b;
|
|
|
|
w2_t = plain_sha1_c;
|
|
|
|
w3_t = plain_sha1_d;
|
|
|
|
w4_t = plain_sha1_e;
|
|
|
|
w5_t = 0x80000000;
|
|
|
|
w6_t = 0;
|
|
|
|
w7_t = 0;
|
|
|
|
w8_t = 0;
|
|
|
|
w9_t = 0;
|
|
|
|
wa_t = 0;
|
|
|
|
wb_t = 0;
|
|
|
|
wc_t = 0;
|
|
|
|
wd_t = 0;
|
|
|
|
we_t = 0;
|
|
|
|
wf_t = 20 * 8;
|
|
|
|
|
|
|
|
a = SHA1M_A;
|
|
|
|
b = SHA1M_B;
|
|
|
|
c = SHA1M_C;
|
|
|
|
d = SHA1M_D;
|
|
|
|
e = SHA1M_E;
|
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C00
|
|
|
|
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
|
2019-03-23 21:15:38 +00:00
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C01
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
|
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
|
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
|
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
|
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C02
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
|
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
|
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
|
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
|
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C03
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
|
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
|
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
|
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
|
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2022-02-10 20:53:08 +00:00
|
|
|
a += make_u32x (SHA1M_A);
|
|
|
|
b += make_u32x (SHA1M_B);
|
|
|
|
c += make_u32x (SHA1M_C);
|
|
|
|
d += make_u32x (SHA1M_D);
|
|
|
|
e += make_u32x (SHA1M_E);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* sha1 ($salt . sha1 (sha1 ($pass)))
|
|
|
|
*/
|
|
|
|
|
|
|
|
w0_t = salt_buf[0];
|
|
|
|
w1_t = salt_buf[1];
|
|
|
|
w2_t = salt_buf[2];
|
|
|
|
w3_t = salt_buf[3];
|
|
|
|
w4_t = salt_buf[4];
|
|
|
|
w5_t = a;
|
|
|
|
w6_t = b;
|
|
|
|
w7_t = c;
|
|
|
|
w8_t = d;
|
|
|
|
w9_t = e;
|
|
|
|
wa_t = 0x80000000;
|
|
|
|
wb_t = 0;
|
|
|
|
wc_t = 0;
|
|
|
|
wd_t = 0;
|
|
|
|
we_t = 0;
|
|
|
|
wf_t = 40 * 8;
|
|
|
|
|
|
|
|
a = SHA1M_A;
|
|
|
|
b = SHA1M_B;
|
|
|
|
c = SHA1M_C;
|
|
|
|
d = SHA1M_D;
|
|
|
|
e = SHA1M_E;
|
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C00
|
|
|
|
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
|
2019-03-23 21:15:38 +00:00
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C01
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
|
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
|
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
|
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
|
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C02
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
|
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
|
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
|
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
|
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C03
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
|
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
|
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
|
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
|
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2022-02-10 20:53:08 +00:00
|
|
|
a += make_u32x (SHA1M_A);
|
|
|
|
b += make_u32x (SHA1M_B);
|
|
|
|
c += make_u32x (SHA1M_C);
|
|
|
|
d += make_u32x (SHA1M_D);
|
|
|
|
e += make_u32x (SHA1M_E);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
a ^= plain_sha1_a;
|
|
|
|
b ^= plain_sha1_b;
|
|
|
|
c ^= plain_sha1_c;
|
|
|
|
d ^= plain_sha1_d;
|
|
|
|
e ^= plain_sha1_e;
|
|
|
|
|
2016-02-04 21:31:51 +00:00
|
|
|
COMPARE_S_SIMD (d, e, c, b);
|
2015-12-04 14:47:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-22 21:27:58 +00:00
|
|
|
KERNEL_FQ void m11200_s08 (KERN_ATTR_RULES ())
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-03-22 21:27:58 +00:00
|
|
|
KERNEL_FQ void m11200_s16 (KERN_ATTR_RULES ())
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
|
|
|
}
|