diff options
author | Benjamin Peterson <benjamin@python.org> | 2020-04-04 21:46:54 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-04 21:46:54 (GMT) |
commit | 411555075401aa831a2228196c2d8f9a54b6f577 (patch) | |
tree | 7e000c992c296aff47a40b34d0df354cbb7580ea /Python | |
parent | 0d1d7c8bae3f9fe9e937d2931dcbbd3555d1a9f1 (diff) | |
download | cpython-411555075401aa831a2228196c2d8f9a54b6f577.zip cpython-411555075401aa831a2228196c2d8f9a54b6f577.tar.gz cpython-411555075401aa831a2228196c2d8f9a54b6f577.tar.bz2 |
[3.8] closes bpo-40184: Only define pysiphash if the hash algorithm is SIPHASH24. (GH-19373)
(cherry picked from commit 1b21573)
Co-authored-by: Batuhan Taşkaya <batuhanosmantaskaya@gmail.com>
Diffstat (limited to 'Python')
-rw-r--r-- | Python/pyhash.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Python/pyhash.c b/Python/pyhash.c index ba224ee..c0355ae 100644 --- a/Python/pyhash.c +++ b/Python/pyhash.c @@ -412,13 +412,6 @@ siphash24(uint64_t k0, uint64_t k1, const void *src, Py_ssize_t src_sz) { return t; } -static Py_hash_t -pysiphash(const void *src, Py_ssize_t src_sz) { - return (Py_hash_t)siphash24( - _le64toh(_Py_HashSecret.siphash.k0), _le64toh(_Py_HashSecret.siphash.k1), - src, src_sz); -} - uint64_t _Py_KeyedHash(uint64_t key, const void *src, Py_ssize_t src_sz) { @@ -427,6 +420,13 @@ _Py_KeyedHash(uint64_t key, const void *src, Py_ssize_t src_sz) #if Py_HASH_ALGORITHM == Py_HASH_SIPHASH24 +static Py_hash_t +pysiphash(const void *src, Py_ssize_t src_sz) { + return (Py_hash_t)siphash24( + _le64toh(_Py_HashSecret.siphash.k0), _le64toh(_Py_HashSecret.siphash.k1), + src, src_sz); +} + static PyHash_FuncDef PyHash_Func = {pysiphash, "siphash24", 64, 128}; #endif |