bcrypt 4.3.0__tar.gz → 5.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: bcrypt
3
- Version: 4.3.0
3
+ Version: 5.0.0
4
4
  Summary: Modern password hashing for your software and your servers
5
5
  Author-email: The Python Cryptographic Authority developers <cryptography-dev@python.org>
6
6
  License: Apache-2.0
@@ -17,6 +17,8 @@ Classifier: Programming Language :: Python :: 3.10
17
17
  Classifier: Programming Language :: Python :: 3.11
18
18
  Classifier: Programming Language :: Python :: 3.12
19
19
  Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Programming Language :: Python :: Free Threading :: 3 - Stable
20
22
  Requires-Python: >=3.8
21
23
  Description-Content-Type: text/x-rst
22
24
  License-File: LICENSE
@@ -24,6 +26,7 @@ Provides-Extra: tests
24
26
  Requires-Dist: pytest!=3.3.0,>=3.2.1; extra == "tests"
25
27
  Provides-Extra: typecheck
26
28
  Requires-Dist: mypy; extra == "typecheck"
29
+ Dynamic: license-file
27
30
 
28
31
  bcrypt
29
32
  ======
@@ -78,8 +81,18 @@ While bcrypt remains an acceptable choice for password storage, depending on you
78
81
  Changelog
79
82
  =========
80
83
 
81
- Unreleased
82
- ----------
84
+ 5.0.0
85
+ -----
86
+
87
+ * Bumped MSRV to 1.74.
88
+ * Added support for Python 3.14 and free-threaded Python 3.14.
89
+ * Added support for Windows on ARM.
90
+ * Passing ``hashpw`` a password longer than 72 bytes now raises a
91
+ ``ValueError``. Previously the password was silently truncated, following the
92
+ behavior of the original OpenBSD ``bcrypt`` implementation.
93
+
94
+ 4.3.0
95
+ -----
83
96
 
84
97
  * Dropped support for Python 3.7.
85
98
  * We now support free-threaded Python 3.13.
@@ -51,8 +51,18 @@ While bcrypt remains an acceptable choice for password storage, depending on you
51
51
  Changelog
52
52
  =========
53
53
 
54
- Unreleased
55
- ----------
54
+ 5.0.0
55
+ -----
56
+
57
+ * Bumped MSRV to 1.74.
58
+ * Added support for Python 3.14 and free-threaded Python 3.14.
59
+ * Added support for Windows on ARM.
60
+ * Passing ``hashpw`` a password longer than 72 bytes now raises a
61
+ ``ValueError``. Previously the password was silently truncated, following the
62
+ behavior of the original OpenBSD ``bcrypt`` implementation.
63
+
64
+ 4.3.0
65
+ -----
56
66
 
57
67
  * Dropped support for Python 3.7.
58
68
  * We now support free-threaded Python 3.13.
@@ -11,7 +11,7 @@ build-backend = "setuptools.build_meta"
11
11
  [project]
12
12
  name = "bcrypt"
13
13
  # When updating this, also update lib.rs
14
- version = "4.3.0"
14
+ version = "5.0.0"
15
15
  authors = [
16
16
  {name = "The Python Cryptographic Authority developers", email = "cryptography-dev@python.org"}
17
17
  ]
@@ -30,6 +30,8 @@ classifiers = [
30
30
  "Programming Language :: Python :: 3.11",
31
31
  "Programming Language :: Python :: 3.12",
32
32
  "Programming Language :: Python :: 3.13",
33
+ "Programming Language :: Python :: 3.14",
34
+ "Programming Language :: Python :: Free Threading :: 3 - Stable",
33
35
  ]
34
36
  requires-python = ">= 3.8"
35
37
  dynamic = ["readme"]
@@ -4,9 +4,9 @@ version = 3
4
4
 
5
5
  [[package]]
6
6
  name = "autocfg"
7
- version = "1.4.0"
7
+ version = "1.5.0"
8
8
  source = "registry+https://github.com/rust-lang/crates.io-index"
9
- checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
9
+ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
10
10
 
11
11
  [[package]]
12
12
  name = "base64"
@@ -16,9 +16,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
16
16
 
17
17
  [[package]]
18
18
  name = "bcrypt"
19
- version = "0.17.0"
19
+ version = "0.17.1"
20
20
  source = "registry+https://github.com/rust-lang/crates.io-index"
