Commit ea26e1e239 for perl
commit ea26e1e239b856ad4c515d4b42033b9123b03d0c
Author: Lukas Mai <lukasmai.403@gmail.com>
Date: Sun Aug 16 19:24:04 2026 +0200
remove CAN64BITHASH, default to SIPHASH13 everywhere
We used to choose the default hash function (SipHash-1-3 or Zaphod32)
based on whether CAN64BITHASH was defined, which depended on whether
IVSIZE == 8 (i.e. whether perl was built to use 64-bit integers for its
scalars).
However, our hash functions don't really care about Perl scalars. We
only need to know whether a 64-bit integer C type is available, which it
is since we started assuming C99 (see perlhacktips). So remove
CAN64BITHASH and effectively hardcode it as always defined.
diff --git a/INSTALL b/INSTALL
index 7db6726eea..d74d3943ca 100644
--- a/INSTALL
+++ b/INSTALL
@@ -500,13 +500,13 @@ B<Unless stated otherwise these options are considered experimental or
insecure and are not recommended for production use.>
Since Perl 5.18 we have included support for multiple hash functions,
-although from time to time we change which functions we support,
-and which function is default (currently SBOX+SIPHASH13 on 64 bit builds
-and SBOX+ZAPHOD32 for 32 bit builds). You can choose a different
-algorithm by defining one of the following symbols during configure.
-Note that there are security implications regarding which hash function you choose
-to use. The functions are listed roughly by how secure they are believed
-to be, with the one believed to be most secure at release time being PERL_HASH_FUNC_SIPHASH.
+although from time to time we change which functions we support, and
+which function is default (currently SBOX+SIPHASH13). You can choose a
+different algorithm by defining one of the following symbols during
+configure. Note that there are security implications regarding which
+hash function you choose to use. The functions are listed roughly by how
+secure they are believed to be, with the one believed to be most secure
+at release time being C<PERL_HASH_FUNC_SIPHASH>.
PERL_HASH_FUNC_SIPHASH
PERL_HASH_FUNC_SIPHASH13
diff --git a/hv_func.h b/hv_func.h
index 36d37b5fd5..7ce53aeec0 100644
--- a/hv_func.h
+++ b/hv_func.h
@@ -15,11 +15,7 @@
|| defined(PERL_HASH_FUNC_SIPHASH13) \
|| defined(PERL_HASH_FUNC_ZAPHOD32) \
)
-# ifdef CAN64BITHASH
-# define PERL_HASH_FUNC_SIPHASH13
-# else
-# define PERL_HASH_FUNC_ZAPHOD32
-# endif
+# define PERL_HASH_FUNC_SIPHASH13
#endif
#ifndef PERL_HASH_USE_SBOX32_ALSO
diff --git a/hv_macro.h b/hv_macro.h
index 4fb3b16333..55e58e2332 100644
--- a/hv_macro.h
+++ b/hv_macro.h
@@ -1,19 +1,6 @@
#ifndef PERL_HV_MACRO_H_ /* compile once */
#define PERL_HV_MACRO_H_
-#if IVSIZE == 8
-#define CAN64BITHASH
-#endif
-
-#ifdef CAN64BITHASH
- #ifndef U64TYPE
- /* This probably isn't going to work, but failing with a compiler error due to
- lack of uint64_t is no worse than failing right now with an #error. */
- #define U64 uint64_t
- #endif
-#endif
-
-
/*-----------------------------------------------------------------------------
* Endianess and util macros
*
diff --git a/perl_siphash.h b/perl_siphash.h
index 200bcd873d..7e0a3ea22b 100644
--- a/perl_siphash.h
+++ b/perl_siphash.h
@@ -197,8 +197,6 @@ The following code should return 0x6421D9AA
=cut
*/
-#ifdef CAN64BITHASH
-
#define SIPROUND \
STMT_START { \
v0 += v1; v1=ROTL64(v1,13); v1 ^= v0; v0=ROTL64(v0,32); \
@@ -317,4 +315,3 @@ PERL_SIPHASH_FNC(
,SIPROUND;SIPROUND;SIPROUND;SIPROUND;
)
-#endif /* defined(CAN64BITHASH) */