secretutils

密钥工具。

在 3.5 版本中添加。

oslo_utils.secretutils.crypt_mksalt(method)

生成用于加密密码字符串的盐值

由于 Python 3.13 中已移除 crypt 模块,因此提供此功能以替代 crypt.mksalt 方法。

在 8.0 版本中添加。

oslo_utils.secretutils.crypt_password(key, salt)

加密密码字符串并生成 /etc/shadow 格式的值

由于 Python 3.13 中已移除 crypt 模块,因此提供此功能以替代 crypt.crypt 方法。

在 8.0 版本中添加。

oslo_utils.secretutils.md5(string=b'', usedforsecurity=True)

使用 usedforsecurity 参数返回一个 md5 hashlib 对象

对于支持 usedforsecurity 关键字参数的 Python 发行版,此功能会按预期传递该参数。请参阅 https://bugs.python.org/issue9216