mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-23 19:41:51 +08:00
hashlib: fix sha3 and shake hash constructors, remove hash object __init__s (#12906)
This commit is contained in:
@@ -56,12 +56,20 @@ class _Hash:
|
||||
def block_size(self) -> int: ...
|
||||
@property
|
||||
def name(self) -> str: ...
|
||||
def __init__(self, data: ReadableBuffer = ...) -> None: ...
|
||||
def copy(self) -> Self: ...
|
||||
def digest(self) -> bytes: ...
|
||||
def hexdigest(self) -> str: ...
|
||||
def update(self, data: ReadableBuffer, /) -> None: ...
|
||||
|
||||
class _VarLenHash:
|
||||
digest_size: int
|
||||
block_size: int
|
||||
name: str
|
||||
def copy(self) -> _VarLenHash: ...
|
||||
def digest(self, length: int, /) -> bytes: ...
|
||||
def hexdigest(self, length: int, /) -> str: ...
|
||||
def update(self, data: ReadableBuffer, /) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
def new(name: str, data: ReadableBuffer = b"", *, usedforsecurity: bool = ...) -> _Hash: ...
|
||||
def md5(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash: ...
|
||||
@@ -70,6 +78,12 @@ if sys.version_info >= (3, 9):
|
||||
def sha256(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash: ...
|
||||
def sha384(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash: ...
|
||||
def sha512(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash: ...
|
||||
def sha3_224(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash: ...
|
||||
def sha3_256(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash: ...
|
||||
def sha3_384(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash: ...
|
||||
def sha3_512(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _Hash: ...
|
||||
def shake_128(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _VarLenHash: ...
|
||||
def shake_256(string: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> _VarLenHash: ...
|
||||
|
||||
else:
|
||||
def new(name: str, data: ReadableBuffer = b"") -> _Hash: ...
|
||||
@@ -79,6 +93,12 @@ else:
|
||||
def sha256(string: ReadableBuffer = b"") -> _Hash: ...
|
||||
def sha384(string: ReadableBuffer = b"") -> _Hash: ...
|
||||
def sha512(string: ReadableBuffer = b"") -> _Hash: ...
|
||||
def sha3_224(string: ReadableBuffer = b"") -> _Hash: ...
|
||||
def sha3_256(string: ReadableBuffer = b"") -> _Hash: ...
|
||||
def sha3_384(string: ReadableBuffer = b"") -> _Hash: ...
|
||||
def sha3_512(string: ReadableBuffer = b"") -> _Hash: ...
|
||||
def shake_128(string: ReadableBuffer = b"") -> _VarLenHash: ...
|
||||
def shake_256(string: ReadableBuffer = b"") -> _VarLenHash: ...
|
||||
|
||||
algorithms_guaranteed: AbstractSet[str]
|
||||
algorithms_available: AbstractSet[str]
|
||||
@@ -86,24 +106,6 @@ algorithms_available: AbstractSet[str]
|
||||
def pbkdf2_hmac(
|
||||
hash_name: str, password: ReadableBuffer, salt: ReadableBuffer, iterations: int, dklen: int | None = None
|
||||
) -> bytes: ...
|
||||
|
||||
class _VarLenHash:
|
||||
digest_size: int
|
||||
block_size: int
|
||||
name: str
|
||||
def __init__(self, data: ReadableBuffer = ...) -> None: ...
|
||||
def copy(self) -> _VarLenHash: ...
|
||||
def digest(self, length: int, /) -> bytes: ...
|
||||
def hexdigest(self, length: int, /) -> str: ...
|
||||
def update(self, data: ReadableBuffer, /) -> None: ...
|
||||
|
||||
sha3_224 = _Hash
|
||||
sha3_256 = _Hash
|
||||
sha3_384 = _Hash
|
||||
sha3_512 = _Hash
|
||||
shake_128 = _VarLenHash
|
||||
shake_256 = _VarLenHash
|
||||
|
||||
def scrypt(
|
||||
password: ReadableBuffer, *, salt: ReadableBuffer, n: int, r: int, p: int, maxmem: int = 0, dklen: int = 64
|
||||
) -> bytes: ...
|
||||
|
||||
Reference in New Issue
Block a user