summaryrefslogtreecommitdiffstats
path: root/Python/pyhash.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-40602: Add _Py_HashPointerRaw() function (GH-20056)Victor Stinner2020-05-121-4/+10
| | | | | Add a new _Py_HashPointerRaw() function which avoids replacing -1 with -2 to micro-optimize hash table using pointer keys: using _Py_hashtable_hash_ptr() hash function.
* closes bpo-40184: Only define pysiphash if the hash algorithm is SIPHASH24. ↵Batuhan Taşkaya2020-04-041-7/+7
| | | | (GH-19369)
* closes bpo-39605: Fix some casts to not cast away const. (GH-18453)Andy Lester2020-02-121-1/+1
| | | | | | | | | | | | | | | gcc -Wcast-qual turns up a number of instances of casting away constness of pointers. Some of these can be safely modified, by either: Adding the const to the type cast, as in: - return _PyUnicode_FromUCS1((unsigned char*)s, size); + return _PyUnicode_FromUCS1((const unsigned char*)s, size); or, Removing the cast entirely, because it's not necessary (but probably was at one time), as in: - PyDTrace_FUNCTION_ENTRY((char *)filename, (char *)funcname, lineno); + PyDTrace_FUNCTION_ENTRY(filename, funcname, lineno); These changes will not change code, but they will make it much easier to check for errors in consts
* bpo-39127: Make _Py_HashPointer's argument be const (GH-17690)Andy Lester2020-02-051-1/+1
|
* bpo-31849: Fix warning in pyhash.c (GH-6799)A. Jesse Jiryu Davis2018-06-041-2/+2
|
* bpo-28055: Fix unaligned accesses in siphash24(). (GH-6123)Rolf Eike Beer2018-05-131-13/+13
| | | | | | | The hash implementation casts the input pointer to uint64_t* and directly reads from this, which may cause unaligned accesses. Use memcpy() instead so this code will not crash with SIGBUS on sparc. https://bugs.gentoo.org/show_bug.cgi?id=636400
* Fix some warnings produced by different compilers. (#5593)Serhiy Storchaka2018-02-091-1/+1
|
* closes bpo-32460: ensure all non-static globals have initializers (#5061)Benjamin Peterson2017-12-311-1/+1
|
* byte swap the raw hash secrets (more bpo-32260) (#4773)Benjamin Peterson2017-12-091-1/+1
|
* bpo-32260: don't byte swap siphash keys (#4771)Benjamin Peterson2017-12-091-3/+1
| | | | | 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.
* closes bpo-31650: PEP 552 (Deterministic pycs) implementation (#4575)Benjamin Peterson2017-12-091-8/+21
| | | | | | | | | | | | | | | | | | | | | | | | | Python now supports checking bytecode cache up-to-dateness with a hash of the source contents rather than volatile source metadata. See the PEP for details. While a fairly straightforward idea, quite a lot of code had to be modified due to the pervasiveness of pyc implementation details in the codebase. Changes in this commit include: - The core changes to importlib to understand how to read, validate, and regenerate hash-based pycs. - Support for generating hash-based pycs in py_compile and compileall. - Modifications to our siphash implementation to support passing a custom key. We then expose it to importlib through _imp. - Updates to all places in the interpreter, standard library, and tests that manually generate or parse pyc files to grok the new format. - Support in the interpreter command line code for long options like --check-hash-based-pycs. - Tests and documentation for all of the above.
* Add the const qualifier to "char *" variables that refer to literal strings. ↵Serhiy Storchaka2017-11-111-1/+1
| | | | (#4370)
* bpo-31338 (#3374)Barry Warsaw2017-09-151-1/+1
| | | | | | | * Add Py_UNREACHABLE() as an alias to abort(). * Use Py_UNREACHABLE() instead of assert(0) * Convert more unreachable code to use Py_UNREACHABLE() * Document Py_UNREACHABLE() and a few other macros.
* bpo-30923: Silence fall-through warnings included in -Wextra since gcc-7.0. ↵Stefan Krah2017-08-211-6/+6
| | | | (#3157)
* Issue #28126: Replace Py_MEMCPY with memcpy(). Visual Studio can properly ↵Christian Heimes2016-09-131-1/+1
| | | | optimize memcpy().
* replace Python aliases for standard integer types with the standard integer ↵Benjamin Peterson2016-09-061-28/+25
| | | | types (#17884)
* Issue #20162: Fix an alignment issue in the siphash24() hash function whichVictor Stinner2014-02-011-1/+1
| | | | caused a crash on PowerPC 64-bit (ppc64).
* Issue #19183: too many tests depend on the sort order of repr().Christian Heimes2013-11-201-3/+0
| | | | The bitshift and xor op for 32bit builds has changed the order of hash values.
* ssue #19183: Implement PEP 456 'secure and interchangeable hash algorithm'.Christian Heimes2013-11-201-0/+430
Python now uses SipHash24 on all major platforms.