mirror of
https://github.com/solero/houdini.git
synced 2025-01-22 20:36:58 +00:00
Simplified crypto.py
Use secrets.token_hex for generating random keys.
This commit is contained in:
parent
96109b5b3c
commit
fb20faee2a
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user