diff options
-rw-r--r-- | filter_plugins/passwd.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/filter_plugins/passwd.py b/filter_plugins/passwd.py index 40536f4..f73a5ac 100644 --- a/filter_plugins/passwd.py +++ b/filter_plugins/passwd.py @@ -19,7 +19,7 @@ def cryptpass(p): hashtype = "$6$" saltlen = 16 salt = os.urandom(saltlen) - salt = base64.b64encode(salt)[:saltlen] + salt = base64.b64encode(salt)[:saltlen].decode("utf-8") return crypt.crypt(p, hashtype+salt) @@ -46,9 +46,9 @@ def znc_makepass(p, method="sha256", saltlen=20): ZNC password format: <method>#<hash>#<salt> """ salt = os.urandom(saltlen) - salt = base64.b64encode(salt)[:saltlen] + salt = base64.b64encode(salt)[:saltlen].decode("utf-8") s = p + salt - h = getattr(hashlib, method)(s) + h = getattr(hashlib, method)(s.encode("utf-8")) return "%s#%s#%s" % (method, h.hexdigest(), salt) |