diff options
author | Yves Orton <demerphq@gmail.com> | 2022-03-06 09:38:48 +0100 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2022-03-10 03:22:33 +0100 |
commit | 8a35994ac8fcc50aaed538b7625ba79635683630 (patch) | |
tree | b6d2aad9e4c13aed063dcc5cac5dd4ef65dee621 /hv_func.h | |
parent | ed56936b9aac3c2dfc7beef2c9fc8b6d65ae074e (diff) | |
download | perl-8a35994ac8fcc50aaed538b7625ba79635683630.tar.gz |
hv_func.h - switch sbox32 initializer to use the 128 bit seeding logic
The 96 bit seed initializer was not mixing the seed bits very well and a
a 1 bit change to the seed used for the sbox initialization was not
propagating throughout the full SBOX buffer. The 128 bit variant is more
robust, and this patch makes it even more so by churning it longer, and
mixing in the seed twice.
This change also removes the old 96 bit variant and code that uses it
as I don't think it should be used anymore at all.
Diffstat (limited to 'hv_func.h')
-rw-r--r-- | hv_func.h | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -91,15 +91,15 @@ #else #define _PERL_HASH_FUNC "SBOX32_WITH_" __PERL_HASH_FUNC -/* note the 3 in the below code comes from the fact the seed to initialize the SBOX is 96 bits */ -#define _PERL_HASH_SEED_BYTES ( __PERL_HASH_SEED_BYTES + (int)( 3 * sizeof(U32)) ) +/* note the 4 in the below code comes from the fact the seed to initialize the SBOX is 128 bits */ +#define _PERL_HASH_SEED_BYTES ( __PERL_HASH_SEED_BYTES + (int)( 4 * sizeof(U32)) ) #define _PERL_HASH_STATE_BYTES \ ( __PERL_HASH_STATE_BYTES + ( ( 1 + ( 256 * SBOX32_MAX_LEN ) ) * sizeof(U32) ) ) #define _PERL_HASH_SEED_STATE(seed,state) STMT_START { \ __PERL_HASH_SEED_STATE(seed,state); \ - sbox32_seed_state96(seed + __PERL_HASH_SEED_BYTES, state + __PERL_HASH_STATE_BYTES); \ + sbox32_seed_state128(seed + __PERL_HASH_SEED_BYTES, state + __PERL_HASH_STATE_BYTES); \ } STMT_END #define _PERL_HASH_WITH_STATE(state,str,len) \ |