Commit Graph

35 Commits

Author SHA1 Message Date
manu
d50ab05b2b
Raise ValueError if password is longer than 72 bytes (#1000)
* move existing tests for long pws into a separate test to assert ValueError is raised

* add more tests for edge cases around the 72 byte length

* raise ValuError if the password passed to hashpw() is longer than 72 bytes

* improve error message

* update test_2a_wraparound_bug

* remove obsolete re-assignment of `password`

* remove obsolete tests

the "raise on passwords longer than 72 chars" behavior is already covered in `test_hashpw_raises_correctly_for_long_passwords`,
and the `test_2a_wraparound_bug` is not relevant anymore (this previously ensured truncation, which we do not do anymore)
2025-07-03 21:07:06 -07:00
Nathan Goldbaum
df983f9c98
Support free-threaded Python 3.13 (#925)
* Support free-threaded Python 3.13

* fix issues with tox.ini

* add multithreading test

* fix pep8

* fix ruff format

* name linux CI run based on python VERSION

* clarify use of pytest-run-parallel marks

* refactor test_multithreading

* simplify test_multithreading

* remove pytest-run-parallel use
2025-01-15 11:54:19 -05:00
Alex Gaynor
c6c03f77ae
fixes #917 -- correctly handle a salt that's too short (#918) 2024-11-21 06:24:57 -08:00
Alex Gaynor
7939bef883
Everything is Rust (#670) 2023-11-23 20:06:59 -06:00
Alex Gaynor
db93a85d46
Switch to ruff (#672) 2023-11-23 19:48:17 -06:00
Alex Gaynor
fb89f7c975
Migrate all the remaining logic to Rust (#669) 2023-11-23 13:44:52 -06:00
Alex Gaynor
e1ed0f46ca
fixes #416 -- correctly handle invalid salts (#417) 2022-09-16 09:22:40 -05:00
Shivaram Lingamneni
2b2e989f3e
allow null bytes in inputs (#328) 2022-07-23 17:09:33 -04:00
Alex Gaynor
2d20a7e24b
Switch to a Rust implementation of cryptographic primitives (#294) 2022-05-01 10:59:05 -06:00
Alex Gaynor
71d92347b0
Update our python versions to be consistent (#241) 2020-12-19 11:21:01 -06:00
Eugene
0b88cb2273
Drop six dependency (#225)
* Drop six dependency

* Resolve formatting error
2020-08-17 07:44:23 -04:00
Alex Gaynor
09c5fd1a20
Paint it Black by the Rolling Stones (#208) 2020-07-23 19:38:00 -05:00
Alex Gaynor
ea76ee82eb Don't emit warnings here, there's no point (#137)
* Don't emit warnings here, there's no point

* whoops here
2017-12-04 10:43:38 +08:00
Luc Gommans
4b8c73ac78 Warn upon too few bcrypt.kdf() rounds (#104)
* Warn upon too few bcrypt.kdf() rounds

* Use warings library instead of sys.stderr

* Add test for changes

* Test new kdf parameter for coverage

* Formatting & py26 compatibility
2017-01-21 21:53:09 +08:00
Alex Gaynor
fcebaa0db7 Correctly handle invalid hashed passwords in bcrypt.checkpw. (#95)
Previously it would silently accept extra data, and overread a buffer on truncated data.

Reported by Matthew Russell
2016-10-02 20:20:13 -05:00
Donald Stufft
c95966955b Inputing a 2y salt should output a 2y hash (#84) 2016-06-30 12:05:04 -05:00
Paul Kehrer
10888813fc Restore compatibility with 2.0.0's fix for wraparound bug (#81) 2016-06-30 01:15:42 -04:00
Paul Kehrer
c9a9ec1e7a Add checkpw (#76) 2016-06-29 10:27:21 -04:00
Paul Kehrer
4e652562c6 Refactor tests to stop duplicating vectors (#78) 2016-06-28 20:05:06 -04:00
Paul Kehrer
e565dad5de Add bcrypt pbkdf support (#70)
* add bcrypt_pbkdf support

* bytes!

* some docs
2016-06-27 15:07:53 -05:00
Paul Kehrer
394882d070 Convert bcrypt to use OpenBSD code (#68)
* swap to using openbsd bcrypt

* we should probably call this 3.0

* update tests to handle slight change in behavior, test better

* strip out code we're not using

* define this for linux

* py3 fix

* add a changelog to the readme

* maybe work with windows

* portable endian header, replace swaps, other windows fixes

* handle older windows compilers properly, handle glibc < 2.9, retab

* remove a todo, that's definitely the limit

* make these definitions conditional since some BSDs may already have them

* add $2a$ tests from crypt_blowfish-1.3

* update readme to note supported prefixes

* almost pointless commit

* add support for $2y$

test vectors from openwall crypt-blowfish1.3
2016-06-27 11:53:42 -05:00
jazzyb
1787cafb83 Add tests for gensalt(prefix) functionality 2015-06-12 16:57:14 -04:00
jazzyb
5b7f6df714 Add prefix option to gensalt() - default to "2b" 2015-06-12 16:55:05 -04:00
Donald Stufft
51ebadb34d Migrate to using CFFI 1.0
* Move everything under src/ to ensure we test against the installed
  library.
* Create a build_bcrypt.py script which will build _bcrypt.so.
* Refactor to utilize the new _bcrypt.so instead of implicit compile.
2015-06-11 09:23:01 -04:00
Alex Gaynor
ba5e135a02 flake8 2015-03-13 21:32:19 -04:00
Alex Gaynor
ea678c1dd1 Error out on NUL bytes. 2015-03-13 21:28:16 -04:00
Donald Stufft
c87a1f0d07 Merge pull request #31 from alex/no-more-mock
Removed usage of mock which wasn't really doing anything
2014-12-06 16:19:29 -05:00
Alex Gaynor
ec8b0f7da9 Simplify, very slightly, how the parameterize decorator is used 2014-12-06 11:20:16 -08:00
Alex Gaynor
2801b7b816 Removed usage of mock which wasn't really doing anything 2014-12-06 10:33:12 -08:00
Donald Stufft
595b2f5014 Disable the ability to implicitly compile the CFFI module 2014-12-05 23:14:42 -05:00
Donald Stufft
7532ee4eb3 Enable flake8 style checks 2014-12-05 20:54:56 -05:00
Donald Stufft
410f0c998c Switch to using six 2014-12-05 20:25:15 -05:00
Donald Stufft
3cb40dbea4 Fix tests for unicode characters on Python 3.2 2013-05-11 00:26:47 -04:00
Donald Stufft
6c74d9236d Give a better error message when passing a text type to hashpw 2013-05-11 00:20:52 -04:00
Donald Stufft
a6f9d17a59 Add tests to ensure behavior 2013-05-10 23:44:58 -04:00