diff options
author | Benjamin Peterson <benjamin@python.org> | 2017-12-09 19:24:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-09 19:24:18 (GMT) |
commit | 4e3e156391e70cd23cae18f2629ec323b3b1e7de (patch) | |
tree | 30304a399a9096625915bd4a01b0bd881ba1bdab /Python/pyhash.c | |
parent | 42aa93b8ff2f7879282b06efc73a31ec7785e602 (diff) | |
download | cpython-4e3e156391e70cd23cae18f2629ec323b3b1e7de.zip cpython-4e3e156391e70cd23cae18f2629ec323b3b1e7de.tar.gz cpython-4e3e156391e70cd23cae18f2629ec323b3b1e7de.tar.bz2 |
bpo-32260: don't byte swap siphash keys (#4771)
Reference siphash takes the keys as a bytes, so it makes sense to byte swap
when reifying the keys as 64-bit integers. However, Python's siphash takes host
integers in to start with.
Diffstat (limited to 'Python/pyhash.c')
-rw-r--r-- | Python/pyhash.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/Python/pyhash.c b/Python/pyhash.c index bc6786c..4494a2f 100644 --- a/Python/pyhash.c +++ b/Python/pyhash.c @@ -364,9 +364,7 @@ static PyHash_FuncDef PyHash_Func = {fnv, "fnv", 8 * SIZEOF_PY_HASH_T, static uint64_t -siphash24(uint64_t key0, uint64_t key1, const void *src, Py_ssize_t src_sz) { - uint64_t k0 = _le64toh(key0); - uint64_t k1 = _le64toh(key1); +siphash24(uint64_t k0, uint64_t k1, const void *src, Py_ssize_t src_sz) { uint64_t b = (uint64_t)src_sz << 56; const uint64_t *in = (uint64_t*)src; |