| 1 | import sys |
| 2 | from typing import Final, NamedTuple, type_check_only |
| 3 | from typing_extensions import disjoint_base |
| 4 | |
| 5 | if sys.platform != "win32": |
| 6 | @type_check_only |
| 7 | class _MethodBase(NamedTuple): |
| 8 | name: str |
| 9 | ident: str | None |
| 10 | salt_chars: int |
| 11 | total_size: int |
| 12 | |
| 13 | if sys.version_info >= (3, 12): |
| 14 | class _Method(_MethodBase): ... |
| 15 | else: |
| 16 | @disjoint_base |
| 17 | class _Method(_MethodBase): ... |
| 18 | |
| 19 | METHOD_CRYPT: Final[_Method] |
| 20 | METHOD_MD5: Final[_Method] |
| 21 | METHOD_SHA256: Final[_Method] |
| 22 | METHOD_SHA512: Final[_Method] |
| 23 | METHOD_BLOWFISH: Final[_Method] |
| 24 | methods: list[_Method] |
| 25 | def mksalt(method: _Method | None = None, *, rounds: int | None = None) -> str: ... |
| 26 | def crypt(word: str, salt: str | _Method | None = None) -> str: ... |