mirror of
https://github.com/solero/houdini.git
synced 2025-09-03 22:08:38 +00:00
Merge pull request #4 from Zaseth/patch-1
Use secrets.token_hex instead of a loop
This commit is contained in:
@@ -1,8 +1,5 @@
|
|||||||
import hashlib
|
import hashlib
|
||||||
import secrets
|
import secrets
|
||||||
import string
|
|
||||||
|
|
||||||
_alphabet = string.ascii_letters + string.digits
|
|
||||||
|
|
||||||
|
|
||||||
class Crypto:
|
class Crypto:
|
||||||
@@ -15,7 +12,7 @@ class Crypto:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def generate_random_key():
|
def generate_random_key():
|
||||||
return ''.join(secrets.choice(_alphabet) for _ in range(16))
|
return secrets.token_hex(8)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def encrypt_password(password, digest=True):
|
def encrypt_password(password, digest=True):
|
||||||
|
Reference in New Issue
Block a user