fix security.py typehints
This commit is contained in:
parent
cca3817537
commit
9d120dcd2c
1 changed files with 2 additions and 2 deletions
|
@ -26,9 +26,9 @@ def constant_time_compare(a: typing.AnyStr, b: typing.AnyStr) -> bool:
|
|||
return hmac.compare_digest(a, b)
|
||||
|
||||
import scrypt
|
||||
def password(byte_n: int=32):
|
||||
def password(byte_n: int=32) -> str:
|
||||
return binascii.hexlify(os.urandom(byte_n)).decode("utf8")
|
||||
def salt(byte_n: int=64) -> bytes:
|
||||
def salt(byte_n: int=64) -> str:
|
||||
return base64.b64encode(os.urandom(byte_n)).decode("utf8")
|
||||
def hash(given_salt: str, data: str):
|
||||
return base64.b64encode(scrypt.hash(data, given_salt)).decode("utf8")
|
||||
|
|
Loading…
Reference in a new issue