Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6661d88

Browse files
committed
Issue #25287: Don't add crypt.METHOD_CRYPT to crypt.methods if it's not
supported. Check if it is supported, it may not be supported on OpenBSD for example.
1 parent 4b5d801 commit 6661d88

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

Doc/library/crypt.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Module Attributes
6464

6565
A list of available password hashing algorithms, as
6666
``crypt.METHOD_*`` objects. This list is sorted from strongest to
67-
weakest, and is guaranteed to have at least ``crypt.METHOD_CRYPT``.
67+
weakest.
6868

6969

7070
Module Functions

Lib/crypt.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,8 @@ def crypt(word, salt=None):
5454
METHOD_SHA512 = _Method('SHA512', '6', 16, 106)
5555

5656
methods = []
57-
for _method in (METHOD_SHA512, METHOD_SHA256, METHOD_MD5):
57+
for _method in (METHOD_SHA512, METHOD_SHA256, METHOD_MD5, METHOD_CRYPT):
5858
_result = crypt('', _method)
5959
if _result and len(_result) == _method.total_size:
6060
methods.append(_method)
61-
methods.append(METHOD_CRYPT)
6261
del _result, _method

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ Core and Builtins
4040
Library
4141
-------
4242

43+
- Issue #25287: Don't add crypt.METHOD_CRYPT to crypt.methods if it's not
44+
supported. Check if it is supported, it may not be supported on OpenBSD for
45+
example.
46+
4347
- Issue #23600: Default implementation of tzinfo.fromutc() was returning
4448
wrong results in some cases.
4549

0 commit comments

Comments
 (0)