summaryrefslogtreecommitdiffstats
path: root/Python/pyhash.c
diff options
context:
space:
mode:
authorBatuhan Taşkaya <batuhanosmantaskaya@gmail.com>2020-04-04 21:25:12 (GMT)
committerGitHub <noreply@github.com>2020-04-04 21:25:12 (GMT)
commit1b21573a89632356737a24302dd64c9eb1457a7b (patch)
tree5729805ecbe9007a3e0d4ada7d17a914cfa01067 /Python/pyhash.c
parentb709302f3125622986bd458dfb2954fda5e8366d (diff)
downloadcpython-1b21573a89632356737a24302dd64c9eb1457a7b.zip
cpython-1b21573a89632356737a24302dd64c9eb1457a7b.tar.gz
cpython-1b21573a89632356737a24302dd64c9eb1457a7b.tar.bz2
closes bpo-40184: Only define pysiphash if the hash algorithm is SIPHASH24. (GH-19369)
Diffstat (limited to 'Python/pyhash.c')
-rw-r--r--Python/pyhash.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/Python/pyhash.c b/Python/pyhash.c
index faac730..a6f42e7 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