summaryrefslogtreecommitdiff
path: root/passlib/crypto
Commit message (Collapse)AuthorAgeFilesLines
* Merge from stableEli Collins2020-10-081-1/+6
|\ | | | | | | | | | | | | As part of merge: * various: reverted the py26 compat fixes from rev 5e2f92012412 * test utils: stripped out "has_real_subtest" compat from rev c732a9e2a582, since now on py35+, which always has .subTest() method
| * bugfix: python2.6 compat fixes -- a few "{}" set constructors slipped in.Eli Collins2020-10-071-3/+8
| |
| * passlib.context: now raises UnknownHashError() if hash can't be identified.Eli Collins2020-10-071-1/+1
| | | | | | | | this inherits from ValueError, and has same text, so backwards compatible.
* | cleanup old python compat - assorted minor cleanups & fixes from conversionEli Collins2020-10-061-2/+7
| |
* | cleanup old python compat -- removed int_types aliasEli Collins2020-10-062-10/+9
| |
* | cleanup old python compat -- removed join_byte_elems() and ↵Eli Collins2020-10-062-8/+6
| | | | | | | | join_byte_values() wrappers
* | cleanup old python compat -- removed byte_elem_value() wrapperEli Collins2020-10-061-1/+1
| |
* | cleanup old python compat -- replaced "unicode" alias in favor of "str"Eli Collins2020-10-063-8/+7
| |
* | cleanup old python compat -- unified "unicode_or_bytes" aliasesEli Collins2020-10-061-2/+2
| |
* | cleanup old python compat -- removed "unicode_or_str" and ↵Eli Collins2020-10-061-2/+2
| | | | | | | | "native_string_types" aliases
* | cleanup old python compat -- removed IO aliases (BytesIO etc)Eli Collins2020-10-061-1/+1
| |
* | cleanup old python compat -- removed suppress_cause() and error_from() wrappersEli Collins2020-10-061-1/+1
| |
* | cleanup old python compat -- removed izip() wrapperEli Collins2020-10-061-7/+6
| |
* | cleanup old python compat -- removed irange() aliasEli Collins2020-10-064-23/+21
| |
* | cleanup old python compat -- removed PY2 & PY3 conditionalsEli Collins2020-10-062-8/+4
| |
* | cleanup old python compat -- removed all "from __future__" importsEli Collins2020-10-062-2/+0
| |
* | Merge from stableEli Collins2020-10-061-30/+191
|\ \ | |/
| * passlib.crypto.digest: followup to rev db4beabafe1b --Eli Collins2020-05-041-6/+16
| | | | | | | | | | added HashInfo().unknown helper attr to reduce spam in norm_hash_name(), made some internal vars less ambiguous
| * passlib.crypto.digests: added hardcoded fallback info for common hashes;Eli Collins2020-05-021-0/+35
| | | | | | | | so stats can be gathered retreived even if hash isn't available (e.g. FIPS mode)
| * reworked lookup_hash() and create_hex_digest() internals to work betterEli Collins2020-05-021-26/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | on FIPS systems (issue 116). * lookup_hash(): - moved all hash consturctor error checks / handling into HashInfo object, which simplifies lookup_hash() internals - [minor] added "required" kwd, inverse of the now-deprecated "return_unknown" kwd - [minor] now caches unknown/unsupported HashInfo records. * HashInfo: - now catches ValueErrors thrown by hash constructor, and special-cased detection of "disabled for fips" errors. - stub instances now have constructor that throws UnknownHashError, instead of being None. calling code should detect stub instances via the new "not info.supported" instead of testing for "info.const is None". * create_hex_digest() now defaults to creating handlers w/ mock hash func when it's not present (e.g. due to FIPS). this should let them be imported; and defer the errors until they're actually used. * added _set_mock_fips_mode() and some helps to make lookup_hash() fake a FIPS mode system (per traceback provided in issue comments). used this to make some preliminary UTs for the digest & hasher changes above.
| * passlib.crypto.digests: cleaned up internal digests table;Eli Collins2020-05-021-4/+12
| | | | | | | | | | removing some aliases that weren't needed anymore, and adding some new ones.
* | Merge from stableEli Collins2019-11-111-2/+73
|\ \ | |/
| * passlib.crypto.scrypt: add support for hashlib.scrypt() backend (fixes issue 86)Eli Collins2019-11-111-2/+73
| |
* | compat cleanup: replaced all u("") instances with u""Eli Collins2017-02-171-4/+4
|/ | | | | | | realized can do this now that we're requiring python3 >= 3.3. had to keep u() helper around for u(r"") instances, since py3 doesn't have ur"". but switched it to use ascii decoding for py2, to make sure things are clean.
* passlib.crypto.scrypt: reworked backend loader internalsEli Collins2017-01-231-38/+52
| | | | | | | | | | * reworked backends so they're more pluggable. * added _has_backend() helper for UTs to use, instead of _load_backend() hack, which wasn't respecting dryrun flag. this is mainly in preparation for issue 86: adding backend to support stdlib's hashlib.scrypt().
* added r"" prefix to some strings, to fix some python 3.6 deprecation warningsEli Collins2017-01-221-1/+1
| | | | about invalid escape sequences (e.g. "\s")
* passlib.utils: relocated a bunch of binary encoding helpers to .utils.binary ↵Eli Collins2016-11-221-1/+2
| | | | submodule
* passlib.utils: relocated a bunch of properties & decorators to .utils.decorEli Collins2016-11-221-1/+2
|
* docs: LARGE update to documentation, tutorials added, pages relocatedEli Collins2016-11-201-6/+10
| | | | | | | | | | | | | | | | * moved a bunch of pages into 'docs/narr' narrative subsection. added placeholder pages in old locations, to minimize inbound link breakage. * split history into separate pages, was getting way too long. removed toplevel CHANGES file, not feasible under new structure. * passlib.ifc split into reference & tutorial portions, tutorial allowed subsuming a bunch of other hash-usage examples. * added standard fragments for warning about insecure hashes, added them to top of a LOT of hash doc pages. * updated references, various layout tweaks
* docs: corrected / updated various bits of text, especially TOTP docsEli Collins2016-07-151-9/+10
|
* crypto.scrypt: change require keylen>=1, to match pbkdf2_hmac()Eli Collins2016-06-201-2/+2
|
* pbkdf2: removed support for M2Crypto backend -- was only useful for sha1Eli Collins2016-06-201-15/+2
| | | | | (a border case anyways), and hashlib or fastpbkdf2 are much better choices for this use case.
* pbkdf2_hmac: now supports hashlib.pbkdf2_hmac() and fastpbkdf2 as backends.Eli Collins2016-06-201-24/+113
| | | | | | | * digest code now checks for fastpbkdf2 & hashlib backends * tests: added some more test vectors from fastpbkdf2 * to match hashlib, now throwing OverflowError on large keylens, not ValueError. * to match hashlib, now throwing ValueError on keylen=0, previously returned b""
* cleanup: 'uint4/8' refs incorrectly named, should be 'uint32/64'Eli Collins2016-06-201-7/+7
|
* crypto/pbkdf2: refactored to use 3 different builtin backends, added ↵Eli Collins2016-06-181-21/+184
| | | | | | benchmark tests. this includes some temp code, committing to test on various systems.
* utils.handlers: split out most of HasManyBackends into separate BackendMixin,Eli Collins2016-06-171-10/+13
| | | | | | | | | | which provides a more generic & flexible framework than HasManyBackends. * has_backend() now a wrapper for set_backend(), which now accepts a dryrun flag. * loaders can now return arbitrary objects, classes can control how they operate. * loaders can now be dryrun aware. * bcrypt hasher, scrypt hasher, and scrypt module updated to use new api * fuzz tester now correctly restored backend after use
* passlib.handlers.scrypt: created scrypt hash handler, complete with UTs and docsEli Collins2016-06-104-0/+761
| | | | | | | | | | | | | | | | | | | | | | | | | | | * scrypt kdf code - relocated scrypt kdf code to passlib.crypto.scrypt - py3 compat fixes - split UTs out into separate file - removed "non-power of 2" support, not needed. - added wrapper which can toggle between builtin backend, and extenrnal scrypt package. - factored out n/r/p validation code so it can be used independantly of calling kdf itself. * passlib.handlers.scrypt: added scrypt handler which wraps the kdf. - added some custom test strings, as well as adapted some reference values from the scrypt whitepaper. - added documentation page - integrated scrypt kdf wrapper w/ hash's HasManyBackends api
* passlib.crypto: relocated bcrypt backend code from passlib.utilsEli Collins2016-06-104-0/+1584
|
* relocated many of the crypto routes inside passlib.utils,Eli Collins2016-02-104-0/+1739
and moved them to a separate passlib.crypto subpackage. along with this move, made a few api cleanups: * unified all code that's looking up hashes to use new passlib.crypto.lookup_hash() wrapper, which takes care of hash name normalization, loading fallback implementations, and alg metadata inspection, all hidden behind a memoized function. * deprecated pbkdf2() in favor of pbkdf2_hmac() -- only real use, and new signature matches stdlib function. additionally, this version is a bit faster, due to some assumptions that can be made due to the PRF always being HMAC based. * added compile_hmac() helper which does an even more efficient job of pre-compiling a keyed HMAC function; this helped speed up pbkdf2 a bit more.