Skip to content

Commit

Permalink
experiment with another name
Browse files Browse the repository at this point in the history
  • Loading branch information
albu-diku committed Oct 7, 2024
1 parent 49bbb54 commit deb99dd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mig/shared/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
4 changes: 2 additions & 2 deletions mig/shared/pwcrypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit deb99dd

Please sign in to comment.