add first commit
CI / linux (map[runner:ubuntu-22.04 target:aarch64]) (push) Has been cancelled
CI / linux (map[runner:ubuntu-22.04 target:armv7]) (push) Has been cancelled
CI / linux (map[runner:ubuntu-22.04 target:ppc64le]) (push) Has been cancelled
CI / linux (map[runner:ubuntu-22.04 target:s390x]) (push) Has been cancelled
CI / linux (map[runner:ubuntu-22.04 target:x86]) (push) Has been cancelled
CI / linux (map[runner:ubuntu-22.04 target:x86_64]) (push) Has been cancelled
CI / musllinux (map[runner:ubuntu-22.04 target:aarch64]) (push) Has been cancelled
CI / musllinux (map[runner:ubuntu-22.04 target:armv7]) (push) Has been cancelled
CI / musllinux (map[runner:ubuntu-22.04 target:x86]) (push) Has been cancelled
CI / musllinux (map[runner:ubuntu-22.04 target:x86_64]) (push) Has been cancelled
CI / windows (map[python_arch:arm64 runner:windows-11-arm target:aarch64]) (push) Has been cancelled
CI / windows (map[python_arch:x64 runner:windows-latest target:x64]) (push) Has been cancelled
CI / windows (map[python_arch:x86 runner:windows-latest target:x86]) (push) Has been cancelled
CI / macos (map[runner:macos-15-intel target:x86_64]) (push) Has been cancelled
CI / macos (map[runner:macos-latest target:aarch64]) (push) Has been cancelled
CI / sdist (push) Has been cancelled
CI / Release (push) Has been cancelled

This commit is contained in:
2026-07-23 10:55:34 +08:00
commit 589a56765f
7 changed files with 625 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
# utils/password/chongming_password.pyi
def hash_password(password: str) -> str:
"""
对明文密码进行 Argon2id 哈希,返回 PHC 格式字符串。
Args:
password: 明文密码
Returns:
str: 形如 "$argon2id$v=19$m=19456,t=2,p=1$..." 的哈希
Raises:
ValueError: 如果密码为空或哈希过程失败
"""
...
def verify_password(password: str, password_hash: str) -> bool:
"""
验证明文密码是否与给定哈希匹配。
Args:
password: 明文密码
password_hash: 存储的 PHC 格式哈希
Returns:
bool: 匹配返回 True,否则 False
Raises:
ValueError: 如果哈希格式无效
"""
...