Reputation: 10484
The documentation for the python3 crypt module says.
Deprecated since version 3.11, will be removed in version 3.13: The crypt module is deprecated (see PEP 594 for details and alternatives). The hashlib module is a potential replacement for certain use cases. The passlib package can replace all use cases of this module.
However, this does not in-fact appear to be the case.
In particular the default format for "mkpasswd" on my system seems to be "yescrypt", which passlib has no support for. So the "crypt" module can verify passwords generated by "mkpasswd" but passlib cannot. Additionally, passlib seems to require algorithms to be enabled manually while crypt can verify any hash the system supports.
Is there a proper replacement for the "crypt" module?
Upvotes: 3
Views: 908
Reputation: 110121
In general, when a module is removed from the stdlib, it shows up as a maintained package in the pypi -
This is the case for crypt: https://pypi.org/project/crypt-r/
That way, people who rely on it can get at least the level of functionality and maintenance that it was receiving as part of the stdlib - and, as in general the reason for removing modules, which only happens after a multi-year deprecation in Python case, is the lack of maintainers, the project as a standalone package should be one with lower barrier for contribution/maintainance as volunteers by those interested.
Upvotes: 1