@@ -8,16 +8,41 @@ as it was present in Python 3.12 before it was removed.
88
99See `PEP 594 `_ for details of the removal.
1010
11+ Unlike ``crypt ``, this library always exposes the `crypt_r(3) `_ function, not `crypt(3) `_.
12+
13+ Note that ``crypt_r `` is not part of any standard.
14+ This library is tested with the ``crypt_r `` implementation in Fedora Linux
15+ (libxcrypt, as of 2024), and should work with compatible implementations of ``crypt_r ``
16+ (such as ``libcrypt.so `` from older glibc).
17+
18+ Note that the improvements in ``crypt_r `` over ``crypt `` are in memory management and thread safety,
19+ not security/cryptography.
20+
21+ It is easy to use ``crypt_r `` in an insecure way. Notably:
22+ All hashing methods except ``METHOD_CRYPT `` (the original Unix algorithm from the 1970s)
23+ are optional platform-specific extensions.
24+ This library does not expose modern hashing methods like libxcrypt's yescrypt.
25+ The last wrapper update is from 2017.
26+ No future development is planned.
27+
28+ To use this module, you can either import ``crypt_r `` explicitly
29+ or use the old ``crypt `` name for backward compatibility.
30+ However, on Python older than 3.13, the ``crypt `` module
31+ from the standard library will usually take precedence on ``sys.path ``.
32+
33+ Here follows the original documentation for the removed ``crypt `` module,
34+ updated to refer to it as ``crypt_r ``:
35+
1136--------------
1237
13- This module implements an interface to the `crypt (3) `_ routine, which is
38+ This module implements an interface to the `crypt_r (3) `_ routine, which is
1439a one-way hash function based upon a modified DES algorithm; see the Unix man
1540page for further details. Possible uses include storing hashed passwords
1641so you can check passwords without storing the actual password, or attempting
1742to crack Unix passwords with a dictionary.
1843
1944Notice that the behavior of this module depends on the actual implementation of
20- the `crypt (3) `_ routine in the running system. Therefore, any
45+ the `crypt_r (3) `_ routine in the running system. Therefore, any
2146extensions available on the current implementation will also be available on
2247this module.
2348
@@ -89,7 +114,7 @@ The ``crypt_r`` module defines the following functions:
89114 Returns the hashed password as a string, which will be composed of
90115 characters from the same alphabet as the salt.
91116
92- Since a few `crypt (3) `_ extensions allow different values, with
117+ Since a few `crypt_r (3) `_ extensions allow different values, with
93118 different sizes in the *salt *, it is recommended to use the full crypted
94119 password as salt when checking for a password.
95120
@@ -156,6 +181,18 @@ check it against the original:
156181 if not compare_hash(hashed, crypt_r.crypt(plaintext, hashed)):
157182 raise ValueError (" hashed version doesn't validate against original" )
158183
184+ --------------
185+
186+
187+ Changelog
188+ ---------
189+
190+ For historical changes when this module was included in Python,
191+ please refer to the `Python 3.12 Changelog `_.
192+
193+
159194.. _PEP 594 : https://peps.python.org/pep-0594/#crypt
160195.. _crypt(3) : https://manpages.debian.org/crypt(3)
196+ .. _crypt_r(3) : https://manpages.debian.org/crypt_r(3)
161197.. _hmac.compare_digest() : https://docs.python.org/3/library/hmac.html#hmac.compare_digest
198+ .. _Python 3.12 Changelog : https://docs.python.org/3.12/whatsnew/changelog.html
0 commit comments