mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-08 13:04:47 +08:00
76 lines
2.0 KiB
Python
76 lines
2.0 KiB
Python
from collections import OrderedDict
|
|
from typing import (
|
|
Callable,
|
|
Dict,
|
|
List,
|
|
Optional,
|
|
Union,
|
|
)
|
|
|
|
|
|
def check_password(
|
|
password: str,
|
|
encoded: str,
|
|
setter: Optional[Callable] = ...,
|
|
preferred: str = ...
|
|
) -> bool: ...
|
|
|
|
|
|
def get_hasher(algorithm: str = ...) -> BasePasswordHasher: ...
|
|
|
|
|
|
def get_hashers(
|
|
) -> Union[List[MD5PasswordHasher], List[BasePasswordHasher], List[PBKDF2PasswordHasher], List[UnsaltedMD5PasswordHasher]]: ...
|
|
|
|
|
|
def get_hashers_by_algorithm() -> Dict[str, BasePasswordHasher]: ...
|
|
|
|
|
|
def identify_hasher(encoded: str) -> BasePasswordHasher: ...
|
|
|
|
|
|
def is_password_usable(encoded: Optional[str]) -> bool: ...
|
|
|
|
|
|
def make_password(password: Optional[str], salt: Optional[str] = ..., hasher: str = ...) -> str: ...
|
|
|
|
|
|
def mask_hash(hash: str, show: int = ..., char: str = ...) -> str: ...
|
|
|
|
|
|
def reset_hashers(**kwargs) -> None: ...
|
|
|
|
|
|
class BasePasswordHasher:
|
|
def harden_runtime(self, password: str, encoded: str) -> None: ...
|
|
def must_update(self, encoded: str) -> bool: ...
|
|
def safe_summary(self, encoded: str): ...
|
|
def salt(self) -> str: ...
|
|
|
|
|
|
class MD5PasswordHasher:
|
|
def encode(self, password: str, salt: str) -> str: ...
|
|
def safe_summary(self, encoded: str) -> OrderedDict: ...
|
|
def verify(self, password: str, encoded: str) -> bool: ...
|
|
|
|
|
|
class PBKDF2PasswordHasher:
|
|
def encode(self, password: str, salt: str, iterations: Optional[int] = ...) -> str: ...
|
|
def must_update(self, encoded: str) -> bool: ...
|
|
def verify(self, password: str, encoded: str) -> bool: ...
|
|
|
|
|
|
class SHA1PasswordHasher:
|
|
def encode(self, password: str, salt: str) -> str: ...
|
|
def verify(self, password: str, encoded: str) -> bool: ...
|
|
|
|
|
|
class UnsaltedMD5PasswordHasher:
|
|
def encode(self, password: str, salt: str) -> str: ...
|
|
def verify(self, password: str, encoded: str) -> bool: ...
|
|
|
|
|
|
class UnsaltedSHA1PasswordHasher:
|
|
def encode(self, password: str, salt: str) -> str: ...
|
|
def salt(self) -> str: ...
|
|
def verify(self, password: str, encoded: str) -> bool: ... |