keystone.common.password_hashers.scrypt 模块¶
- class keystone.common.password_hashers.scrypt.Scrypt[源代码]¶
基类:
PasswordHasherpasslib 过渡类,用于实现 scrypt 密码哈希
- static hash(password: bytes, salt_size: int = 16, n: int = 16, r: int = 8, p: int = 1, **kwargs) str[源代码]¶
生成带有 ident 和参数的密码哈希字符串
https://docs.pythonlang.cn/3/library/hashlib.html#hashlib.scrypt
- 参数:
password (bytes) – 要哈希的密码。
salt_size (int) – 盐的大小。
n (int) – CPU/内存成本因子。
r (int) – 块大小。
p (int) – 并行计数。
- 返回值:
格式为 $scrypt$ln=logN,r=R,p=P$salt$checksum 的字符串
- ident_values: set[str] = {'$7$', '$scrypt$'}¶
- name: str = 'scrypt'¶