KDF.pyi 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. from types import ModuleType
  2. from typing import Optional, Callable, Tuple, Union, Dict, Any, ByteString, overload
  3. from typing_extensions import Literal
  4. RNG = Callable[[int], bytes]
  5. PRF = Callable[[bytes, bytes], bytes]
  6. def PBKDF1(password: str, salt: bytes, dkLen: int, count: Optional[int]=1000, hashAlgo: Optional[ModuleType]=None) -> bytes: ...
  7. def PBKDF2(password: str, salt: bytes, dkLen: Optional[int]=16, count: Optional[int]=1000, prf: Optional[RNG]=None, hmac_hash_module: Optional[ModuleType]=None) -> bytes: ...
  8. class _S2V(object):
  9. def __init__(self, key: bytes, ciphermod: ModuleType, cipher_params: Optional[Dict[Any, Any]]=None) -> None: ...
  10. @staticmethod
  11. def new(key: bytes, ciphermod: ModuleType) -> None: ...
  12. def update(self, item: bytes) -> None: ...
  13. def derive(self) -> bytes: ...
  14. def HKDF(master: bytes, key_len: int, salt: bytes, hashmod: ModuleType, num_keys: Optional[int]=1, context: Optional[bytes]=None) -> Union[bytes, Tuple[bytes, ...]]: ...
  15. def scrypt(password: str, salt: str, key_len: int, N: int, r: int, p: int, num_keys: Optional[int]=1) -> Union[bytes, Tuple[bytes, ...]]: ...
  16. def _bcrypt_decode(data: bytes) -> bytes: ...
  17. def _bcrypt_hash(password:bytes , cost: int, salt: bytes, constant:bytes, invert:bool) -> bytes: ...
  18. def bcrypt(password: Union[bytes, str], cost: int, salt: Optional[bytes]=None) -> bytes: ...
  19. def bcrypt_check(password: Union[bytes, str], bcrypt_hash: Union[bytes, bytearray, str]) -> None: ...
  20. @overload
  21. def SP800_108_Counter(master: ByteString,
  22. key_len: int,
  23. prf: PRF,
  24. num_keys: Literal[None] = None,
  25. label: ByteString = b'', context: ByteString = b'') -> bytes: ...
  26. @overload
  27. def SP800_108_Counter(master: ByteString,
  28. key_len: int,
  29. prf: PRF,
  30. num_keys: int,
  31. label: ByteString = b'', context: ByteString = b'') -> Tuple[bytes]: ...