From deb99ddcddce07fc808c1692e8128700d6285c87 Mon Sep 17 00:00:00 2001 From: Alex Burke Date: Mon, 7 Oct 2024 11:07:20 +0200 Subject: [PATCH] experiment with another name --- mig/shared/compat.py | 2 +- mig/shared/pwcrypto.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mig/shared/compat.py b/mig/shared/compat.py index 4ca6440f8..54711ece8 100644 --- a/mig/shared/compat.py +++ b/mig/shared/compat.py @@ -55,7 +55,7 @@ def _is_unicode(val): return (type(val) == _TYPE_UNICODE) -def encode_unicode_string(unicode_string): +def _unicode_string_to_utf8_bytes(unicode_string): """Convert a unicode string value to bytes.""" return codecs.encode(unicode_string, 'utf8') diff --git a/mig/shared/pwcrypto.py b/mig/shared/pwcrypto.py index 468f91565..1c2371318 100644 --- a/mig/shared/pwcrypto.py +++ b/mig/shared/pwcrypto.py @@ -44,7 +44,7 @@ import time from mig.shared.base import force_utf8, mask_creds, string_snippet -from mig.shared.compat import encode_unicode_string +from mig.shared.compat import _unicode_string_to_utf8_bytes from mig.shared.defaults import keyword_auto, RESET_TOKEN_TTL @@ -119,7 +119,7 @@ def best_crypt_salt(configuration): def make_hash(password, _urandom=urandom): """Generate a random salt and return a new hash for the password.""" salt = b64encode(_urandom(SALT_LENGTH)) - password_bytes = encode_unicode_string(password) + password_bytes = _unicode_string_to_utf8_bytes(password) password_hashed = hashlib.pbkdf2_hmac(HASH_FUNCTION, password_bytes, salt, COST_FACTOR, KEY_LENGTH)