diff Include/object.h @ 75066:f4b7ecf8a5f8 3.1

Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime) in order to make algorithmic complexity attacks on (e.g.) web apps much more complicated. The environment variable PYTHONHASHSEED and the new command line flag -R control this behavior.
author Georg Brandl <georg@python.org>
date Mon, 20 Feb 2012 19:54:16 +0100
parents 4c978cd3640f
children 160a56eac332 4a31f6b11e7a
line wrap: on
line diff
--- a/Include/object.h	Sat Feb 18 14:42:57 2012 +0100
+++ b/Include/object.h	Mon Feb 20 19:54:16 2012 +0100
@@ -473,6 +473,12 @@
 PyAPI_FUNC(long) _Py_HashDouble(double);
 PyAPI_FUNC(long) _Py_HashPointer(void*);
 
+typedef struct {
+    long prefix;
+    long suffix;
+} _Py_HashSecret_t;
+PyAPI_DATA(_Py_HashSecret_t) _Py_HashSecret;
+
 /* Helper for passing objects to printf and the like */
 #define PyObject_REPR(obj) _PyUnicode_AsString(PyObject_Repr(obj))