#ifndef PERL_SEEN_HV_FUNC_H /* compile once */
#define PERL_SEEN_HV_FUNC_H
-#define PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
#if !( 0 \
+ || defined(PERL_HASH_FUNC_SIPHASH) \
|| defined(PERL_HASH_FUNC_SDBM) \
|| defined(PERL_HASH_FUNC_DJB2) \
|| defined(PERL_HASH_FUNC_SUPERFAST) \
|| defined(PERL_HASH_FUNC_ONE_AT_A_TIME_HARD) \
|| defined(PERL_HASH_FUNC_ONE_AT_A_TIME_OLD) \
)
-#ifdef HAS_QUAD
-#define PERL_HASH_FUNC_SIPHASH
-#else
#define PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
#endif
-#endif
#if defined(PERL_HASH_FUNC_SIPHASH)
# define PERL_HASH_FUNC "SIPHASH_2_4"
/* This CPU does not handle unaligned word access */
/* Consume enough so that the next data byte is word aligned */
- int i = -(long)ptr & 3;
- if(i && (STRLEN)i <= len) {
+ STRLEN i = -PTR2IV(ptr) & 3;
+ if(i && i <= len) {
MURMUR_DOBYTES(i, h1, carry, bytes_in_carry, ptr, len);
}
return hash;
}
+/* - ONE_AT_A_TIME_HARD is the 5.17+ recommend ONE_AT_A_TIME algorithm
+ * - ONE_AT_A_TIME_OLD is the unmodified 5.16 and older algorithm
+ * - ONE_AT_A_TIME is a 5.17+ tweak of ONE_AT_A_TIME_OLD to
+ * prevent strings of only \0 but different lengths from colliding
+ *
+ * Security-wise, from best to worst,
+ * ONE_AT_A_TIME_HARD > ONE_AT_A_TIME > ONE_AT_A_TIME_OLD
+ * There is a big drop-off in security between ONE_AT_A_TIME_HARD and
+ * ONE_AT_A_TIME
+ * */
/* This is the "One-at-a-Time" algorithm by Bob Jenkins
* from requirements by Colin Plumb.