This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: [perl #24071] Typo in description of binmode
[perl5.git] / hv.h
diff --git a/hv.h b/hv.h
index c43fc57..4fa4239 100644 (file)
--- a/hv.h
+++ b/hv.h
@@ -25,8 +25,8 @@ struct hek {
     I32                hek_len;        /* length of hash key */
     char       hek_key[1];     /* variable-length hash key */
     /* the hash-key is \0-terminated */
-    /* after the \0 there is a byte for flags, such as whether the key is
-       UTF8 */
+    /* after the \0 there is a byte for flags, such as whether the key
+       is UTF-8 */
 };
 
 /* hash structure: */
@@ -56,13 +56,22 @@ struct xpvhv {
  * (a) the hashed data being interpreted as "unsigned char" (new since 5.8,
  *     a "char" can be either signed or signed, depending on the compiler)
  * (b) catering for old code that uses a "char"
+ *
  * The "hash seed" feature was added in Perl 5.8.1 to perturb the results
  * to avoid "algorithmic complexity attacks".
+ *
+ * If USE_HASH_SEED is defined, hash randomisation is done by default
+ * If USE_HASH_SEED_EXPLICIT is defined, hash randomisation is done
+ * only if the environment variable PERL_HASH_SEED is set.
+ * For maximal control, one can define PERL_HASH_SEED.
+ * (see also erl.c:perl_parse()).
  */
-#if defined(USE_HASH_SEED) || defined(USE_HASH_SEED_EXPLICIT)
-#   define PERL_HASH_SEED      PL_hash_seed
-#else
-#   define PERL_HASH_SEED      0
+#ifndef PERL_HASH_SEED
+#   if defined(USE_HASH_SEED) || defined(USE_HASH_SEED_EXPLICIT)
+#       define PERL_HASH_SEED  PL_hash_seed
+#   else
+#       define PERL_HASH_SEED  0
+#   endif
 #endif
 #define PERL_HASH(hash,str,len) \
      STMT_START        { \