Hex-encode master passwords, instead of b64, to avoid "strange" chars
This commit is contained in:
parent
480bbb604f
commit
0e6bcb5af0
1 changed files with 4 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
||||||
#--depends-on commands
|
#--depends-on commands
|
||||||
#--depends-on config
|
#--depends-on config
|
||||||
|
|
||||||
import base64, os
|
import base64, binascii, os
|
||||||
import scrypt
|
import scrypt
|
||||||
from src import ModuleManager, utils
|
from src import ModuleManager, utils
|
||||||
|
|
||||||
|
@ -52,12 +52,12 @@ class Module(ModuleManager.BaseModule):
|
||||||
return hash, salt
|
return hash, salt
|
||||||
|
|
||||||
def _random_string(self, n):
|
def _random_string(self, n):
|
||||||
return base64.b64encode(os.urandom(n)).decode("utf8")
|
|
||||||
|
|
||||||
def _make_salt(self):
|
def _make_salt(self):
|
||||||
return self._random_string(64)
|
return base64.b64encode(os.urandom(64)).decode("utf8")
|
||||||
|
|
||||||
def _random_password(self):
|
def _random_password(self):
|
||||||
return self._random_string(32)
|
return binascii.hexlify(os.urandom(32)).decode("utf8")
|
||||||
|
|
||||||
def _make_hash(self, password, salt=None):
|
def _make_hash(self, password, salt=None):
|
||||||
salt = salt or self._make_salt()
|
salt = salt or self._make_salt()
|
||||||
|
|
Loading…
Reference in a new issue