secretutils

Secret utilities.

Added in version 3.5.

oslo_utils.secretutils.crypt_mksalt(method: str) str

Make salt to encrypt password string

This is provided as a replacement of crypt.mksalt method because crypt module was removed in Python 3.13.

Added in version 8.0.

oslo_utils.secretutils.crypt_password(key: str, salt: str) str

Encrtpt password string and generate the value in /etc/shadow format

This is provided as a replacement of crypt.crypt method because crypt module was removed in Python 3.13.

Added in version 8.0.

oslo_utils.secretutils.md5(string: bytes | bytearray = b'', usedforsecurity: bool = True) Any

Return an md5 hashlib object using usedforsecurity parameter

For python distributions that support the usedforsecurity keyword parameter, this passes the parameter through as expected. See https://bugs.python.org/issue9216