44 lines
761 B
Python
Raw Normal View History

2022-11-18 19:11:48 +08:00
import _hashlib
def new(mode: str) -> _hashlib.Hash:
hash = _hashlib.Hash()
hash.new(mode)
return hash
2022-11-18 22:12:23 +08:00
def md5(data = None) -> _hashlib.Hash:
2022-11-18 19:11:48 +08:00
hash = _hashlib.Hash()
hash.md5(data)
return hash
2022-11-18 22:12:23 +08:00
def sha1(data = None) -> _hashlib.Hash:
2022-11-18 19:11:48 +08:00
hash = _hashlib.Hash()
hash.sha1(data)
return hash
2022-11-18 22:12:23 +08:00
def sha224(data = None) -> _hashlib.Hash:
2022-11-18 19:11:48 +08:00
hash = _hashlib.Hash()
hash.sha224(data)
return hash
2022-11-18 22:12:23 +08:00
def sha256(data = None) -> _hashlib.Hash:
2022-11-18 19:11:48 +08:00
hash = _hashlib.Hash()
hash.sha256(data)
return hash
2022-11-18 22:12:23 +08:00
def sha384(data = None) -> _hashlib.Hash:
2022-11-18 19:11:48 +08:00
hash = _hashlib.Hash()
hash.sha384(data)
return hash
2022-11-18 22:12:23 +08:00
def sha512(data = None) -> _hashlib.Hash:
2022-11-18 19:11:48 +08:00
hash = _hashlib.Hash()
hash.sha512(data)
return hash