21
- checksum = "92758ad6077e4c76a6cadbce5005f666df70d4f13b19976b1a8062eef880040f"
21
+ checksum = "abaf6da45c74385272ddf00e1ac074c7d8a6c1a1dda376902bd6a427522a8b2c"
22
22
  dependencies = [
23
23
  "base64",
24
24
  "blowfish",
@@ -50,12 +50,6 @@ dependencies = [
50
50
  "subtle",
51
51
  ]
52
52
 
53
- [[package]]
54
- name = "bitflags"
55
- version = "2.8.0"
56
- source = "registry+https://github.com/rust-lang/crates.io-index"
57
- checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36"
58
-
59
53
  [[package]]
60
54
  name = "block-buffer"
61
55
  version = "0.10.4"
@@ -83,9 +77,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
83
77
 
84
78
  [[package]]
85
79
  name = "cfg-if"
86
- version = "1.0.0"
80
+ version = "1.0.3"
87
81
  source = "registry+https://github.com/rust-lang/crates.io-index"
88
- checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
82
+ checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9"
89
83
 
90
84
  [[package]]
91
85
  name = "cipher"
@@ -139,14 +133,14 @@ dependencies = [
139
133
 
140
134
  [[package]]
141
135
  name = "getrandom"
142
- version = "0.3.1"
136
+ version = "0.3.3"
143
137
  source = "registry+https://github.com/rust-lang/crates.io-index"
144
- checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8"
138
+ checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4"
145
139
  dependencies = [
146
140
  "cfg-if",
147
141
  "libc",
142
+ "r-efi",
148
143
  "wasi",
149
- "windows-targets",
150
144
  ]
151
145
 
152
146
  [[package]]
@@ -157,9 +151,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
157
151
 
158
152
  [[package]]
159
153
  name = "indoc"
160
- version = "2.0.5"
154
+ version = "2.0.6"
161
155
  source = "registry+https://github.com/rust-lang/crates.io-index"
162
- checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
156
+ checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd"
163
157
 
164
158
  [[package]]
165
159
  name = "inout"
@@ -172,9 +166,9 @@ dependencies = [
172
166
 
173
167
  [[package]]
174
168
  name = "libc"
175
- version = "0.2.170"
169
+ version = "0.2.176"
176
170
  source = "registry+https://github.com/rust-lang/crates.io-index"
177
- checksum = "875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828"
171
+ checksum = "58f929b4d672ea937a23a1ab494143d968337a5f47e56d0815df1e0890ddf174"
178
172
 
179
173
  [[package]]
180
174
  name = "memoffset"
@@ -187,9 +181,9 @@ dependencies = [
187
181
 
188
182
  [[package]]
189
183
  name = "once_cell"
190
- version = "1.20.3"
184
+ version = "1.21.3"
191
185
  source = "registry+https://github.com/rust-lang/crates.io-index"
192
- checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e"
186
+ checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
193
187
 
194
188
  [[package]]
195
189
  name = "pbkdf2"
@@ -202,26 +196,25 @@ dependencies = [
202
196
 
203
197
  [[package]]
204
198
  name = "portable-atomic"
205
- version = "1.11.0"
199
+ version = "1.11.1"
206
200
  source = "registry+https://github.com/rust-lang/crates.io-index"
207
- checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e"
201
+ checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
208
202
 
209
203
  [[package]]
210
204
  name = "proc-macro2"
211
- version = "1.0.93"
205
+ version = "1.0.101"
212
206
  source = "registry+https://github.com/rust-lang/crates.io-index"
213
- checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99"
207
+ checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de"
214
208
  dependencies = [
215
209
  "unicode-ident",
216
210
  ]
217
211
 
218
212
  [[package]]
219
213
  name = "pyo3"
220
- version = "0.23.5"
214
+ version = "0.26.0"
221
215
  source = "registry+https://github.com/rust-lang/crates.io-index"
222
- checksum = "7778bffd85cf38175ac1f545509665d0b9b92a198ca7941f131f85f7a4f9a872"
216
+ checksum = "7ba0117f4212101ee6544044dae45abe1083d30ce7b29c4b5cbdfa2354e07383"
223
217
  dependencies = [
224
- "cfg-if",
225
218
  "indoc",
226
219
  "libc",
227
220
  "memoffset",
@@ -235,19 +228,18 @@ dependencies = [
235
228
 
236
229
  [[package]]
237
230
  name = "pyo3-build-config"
238
- version = "0.23.5"
231
+ version = "0.26.0"
239
232
  source = "registry+https://github.com/rust-lang/crates.io-index"
240
- checksum = "94f6cbe86ef3bf18998d9df6e0f3fc1050a8c5efa409bf712e661a4366e010fb"
233
+ checksum = "4fc6ddaf24947d12a9aa31ac65431fb1b851b8f4365426e182901eabfb87df5f"
241
234
  dependencies = [
242
- "once_cell",
243
235
  "target-lexicon",
244
236
  ]
245
237
 
246
238
  [[package]]
247
239
  name = "pyo3-ffi"
248
- version = "0.23.5"
240
+ version = "0.26.0"
249
241
  source = "registry+https://github.com/rust-lang/crates.io-index"
250
- checksum = "e9f1b4c431c0bb1c8fb0a338709859eed0d030ff6daa34368d3b152a63dfdd8d"
242
+ checksum = "025474d3928738efb38ac36d4744a74a400c901c7596199e20e45d98eb194105"
251
243
  dependencies = [
252
244
  "libc",
253
245
  "pyo3-build-config",
@@ -255,9 +247,9 @@ dependencies = [
255
247
 
256
248
  [[package]]
257
249
  name = "pyo3-macros"
258
- version = "0.23.5"
250
+ version = "0.26.0"
259
251
  source = "registry+https://github.com/rust-lang/crates.io-index"
260
- checksum = "fbc2201328f63c4710f68abdf653c89d8dbc2858b88c5d88b0ff38a75288a9da"
252
+ checksum = "2e64eb489f22fe1c95911b77c44cc41e7c19f3082fc81cce90f657cdc42ffded"
261
253
  dependencies = [
262
254
  "proc-macro2",
263
255
  "pyo3-macros-backend",
@@ -267,9 +259,9 @@ dependencies = [
267
259
 
268
260
  [[package]]
269
261
  name = "pyo3-macros-backend"
270
- version = "0.23.5"
262
+ version = "0.26.0"
271
263
  source = "registry+https://github.com/rust-lang/crates.io-index"
272
- checksum = "fca6726ad0f3da9c9de093d6f116a93c1a38e417ed73bf138472cf4064f72028"
264
+ checksum = "100246c0ecf400b475341b8455a9213344569af29a3c841d29270e53102e0fcf"
273
265
  dependencies = [
274
266
  "heck",
275
267
  "proc-macro2",
@@ -280,18 +272,24 @@ dependencies = [
280
272
 
281
273
  [[package]]
282
274
  name = "quote"
283
- version = "1.0.38"
275
+ version = "1.0.40"
284
276
  source = "registry+https://github.com/rust-lang/crates.io-index"
285
- checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
277
+ checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
286
278
  dependencies = [
287
279
  "proc-macro2",
288
280
  ]
289
281
 
282
+ [[package]]
283
+ name = "r-efi"
284
+ version = "5.3.0"
285
+ source = "registry+https://github.com/rust-lang/crates.io-index"
286
+ checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
287
+
290
288
  [[package]]
291
289
  name = "sha2"
292
- version = "0.10.8"
290
+ version = "0.10.9"
293
291
  source = "registry+https://github.com/rust-lang/crates.io-index"
294
- checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8"
292
+ checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
295
293
  dependencies = [
296
294
  "cfg-if",
297
295
  "cpufeatures",
@@ -306,9 +304,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
306
304
 
307
305
  [[package]]
308
306
  name = "syn"
309
- version = "2.0.98"
307
+ version = "2.0.106"
310
308
  source = "registry+https://github.com/rust-lang/crates.io-index"
311
- checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1"
309
+ checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6"
312
310
  dependencies = [
313
311
  "proc-macro2",
314
312
  "quote",
@@ -317,9 +315,9 @@ dependencies = [
317
315
 
318
316
  [[package]]
319
317
  name = "target-lexicon"
320
- version = "0.12.16"
318
+ version = "0.13.3"
321
319
  source = "registry+https://github.com/rust-lang/crates.io-index"
322
- checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
320
+ checksum = "df7f62577c25e07834649fc3b39fafdc597c0a3527dc1c60129201ccfcbaa50c"
323
321
 
324
322
  [[package]]
325
323
  name = "typenum"
@@ -329,15 +327,15 @@ checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f"
329
327
 
330
328
  [[package]]
331
329
  name = "unicode-ident"
332
- version = "1.0.17"
330
+ version = "1.0.19"
333
331
  source = "registry+https://github.com/rust-lang/crates.io-index"
334
- checksum = "00e2473a93778eb0bad35909dff6a10d28e63f792f16ed15e404fca9d5eeedbe"
332
+ checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d"
335
333
 
336
334
  [[package]]
337
335
  name = "unindent"
338
- version = "0.2.3"
336
+ version = "0.2.4"
339
337
  source = "registry+https://github.com/rust-lang/crates.io-index"
340
- checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce"
338
+ checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
341
339
 
342
340
  [[package]]
343
341
  name = "version_check"
@@ -347,85 +345,27 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
347
345
 
348
346
  [[package]]
349
347
  name = "wasi"
350
- version = "0.13.3+wasi-0.2.2"
348
+ version = "0.14.7+wasi-0.2.4"
351
349
  source = "registry+https://github.com/rust-lang/crates.io-index"
352
- checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2"
350
+ checksum = "883478de20367e224c0090af9cf5f9fa85bed63a95c1abf3afc5c083ebc06e8c"
353
351
  dependencies = [
354
- "wit-bindgen-rt",
352
+ "wasip2",
355
353
  ]
356
354
 
357
355
  [[package]]
358
- name = "windows-targets"
359
- version = "0.52.6"
356
+ name = "wasip2"
357
+ version = "1.0.1+wasi-0.2.4"
360
358
  source = "registry+https://github.com/rust-lang/crates.io-index"
361
- checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
359
+ checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7"
362
360
  dependencies = [
363
- "windows_aarch64_gnullvm",
364
- "windows_aarch64_msvc",
365
- "windows_i686_gnu",
366
- "windows_i686_gnullvm",
367
- "windows_i686_msvc",
368
- "windows_x86_64_gnu",
369
- "windows_x86_64_gnullvm",
370
- "windows_x86_64_msvc",
361
+ "wit-bindgen",
371
362
  ]
372
363
 
373
364
  [[package]]
374
- name = "windows_aarch64_gnullvm"
375
- version = "0.52.6"
376
- source = "registry+https://github.com/rust-lang/crates.io-index"
377
- checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
378
-
379
- [[package]]
380
- name = "windows_aarch64_msvc"
381
- version = "0.52.6"
382
- source = "registry+https://github.com/rust-lang/crates.io-index"
383
- checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
384
-
385
- [[package]]
386
- name = "windows_i686_gnu"
387
- version = "0.52.6"
388
- source = "registry+https://github.com/rust-lang/crates.io-index"
389
- checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
390
-
391
- [[package]]
392
- name = "windows_i686_gnullvm"
393
- version = "0.52.6"
365
+ name = "wit-bindgen"
366
+ version = "0.46.0"
394
367
  source = "registry+https://github.com/rust-lang/crates.io-index"
395
- checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
396
-
397
- [[package]]
398
- name = "windows_i686_msvc"
399
- version = "0.52.6"
400
- source = "registry+https://github.com/rust-lang/crates.io-index"
401
- checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
402
-
403
- [[package]]
404
- name = "windows_x86_64_gnu"
405
- version = "0.52.6"
406
- source = "registry+https://github.com/rust-lang/crates.io-index"
407
- checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
408
-
409
- [[package]]
410
- name = "windows_x86_64_gnullvm"
411
- version = "0.52.6"
412
- source = "registry+https://github.com/rust-lang/crates.io-index"
413
- checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
414
-
415
- [[package]]
416
- name = "windows_x86_64_msvc"
417
- version = "0.52.6"
418
- source = "registry+https://github.com/rust-lang/crates.io-index"
419
- checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
420
-
421
- [[package]]
422
- name = "wit-bindgen-rt"
423
- version = "0.33.0"
424
- source = "registry+https://github.com/rust-lang/crates.io-index"
425
- checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c"
426
- dependencies = [
427
- "bitflags",
428
- ]
368
+ checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59"
429
369
 
430
370
  [[package]]
431
371
  name = "zeroize"
@@ -3,10 +3,12 @@ name = "bcrypt-rust"
3
3
  version = "0.1.0"
4
4
  authors = ["The bcrypt developers <cryptography-dev@python.org>"]
5
5
  edition = "2018"
6
+ # This specifies the MSRV
7
+ rust-version = "1.74.0"
6
8
  publish = false
7
9
 
8
10
  [dependencies]
9
- pyo3 = { version = "0.23.5", features = ["abi3"] }
11
+ pyo3 = { version = "0.26", features = ["abi3"] }
10
12
  bcrypt = "0.17"
11
13
  bcrypt-pbkdf = "0.10.0"
12
14
  base64 = "0.22.1"
@@ -26,13 +26,12 @@ pub const BASE64_ENGINE: base64::engine::GeneralPurpose = base64::engine::Genera
26
26
  );
27
27
 
28
28
  #[pyo3::pyfunction]
29
- #[pyo3(signature = (rounds=None, prefix=None))]
29
+ #[pyo3(signature = (rounds=12, prefix=None), text_signature = "(rounds=12, prefix=b'2b')")]
30
30
  fn gensalt<'p>(
31
31
  py: pyo3::Python<'p>,
32
- rounds: Option<u16>,
32
+ rounds: u16,
33
33
  prefix: Option<&[u8]>,
34
34
  ) -> pyo3::PyResult<pyo3::Bound<'p, pyo3::types::PyBytes>> {
35
- let rounds = rounds.unwrap_or(12);
36
35
  let prefix = prefix.unwrap_or(b"2b");
37
36
 
38
37
  if prefix != b"2a" && prefix != b"2b" {
@@ -78,7 +77,16 @@ fn hashpw<'p>(
78
77
  // bytes on the updated prefix $2b$, but leaving $2a$ unchanged for
79
78
  // compatibility. However, pyca/bcrypt 2.0.0 *did* correctly truncate inputs
80
79
  // on $2a$, so we do it here to preserve compatibility with 2.0.0
81
- let password = &password[..password.len().min(72)];
80
+ // Silent truncation is _probably_ not the best idea, even if the "original"
81
+ // OpenBSD implementation did/does this.
82
+ // We prefer to raise a ValueError in this case - if the user _wants_ to truncate,
83
+ // they can always do so manually by passing s[:72] instead of s into hashpw().
84
+
85
+ if password.len() > 72 {
86
+ return Err(pyo3::exceptions::PyValueError::new_err(
87
+ "password cannot be longer than 72 bytes, truncate manually if necessary (e.g. my_password[:72])",
88
+ ));
89
+ }
82
90
 
83
91
  // salt here is not just the salt bytes, but rather an encoded value
84
92
  // containing a version number, number of rounds, and the salt.
@@ -118,7 +126,7 @@ fn hashpw<'p>(
118
126
  .map_err(|_| pyo3::exceptions::PyValueError::new_err("Invalid salt"))?;
119
127
 
120
128
  let hashed = py
121
- .allow_threads(|| bcrypt::hash_with_salt(password, cost, raw_salt))
129
+ .detach(|| bcrypt::hash_with_salt(password, cost, raw_salt))
122
130
  .map_err(|_| pyo3::exceptions::PyValueError::new_err("Invalid salt"))?;
123
131
  Ok(pyo3::types::PyBytes::new(
124
132
  py,
@@ -175,7 +183,7 @@ fn kdf<'p>(
175
183
  }
176
184
 
177
185
  pyo3::types::PyBytes::new_with(py, desired_key_bytes, |output| {
178
- py.allow_threads(|| {
186
+ py.detach(|| {
179
187
  bcrypt_pbkdf::bcrypt_pbkdf(password, salt, rounds, output).unwrap();
180
188
  });
181
189
  Ok(())
@@ -202,7 +210,7 @@ mod _bcrypt {
202
210
  // When updating this, also update pyproject.toml
203
211
  // This isn't named __version__ because passlib treats the existence of
204
212
  // that attribute as proof that we're a different module
205
- m.add("__version_ex__", "4.3.0")?;
213
+ m.add("__version_ex__", "5.0.0")?;
206
214
 
207
215
  let author = "The Python Cryptographic Authority developers";
208
216
  m.add("__author__", author)?;
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: bcrypt
3
- Version: 4.3.0
3
+ Version: 5.0.0
4
4
  Summary: Modern password hashing for your software and your servers
5
5
  Author-email: The Python Cryptographic Authority developers <cryptography-dev@python.org>
6
6
  License: Apache-2.0
@@ -17,6 +17,8 @@ Classifier: Programming Language :: Python :: 3.10
17
17
  Classifier: Programming Language :: Python :: 3.11
18
18
  Classifier: Programming Language :: Python :: 3.12
19
19
  Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Programming Language :: Python :: Free Threading :: 3 - Stable
20
22
  Requires-Python: >=3.8
21
23
  Description-Content-Type: text/x-rst
22
24
  License-File: LICENSE
@@ -24,6 +26,7 @@ Provides-Extra: tests
24
26
  Requires-Dist: pytest!=3.3.0,>=3.2.1; extra == "tests"
25
27
  Provides-Extra: typecheck
26
28
  Requires-Dist: mypy; extra == "typecheck"
29
+ Dynamic: license-file
27
30
 
28
31
  bcrypt
29
32
  ======
@@ -78,8 +81,18 @@ While bcrypt remains an acceptable choice for password storage, depending on you
78
81
  Changelog
79
82
  =========
80
83
 
81
- Unreleased
82
- ----------
84
+ 5.0.0
85
+ -----
86
+
87
+ * Bumped MSRV to 1.74.
88
+ * Added support for Python 3.14 and free-threaded Python 3.14.
89
+ * Added support for Windows on ARM.
90
+ * Passing ``hashpw`` a password longer than 72 bytes now raises a
91
+ ``ValueError``. Previously the password was silently truncated, following the
92
+ behavior of the original OpenBSD ``bcrypt`` implementation.
93
+
94
+ 4.3.0
95
+ -----
83
96
 
84
97
  * Dropped support for Python 3.7.
85
98
  * We now support free-threaded Python 3.13.
@@ -121,24 +121,6 @@ _test_vectors = [
121
121
  b"$2a$05$XXXXXXXXXXXXXXXXXXXXXO",
122
122
  b"$2a$05$XXXXXXXXXXXXXXXXXXXXXOAcXxm9kjPGEMsLznoKqmqw7tc8WCx4a",
123
123
  ),
124
- (
125
- b"0123456789abcdefghijklmnopqrstuvwxyz"
126
- b"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
127
- b"chars after 72 are ignored",
128
- b"$2a$05$abcdefghijklmnopqrstuu",
129
- b"$2a$05$abcdefghijklmnopqrstuu5s2v8.iXieOjg/.AySBTTZIIVFJeBui",
130
- ),
131
- (
132
- b"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
133
- b"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
134
- b"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
135
- b"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
136
- b"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
137
- b"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
138
- b"chars after 72 are ignored as usual",
139
- b"$2a$05$/OK.fbVrR/bpIqNJ5ianF.",
140
- b"$2a$05$/OK.fbVrR/bpIqNJ5ianF.swQOIzjOiJ9GHEPuhEkvqrUyvWhEMx6",
141
- ),
142
124
  (
143
125
  b"\xa3",
144
126
  b"$2a$05$/OK.fbVrR/bpIqNJ5ianF.",
@@ -252,6 +234,25 @@ def test_checkpw_2y_prefix(password, hashed, expected):
252
234
  assert bcrypt.checkpw(password, hashed) is True
253
235
 
254
236
 
237
+ @pytest.mark.parametrize(
238
+ ("pw_length", "should_raise"),
239
+ [
240
+ (71, False),
241
+ (72, False),
242
+ (73, True),
243
+ ],
244
+ )
245
+ def test_hashpw_raises_correctly_for_long_passwords(pw_length, should_raise):
246
+ password = b"\xaa" * pw_length
247
+ salt = b"$2b$04$xnFVhJsTzsFBTeP3PpgbMe"
248
+
249
+ if should_raise:
250
+ with pytest.raises(ValueError):
251
+ bcrypt.hashpw(password, salt)
252
+ else:
253
+ bcrypt.hashpw(password, salt)
254
+
255
+
255
256
  def test_hashpw_invalid():
256
257
  with pytest.raises(ValueError):
257
258
  bcrypt.hashpw(b"password", b"$2z$04$cVWp4XaNU8a4v1uMRum2SO")
@@ -490,15 +491,6 @@ def test_invalid_params(password, salt, desired_key_bytes, rounds, error):
490
491
  bcrypt.kdf(password, salt, desired_key_bytes, rounds)
491
492
 
492
493
 
493
- def test_2a_wraparound_bug():
494
- assert (
495
- bcrypt.hashpw(
496
- (b"0123456789" * 26)[:255], b"$2a$04$R1lJ2gkNaoPGdafE.H.16."
497
- )
498
- == b"$2a$04$R1lJ2gkNaoPGdafE.H.16.1MKHPvmKwryeulRe225LKProWYwt9Oi"
499
- )
500
-
501
-
502
494
  def test_multithreading():
503
495
  def create_user(pw):
504
496
  salt = bcrypt.gensalt(4)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes