Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update documentation, release 3.13.0 #9

Merged
merged 3 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 47 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,41 @@ as it was present in Python 3.12 before it was removed.

See `PEP 594`_ for details of the removal.

Unlike ``crypt``, this library always exposes the `crypt_r(3)`_ function, not `crypt(3)`_.

Note that ``crypt_r`` is not part of any standard.
This library is tested with the ``crypt_r`` implementation in Fedora Linux
(libxcrypt, as of 2024), and should work with compatible implementations of ``crypt_r``
(such as ``libcrypt.so`` from older glibc).

Note that the improvements in ``crypt_r`` over ``crypt`` are in memory management and thread safety,
not security/cryptography.

It is easy to use ``crypt_r`` in an insecure way. Notably:
All hashing methods except ``METHOD_CRYPT`` (the original Unix algorithm from the 1970s)
are optional platform-specific extensions.
This library does not expose modern hashing methods like libxcrypt's yescrypt.
The last wrapper update is from 2017.
No future development is planned.

To use this module, you can either import ``crypt_r`` explicitly
or use the old ``crypt`` name for backward compatibility.
However, on Python older than 3.13, the ``crypt`` module
from the standard library will usually take precedence on ``sys.path``.

Here follows the original documentation for the removed ``crypt`` module,
updated to refer to it as ``crypt_r``:

--------------

This module implements an interface to the `crypt(3)`_ routine, which is
This module implements an interface to the `crypt_r(3)`_ routine, which is
a one-way hash function based upon a modified DES algorithm; see the Unix man
page for further details. Possible uses include storing hashed passwords
so you can check passwords without storing the actual password, or attempting
to crack Unix passwords with a dictionary.

Notice that the behavior of this module depends on the actual implementation of
the `crypt(3)`_ routine in the running system. Therefore, any
the `crypt_r(3)`_ routine in the running system. Therefore, any
extensions available on the current implementation will also be available on
this module.

Expand Down Expand Up @@ -89,7 +114,7 @@ The ``crypt_r`` module defines the following functions:
Returns the hashed password as a string, which will be composed of
characters from the same alphabet as the salt.

Since a few `crypt(3)`_ extensions allow different values, with
Since a few `crypt_r(3)`_ extensions allow different values, with
different sizes in the *salt*, it is recommended to use the full crypted
password as salt when checking for a password.

Expand Down Expand Up @@ -156,6 +181,25 @@ check it against the original:
if not compare_hash(hashed, crypt_r.crypt(plaintext, hashed)):
raise ValueError("hashed version doesn't validate against original")

--------------


Changelog
---------

3.13.0
^^^^^^

* Initial fork from CPython 3.12.3
* Always uses the `crypt_r(3)`_ function, never `crypt(3)`_
* Renamed the Python modules to ``crypt_r`` and ``_crypt_r``

For historical changes when this module was included in Python,
please refer to the `Python 3.12 Changelog`_.
hroncok marked this conversation as resolved.
Show resolved Hide resolved


.. _PEP 594: https://peps.python.org/pep-0594/#crypt
.. _crypt(3): https://manpages.debian.org/crypt(3)
.. _crypt_r(3): https://manpages.debian.org/crypt_r(3)
.. _hmac.compare_digest(): https://docs.python.org/3/library/hmac.html#hmac.compare_digest
.. _Python 3.12 Changelog: https://docs.python.org/3.12/whatsnew/changelog.html
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[build-system]
requires = ["setuptools"]
requires = ["setuptools>=61"]
build-backend = "setuptools.build_meta"

[project]
name = "crypt_r"
version = "3.12.3"
version = "3.13.0"
authors = [
{name = "Steven D. Majewski", email = "sdm7g@virginia.edu"},
]
Expand Down