closes bpo-40184: Only define pysiphash if the hash algorithm is SIPHASH24. (GH-19369)

This commit is contained in:
Batuhan Taşkaya 2020-04-05 00:25:12 +03:00 committed by GitHub
parent b709302f31
commit 1b21573a89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions

View File

@ -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