Merge pull request #4 from Zaseth/patch-1

Use secrets.token_hex instead of a loop
This commit is contained in:
Ben
2019-09-27 20:21:59 +01:00
committed by GitHub

View File

@@ -1,8 +1,5 @@
import hashlib
import secrets
import string
_alphabet = string.ascii_letters + string.digits
class Crypto:
@@ -15,7 +12,7 @@ class Crypto:
@staticmethod
def generate_random_key():
return ''.join(secrets.choice(_alphabet) for _ in range(16))
return secrets.token_hex(8)
@staticmethod
def encrypt_password(password, digest=True):