summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_hashlib.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-38270: More fixes for strict crypto policy (GH-16418)Christian Heimes2019-09-271-1/+13
| | | | | | | | | | | | | | | test_hmac and test_hashlib test built-in hashing implementations and OpenSSL-based hashing implementations. Add more checks to skip OpenSSL implementations when a strict crypto policy is active. Use EVP_DigestInit_ex() instead of EVP_DigestInit() to initialize the EVP context. The EVP_DigestInit() function clears alls flags and breaks usedforsecurity flag again. Signed-off-by: Christian Heimes <christian@python.org> https://bugs.python.org/issue38270
* bpo-38142: Updated _hashopenssl.c to be PEP 384 compliant (#16071)Christian Heimes2019-09-251-10/+0
| | | | * Updated _hashopenssl.c to be PEP 384 compliant * Remove refleak test from test_hashlib. The updated type no longer accepts random arguments to __init__.
* bpo-38153: Normalize hashlib algorithm names (GH-16083)Christian Heimes2019-09-131-0/+12
| | | | Signed-off-by: Christian Heimes <christian@python.org>
* bpo-9216: Add usedforsecurity to hashlib constructors (GH-16044)Christian Heimes2019-09-131-0/+9
| | | | | The usedforsecurity keyword only argument added to the hash constructors is useful for FIPS builds and similar restrictive environment with non-technical requirements that legacy algorithms be forbidden by their implementations without being explicitly annotated as not being used for any security related purposes. Linux distros with FIPS support benefit from this being standard rather than making up their own way(s) to do it. Contributed and Signed-off-by: Christian Heimes christian@python.org
* bpo-38132: Simplify _hashopenssl code (GH-16023)Christian Heimes2019-09-121-0/+3
| | | Signed-off-by: Christian Heimes <christian@python.org>
* bpo-34922: Fix integer overflow in the digest() and hexdigest() methods ↵Serhiy Storchaka2018-10-111-0/+13
| | | | | (GH-9751) for the SHAKE algorithm in the hashlib module.
* bpo-33729: Fix issues with arguments parsing in hashlib. (GH-8346)Serhiy Storchaka2018-07-311-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | * help(hashlib) didn't work because of incorrect module name in blake2b and blake2s classes. * Constructors blake2*(), sha3_*(), shake_*() and keccak_*() incorrectly accepted keyword argument "string" for binary data, but documented as accepting the "data" keyword argument. Now this parameter is positional-only. * Keyword-only parameters in blake2b() and blake2s() were not documented as keyword-only. * Default value for some parameters of blake2b() and blake2s() was None, which is not acceptable value. * The length argument for shake_*.digest() was wrapped out to 32 bits. * The argument for shake_128.digest() and shake_128.hexdigest() was not positional-only as intended. * TypeError messages for incorrect arguments in all constructors sha3_*(), shake_*() and keccak_*() incorrectly referred to sha3_224. Also made the following enhancements: * More accurately specified input and result types for strings, bytes and bytes-like objects. * Unified positional parameter names for update() and constructors. * Improved formatting.
* bpo-20260: Implement non-bitwise unsigned int converters for Argument ↵Serhiy Storchaka2018-07-261-2/+2
| | | | Clinic. (GH-8434)
* bpo-31787: Skip refleak check when _hashlib is not available (GH-5660)INADA Naoki2018-02-131-0/+1
|
* bpo-31787: Prevent refleaks when calling __init__() more than once (GH-3995)Oren Milman2018-02-131-0/+9
|
* closes bpo-32721: do not fail test_hashlib if _md5 isn't available (GH-5441)Benjamin Peterson2018-01-301-1/+1
|
* replace dynamic import with 'exec' with importlib.import_module (#5433)Benjamin Peterson2018-01-301-3/+4
|
* bpo-31933: fix blake2 multi-byte params on big endian platforms (#4250)Jack O'Connor2017-11-031-0/+36
| | | | | | | | | | | | All Blake2 params have to be encoded in little-endian byte order. For the two multi-byte integer params, leaf_length and node_offset, that means that assigning a native-endian integer to them appears to work on little-endian platforms, but gives the wrong result on big-endian. The current libb2 API doesn't make that very clear, and @sneves is working on new API functions in the GH issue above. In the meantime, we can work around the problem by explicitly assigning little-endian values to the parameter block. See https://github.com/BLAKE2/libb2/issues/12.
* bpo-31234: Join threads in test_hashlib (#3573)Victor Stinner2017-09-141-13/+13
| | | | | | | | | | * bpo-31234: Join threads in test_hashlib Use thread.join() to wait until the parallel hash tasks complete rather than using events. Calling thread.join() prevent "dangling thread" warnings. * test_hashlib: minor PEP 8 coding style fixes
* bpo-31370: Remove support for threads-less builds (#3385)Antoine Pitrou2017-09-071-5/+1
| | | | | | * Remove Setup.config * Always define WITH_THREAD for compatibility.
* Add test cases for internal SHA3 helpersChristian Heimes2016-09-231-0/+21
|
* Issue 26798: fetch OSError and HTTPException like other tests that use ↵Christian Heimes2016-09-081-2/+8
| | | | open_urlresource.
* Issue #16113: Add SHA-3 and SHAKE support to hashlib module.Christian Heimes2016-09-071-16/+141
|
* Download hashlib test vectors from pythontest.netChristian Heimes2016-09-061-1/+1
|
* Issue #26798: Add BLAKE2 (blake2b and blake2s) to hashlib.Christian Heimes2016-09-061-6/+195
|
* Issue #27928: Add scrypt (password-based key derivation function) to hashlib ↵Christian Heimes2016-09-061-0/+47
| | | | module (requires OpenSSL 1.1.0).
* Issue #27076: Doc, comment and tests spelling fixesMartin Panter2016-05-261-1/+1
| | | | Most fixes to Doc/ and Lib/ directories by Ville Skyttä.
* Issue #26390: Fix and test pbkdf2_hmac() parameter namesMartin Panter2016-02-221-0/+3
| | | | Based on patch by Daan Bakker.
* Issue #16113: Also remove test_case_sha3_224_hugeNed Deily2014-11-281-6/+0
|
* Issue #19886: Use better estimated memory requirements for bigmem tests.Serhiy Storchaka2014-01-101-19/+10
|\ | | | | | | Incorrect requirements can cause memory swapping.
| * Issue #19886: Use better estimated memory requirements for bigmem tests.Serhiy Storchaka2014-01-101-12/+6
| | | | | | | | Incorrect requirements can cause memory swapping.
* | * Issue #16113: Remove sha3 module again.Martin v. Löwis2014-01-031-111/+1
| | | | | | | | Patch by Christian Heimes, with modifications.
* | Issue #18742: Rework the internal hashlib construtor to pave the road for ABCs.Christian Heimes2013-10-221-12/+23
| |
* | Issue #18582: skip test of _hashlib.pbkdf2_hmac if OpenSSL is not available ↵Christian Heimes2013-10-191-11/+8
| | | | | | | | or too old
* | Issue #19254: Provide an optimized Python implementation of PBKDF2_HMACChristian Heimes2013-10-191-4/+16
| |
* | Issue #18582: Add 'pbkdf2_hmac' to the hashlib module.Christian Heimes2013-10-121-0/+82
| |
* | Change the builtin hash algorithms' names to lower case namesChristian Heimes2013-08-151-2/+2
| | | | | | | | as promised by hashlib's documentation.
* | * Fix the assertions in hashlib to use unittest assertion methods instead ofGregory P. Smith2013-08-051-7/+8
| | | | | | | | | | | | | | evil assert statements. * Add an additional assert to the new test_name_attribute test that actually confirms that a hash created using each h.name results in a new hash sharing the same name.
* | Issue 18532: Added tests and documentation to formally specify the .name ↵Jason R. Coombs2013-08-031-0/+5
| | | | | | | | attribute on hashlib objects.
* | Issue #18599: Fix name attribute of _sha1.sha1() object. It now returnsChristian Heimes2013-07-301-16/+61
|\ \ | |/ | | | | | | 'SHA1' instead of 'SHA'. Add more tests for hashlib and hash object attributes
| * Add more tests for hashlib and hash object attributesChristian Heimes2013-07-301-13/+62
| |
* | Update various test modules to use unittest.main() for test discoveryBrett Cannon2013-06-131-3/+1
| | | | | | | | instead of manually listing tests for test.support.run_unittest().
* | Issue #16113: integrade SHA-3 (Keccak) patch from ↵Christian Heimes2012-10-061-1/+126
|/ | | | http://hg.python.org/sandbox/cheimes
* Consistently raise a TypeError when a non str is passed to hashlib.newGregory P. Smith2012-07-221-0/+1
|\ | | | | | | regardless of which of the two implementations of new is used.
| * Consistently raise a TypeError when a non str is passed to hashlib.newGregory P. Smith2012-07-221-6/+3
| | | | | | | | regardless of which of the two implementations of new is used.
* | Port tests from Issue #15219, and verify we don't have a reference leak.Amaury Forgeot d'Arc2012-06-281-6/+2
| |
* | Issue #14693: Under non-Windows platforms, hashlib's fallback modules are ↵Antoine Pitrou2012-05-161-1/+3
|/ | | | always compiled, even if OpenSSL is present at build time.
* Start fixing test_bigmem:Antoine Pitrou2011-10-041-3/+3
| | | | | - bigmemtest is replaced by precisionbigmemtest - add a poor man's watchdog thread to print memory consumption
* Fixes Issue #12059: Properly handle missing hash functions even whenGregory P. Smith2011-05-141-0/+18
| | | | | | | the expected builtin modules are not present. This includes a unittest for __get_builtin_constructor() in the face of such an error.
* Make the type consistent for hashlib algorithm constants. (Reviewed by ↵Raymond Hettinger2011-01-241-1/+1
| | | | Benjamin).
* #9424: Replace deprecated assert* methods in the Python test suite.Ezio Melotti2010-11-201-2/+2
|
* Fix test_hashlib with the bigmem optionAntoine Pitrou2010-11-081-2/+2
|
* hashlib has two new constant attributes: algorithms_guaranteed andGregory P. Smith2010-09-061-2/+6
| | | | | | | | algorithms_avaiable that respectively list the names of hash algorithms guaranteed to exist in all Python implementations and the names of hash algorithms available in the current process. Renames the attribute new in 3.2a0 'algorithms' to 'algorithms_guaranteed'.
* Merged revisions 80552-80556,80564-80566,80568-80571 via svnmerge fromVictor Stinner2010-04-281-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r80552 | victor.stinner | 2010-04-27 23:46:03 +0200 (mar., 27 avril 2010) | 3 lines Issue #7449, part 1: fix test_support.py for Python compiled without thread ........ r80553 | victor.stinner | 2010-04-27 23:47:01 +0200 (mar., 27 avril 2010) | 1 line Issue #7449, part 2: regrtest.py -j option requires thread support ........ r80554 | victor.stinner | 2010-04-27 23:51:26 +0200 (mar., 27 avril 2010) | 9 lines Issue #7449 part 3, test_doctest: import trace module in test_coverage() Import trace module fail if the threading module is missing. test_coverage() is only used if test_doctest.py is used with the -c option. This commit allows to execute the test suite without thread support. Move "import trace" in test_coverage() and use test_support.import_module('trace'). ........ r80555 | victor.stinner | 2010-04-27 23:56:26 +0200 (mar., 27 avril 2010) | 6 lines Issue #7449, part 4: skip test_multiprocessing if thread support is disabled import threading after _multiprocessing to raise a more revelant error message: "No module named _multiprocessing". _multiprocessing is not compiled without thread support. ........ r80556 | victor.stinner | 2010-04-28 00:01:24 +0200 (mer., 28 avril 2010) | 8 lines Issue #7449, part 5: split Test.test_open() of ctypes/test/test_errno.py * Split Test.test_open() in 2 functions: test_open() and test_thread_open() * Skip test_open() and test_thread_open() if we are unable to find the C library * Skip test_thread_open() if thread support is disabled * Use unittest.skipUnless(os.name == "nt", ...) on test_GetLastError() ........ r80564 | victor.stinner | 2010-04-28 00:59:35 +0200 (mer., 28 avril 2010) | 4 lines Issue #7449, part 6: fix test_hashlib for missing threading module Move @test_support.reap_thread decorator from test_main() to test_threaded_hashing(). ........ r80565 | victor.stinner | 2010-04-28 01:01:29 +0200 (mer., 28 avril 2010) | 6 lines Issue #7449, part 7: simplify threading detection in test_capi * Skip TestPendingCalls if threading module is missing * Test if threading module is present or not, instead of test the presence of _testcapi._test_thread_state ........ r80566 | victor.stinner | 2010-04-28 01:03:16 +0200 (mer., 28 avril 2010) | 4 lines Issue #7449, part 8: don't skip the whole test_asynchat if threading is missing TestFifo can be executed without the threading module ........ r80568 | victor.stinner | 2010-04-28 01:14:58 +0200 (mer., 28 avril 2010) | 6 lines Issue #7449, part 9: fix test_xmlrpclib for missing threading module * Skip testcases using threads if threading module is missing * Use "http://" instead of URL in ServerProxyTestCase if threading is missing because URL is not set in this case ........ r80569 | victor.stinner | 2010-04-28 01:33:58 +0200 (mer., 28 avril 2010) | 6 lines Partial revert of r80556 (Issue #7449, part 5, fix ctypes test) Rewrite r80556: the thread test have to be executed just after the test on libc_open() and so the test cannot be splitted in two functions (without duplicating code, and I don't want to duplicate code). ........ r80570 | victor.stinner | 2010-04-28 01:51:16 +0200 (mer., 28 avril 2010) | 8 lines Issue #7449, part 10: test_cmd imports trace module using test_support.import_module() Use test_support.import_module() instead of import to raise a SkipTest exception if the import fail. Import trace fails if the threading module is missing. See also part 3: test_doctest: import trace module in test_coverage(). ........ r80571 | victor.stinner | 2010-04-28 01:55:59 +0200 (mer., 28 avril 2010) | 6 lines Issue #7449, last part (11): fix many tests if thread support is disabled * Use try/except ImportError or test_support.import_module() to import thread and threading modules * Add @unittest.skipUnless(threading, ...) to testcases using threads ........
* Merged revisions 78093 via svnmerge fromGeorg Brandl2010-03-141-1/+0
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r78093 | georg.brandl | 2010-02-07 18:03:15 +0100 (So, 07 Feb 2010) | 1 line Remove unused imports in test modules. ........