mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
* md5.md5(string) * switch md5 from str to AnyStr, add missing constants * add missing import * digest() and hexdigest() never return unicode * make md5.md5 an alias of, and fix, hashlib_hash * remove unnecessary import * fix duplicate block_size * md5.md5 and md5.new are aliases for hashlib.md5
32 lines
1.0 KiB
Python
32 lines
1.0 KiB
Python
# Stubs for hashlib (Python 2)
|
|
|
|
from typing import Tuple, Union
|
|
|
|
_DataType = Union[str, unicode, bytearray, buffer, memoryview]
|
|
|
|
class _hash(object): # This is not actually in the module namespace.
|
|
name = ... # type: str
|
|
block_size = 0
|
|
digest_size = 0
|
|
digestsize = 0
|
|
def __init__(self, arg: _DataType = ...) -> None: ...
|
|
def update(self, arg: _DataType) -> None: ...
|
|
def digest(self) -> str: ...
|
|
def hexdigest(self) -> str: ...
|
|
def copy(self) -> _hash: ...
|
|
|
|
def new(name: str, data: str = ...) -> _hash: ...
|
|
|
|
def md5(s: _DataType = ...) -> _hash: ...
|
|
def sha1(s: _DataType = ...) -> _hash: ...
|
|
def sha224(s: _DataType = ...) -> _hash: ...
|
|
def sha256(s: _DataType = ...) -> _hash: ...
|
|
def sha384(s: _DataType = ...) -> _hash: ...
|
|
def sha512(s: _DataType = ...) -> _hash: ...
|
|
|
|
algorithms = ... # type: Tuple[str, ...]
|
|
algorithms_guaranteed = ... # type: Tuple[str, ...]
|
|
algorithms_available = ... # type: Tuple[str, ...]
|
|
|
|
def pbkdf2_hmac(name: str, password: str, salt: str, rounds: int, dklen: int = ...) -> str: ...
|