Notice: While JavaScript is not essential for this website, your interaction with the content will be limited. Please turn JavaScript on for the full experience.
...hashing modules should present the same interface. Additional methods or variables can be added, but those described in this document should always be present. Hash function modules define one function: new([string]) (unkeyed hashes) new([key] , [string]) (keyed hashes) Create a new hashing object and return it. The first form is for hashes that are unkeyed, such as MD5 or SHA. For keyed hashes such as HMAC, key is a required parameter containing a string giving the key to us...
...hash the secret key if it is longer than digest_size. If no HMAC algorithm is standardized for the hash algorithm, return NotImplemented instead. name A text string value; the canonical, lowercase name of the hashing algorithm. The name should be a suitable parameter for hashlib.new. Hashing objects require the following methods: copy() Return a separate copy of this hashing object. An update to this copy won't affect the original object. digest() Return the hash value of this hashing object ...
...hash-algorithm=fnv. The value Py_HASH_EXTERNAL allows 3rd parties to provide their own implementation at compile time. Implementation: #if Py_HASH_ALGORITHM == Py_HASH_EXTERNAL extern PyHash_FuncDef PyHash_Func; #elif Py_HASH_ALGORITHM == Py_HASH_SIPHASH24 static PyHash_FuncDef PyHash_Func = {siphash24, "siphash24", 64, 128}; #elif Py_HASH_ALGORITHM == Py_HASH_FNV static PyHash_FuncDef PyHash_Func = {fnv, "fnv", 8 * sizeof(Py_hash_t), 16 * sizeof(Py_hash_t)}...
...hash-based pyc. We call the second lowest bit the check_source flag. Following the bit field is a 64-bit hash of the source file. We will use a SipHash with a hardcoded key of the contents of the source file. Another fast hash like MD5 or BLAKE2 would also work. We choose SipHash because Python already has a builtin implementation of it from PEP 456, although an interface that allows picking the SipHash key must be exposed to Python. Security of the hash is not a concern, though we pass over com...
...hashes. Unlike PEP 376, every file except RECORD, which cannot contain a hash of itself, must include its hash. The hash algorithm must be sha256 or better; specifically, md5 and sha1 are not permitted, as signed wheel files rely on the strong hashes in RECORD to validate the integrity of the archive. PEP 376's INSTALLER and REQUESTED are not included in the archive. RECORD.jws is used for digital signatures. It is not mentioned in RECORD. RECORD.p7s is allowed as a courtesy to anyone who wou...
...Hashing frozenmap instances can be hashable just like tuple objects: hash(frozenmap(foo='bar')) # works hash(frozenmap(foo=[])) # will throw an error Typing It is possible to use the standard typing notation for frozenmaps: m: frozenmap[str, int] = frozenmap() Implementation The proposed frozenmap immutable type uses a Hash Array Mapped Trie (HAMT) data structure. Functional programming languages, like Clojure, use HAMT to efficiently implement immutable hash tab...
...Hashing frozenmap instances can be hashable just like tuple objects: hash(frozenmap(foo='bar')) # works hash(frozenmap(foo=[])) # will throw an error Typing It is possible to use the standard typing notation for frozenmaps: m: frozenmap[str, int] = frozenmap() Implementation The proposed frozenmap immutable type uses a Hash Array Mapped Trie (HAMT) data structure. Functional programming languages, like Clojure, use HAMT to efficiently implement immutable hash tables, vectors, and s...
...hash(d) Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: dict objects are unhashable >>> hash(freeze(d)) -1210776116 >>> {d: 4} Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: dict objects are unhashable >>> {freeze(d): 4} {{'a': 7, 'c': 9, 'b': 8}: 4} Reference implementation Patch 1335812 provides the C implementation of this feature. It adds the freeze() built-in, along with implementations of ...
...hashable if all keys and values are hashable frozendict hash does not depend on the items creation order Implementation Add a PyFrozenDictObject structure based on PyDictObject with an extra "Py_hash_t hash;" field frozendict.__hash__() is implemented using hash(frozenset(self.items())) and caches the result in its private hash attribute Register frozendict as a collections.abc.Mapping frozendict can be used with PyDict_GetItem(), but PyDict_SetItem() and PyDict_DelItem() raise a TypeError ...
...hashes as specified above. Thus, to mark a target file as part of a consistent snapshot it MUST, when written to disk, include its hash in its filename: HASH.FILENAME where HASH is the hex digest of the hash of the file contents and FILENAME is the original filename. This means that there MAY be multiple copies of every target file, one for each of the cryptographic hash functions specified above. Assuming infinite disk space, strictly incrementing version numbers, and no hash collisions, a ...
...hashes as specified above. Thus, to mark a target file as part of a consistent snapshot it MUST, when written to disk, include its hash in its filename: HASH.FILENAME where HASH is the hex digest [59] of the hash of the file contents and FILENAME is the original filename. This means that there MAY be multiple copies of every target file, one for each of the cryptographic hash functions specified above. Assuming infinite disk space, strictly incrementing version numbers, and no h...
...hash key (type string) SHOULD be present, with value <hash-algorithm>=<expected-hash>. It is RECOMMENDED that only hashes which are unconditionally provided by the latest version of the standard library's hashlib module be used for source archive hashes. At time of writing, that list consists of 'md5', 'sha1', 'sha224', 'sha256', 'sha384', and 'sha512'. When url refers to a local directory, the dir_info key MUST be present as a dictionary with the following key: editable (type: boo...
...hash mapping names of C source files (each containing a Python extension module) to a nested hash of information about how to build that module. The allowed keys to this nested hash are: - other_c: other C files that must be compiled and linked with the main C file to create the module - c_libraries: C libraries that must be included in the link ... """ No doubt the ext_modules nested hashes would have more options, a...
...hashing or sorted cannot be used. On comp.lang.python there are many, many, posts [1] asking about the best way to do this task. It's a little tricky to implement optimally and it would be nice to save people the trouble of figuring it out themselves. Considerations Tim Peters suggests trying to use a hash table, then trying to sort, and finally falling back on brute force [2]. Should uniq maintain list order at the expense of speed? Is it spelled 'uniq' or 'unique'? Reference Implementati...
...hash collision denial of service), issue 14234 (CVE-2012-0876, hash table collisions CPU usage DoS in the expat library), issue 14001 (CVE-2012-0845, SimpleXMLRPCServer denial of service), and issue 13885 (CVE-2011-3389, disabling of the CBC IV attack countermeasure in the _ssl module). Python 3.1.5 was released on April 9, 2012. The last binary release of Python 3.1 was 3.1.4. With the 3.1.5 release, and five years after its first release, the Python 3.1 series is now officially retired. All...
Version: None
Released: April 9, 2012
Python 3.1.5 Python 3.1.5 is a security-fix source-only release for Python 3.1.4, fixing several reported security issues: issue 13703 (oCERT-2011-003, hash collision denial of service), issue 14234 (CVE-2012-0876, hash table collisions CPU usage DoS in the expat library), issue 14001 (CVE-2012-0845, SimpleXMLRPCServer denial of service), and issue 13885 (CVE-2011-3389, …
View Release Notes
...hashes] This table is required. A table with keys specifying a hash algorithm and values as the hash for the file represented by this entry in the package._name_._version_ table. Lockers SHOULD list hashes in lexicographic order. This is to help minimize diff sizes and the potential to overlook hash value changes. An installer MUST only install a file which matches one of the specified hashes. package._name_._version_.url A string representing a URL where to get the file. The installer MAY sup...
...hashing of the names, set all names to None that start with exactly one underscore. C2. In an order determined by the dictionary hashing of the names, set all names to None except __builtins__. [This used to be "all names that do not start with two or more underscores".] [Deleted step: In an order determined by the dictionary hashing of the names, delete all remaining names from the module's dictionary (this is done by a call to __dict__.clear()).] C3. The module itsel...