@@ -11,42 +11,98 @@ See also the :c:member:`PyTypeObject.tp_hash` member and :ref:`numeric-hash`.
1111
1212 ..versionadded ::3.2
1313
14+
1415..c :type :: Py_uhash_t
1516
1617 Hash value type: unsigned integer.
1718
1819 ..versionadded ::3.2
1920
21+
22+ ..c :macro :: Py_HASH_ALGORITHM
23+
24+ A numerical value indicating the algorithm for hashing of:class: `str `,
25+ :class: `bytes `, and:class: `memoryview `.
26+
27+ The algorithm name is exposed by:data: `sys.hash_info.algorithm `.
28+
29+ ..versionadded ::3.4
30+
31+
32+ ..c :macro :: Py_HASH_FNV
33+ Py_HASH_SIPHASH24
34+ Py_HASH_SIPHASH13
35+
36+ Numerical values to compare to:c:macro: `Py_HASH_ALGORITHM ` to determine
37+ which algorithm is used for hashing. The hash algorithm can be configured
38+ via the configure:option: `--with-hash-algorithm ` option.
39+
40+ ..versionadded ::3.4
41+ Add:c:macro: `!Py_HASH_FNV ` and:c:macro: `!Py_HASH_SIPHASH24 `.
42+
43+ ..versionadded ::3.11
44+ Add:c:macro: `!Py_HASH_SIPHASH13 `.
45+
46+
47+ ..c :macro :: Py_HASH_CUTOFF
48+
49+ Buffers of length in range ``[1, Py_HASH_CUTOFF) `` are hashed using DJBX33A
50+ instead of the algorithm described by:c:macro: `Py_HASH_ALGORITHM `.
51+
52+ - A:c:macro: `!Py_HASH_CUTOFF ` of 0 disables the optimization.
53+ -:c:macro: `!Py_HASH_CUTOFF ` must be non-negative and less or equal than 7.
54+
55+ 32-bit platforms should use a cutoff smaller than 64-bit platforms because
56+ it is easier to create colliding strings. A cutoff of 7 on 64-bit platforms
57+ and 5 on 32-bit platforms should provide a decent safety margin.
58+
59+ This corresponds to the:data: `sys.hash_info.cutoff ` constant.
60+
61+ ..versionadded ::3.4
62+
63+
2064..c :macro :: PyHASH_MODULUS
2165
22- The `Mersenne prime <https://en.wikipedia.org/wiki/Mersenne_prime >`_ ``P = 2**n -1 ``, used for numeric hash scheme.
66+ The `Mersenne prime <https://en.wikipedia.org/wiki/Mersenne_prime >`_ ``P = 2**n -1 ``,
67+ used for numeric hash scheme.
68+
69+ This corresponds to the:data: `sys.hash_info.modulus ` constant.
2370
2471 ..versionadded ::3.13
2572
73+
2674..c :macro :: PyHASH_BITS
2775
2876 The exponent ``n `` of ``P `` in:c:macro: `PyHASH_MODULUS `.
2977
3078 ..versionadded ::3.13
3179
80+
3281..c :macro :: PyHASH_MULTIPLIER
3382
3483 Prime multiplier used in string and various other hashes.
3584
3685 ..versionadded ::3.13
3786
87+
3888..c :macro :: PyHASH_INF
3989
4090 The hash value returned for a positive infinity.
4191
92+ This corresponds to the:data: `sys.hash_info.inf ` constant.
93+
4294 ..versionadded ::3.13
4395
96+
4497..c :macro :: PyHASH_IMAG
4598
4699 The multiplier used for the imaginary part of a complex number.
47100
101+ This corresponds to the:data: `sys.hash_info.imag ` constant.
102+
48103 ..versionadded ::3.13
49104
105+
50106..c :type :: PyHash_FuncDef
51107
52108 Hash function definition used by:c:func: `PyHash_GetFuncDef `.
@@ -59,14 +115,20 @@ See also the :c:member:`PyTypeObject.tp_hash` member and :ref:`numeric-hash`.
59115
60116 Hash function name (UTF-8 encoded string).
61117
118+ This corresponds to the:data: `sys.hash_info.algorithm ` constant.
119+
62120 ..c :member ::const int hash_bits
63121
64122 Internal size of the hash value in bits.
65123
124+ This corresponds to the:data: `sys.hash_info.hash_bits ` constant.
125+
66126 ..c :member ::const int seed_bits
67127
68128 Size of seed input in bits.
69129
130+ This corresponds to the:data: `sys.hash_info.seed_bits ` constant.
131+
70132 ..versionadded ::3.4
71133
72134