# to use, copy, modify, and distribute this software is granted under
# terms provided in the LICENSE file distributed with this software.
# to use, copy, modify, and distribute this software is granted under
# terms provided in the LICENSE file distributed with this software.
salt.append(random.randint(0, 255))
return _bytes_to_text(_pack_bytes(salt))[:salt_len]
salt.append(random.randint(0, 255))
return _bytes_to_text(_pack_bytes(salt))[:salt_len]
"""
This utility function is meant to provide a migration path for users
of mudpy's legacy account-name-salted MD5 hexdigest password hashes.
"""
This utility function is meant to provide a migration path for users
of mudpy's legacy account-name-salted MD5 hexdigest password hashes.
legacy_hash), "Not a valid MD5 hexdigest"
# this needs to be declared as b"" in 2to3
collapsed = ""
legacy_hash), "Not a valid MD5 hexdigest"
# this needs to be declared as b"" in 2to3
collapsed = ""
# this needs to become a byte() call in 2to3
collapsed += chr(int(legacy_hash[2 * i:2 * i + 2], 16))
# this needs to become a byte() call in 2to3
collapsed += chr(int(legacy_hash[2 * i:2 * i + 2], 16))
hashed = algorithms[algorithm](hashed).digest()
# concatenate the output fields, coercing into text form as needed
hashed = algorithms[algorithm](hashed).digest()
# concatenate the output fields, coercing into text form as needed
sep, algorithm, sep, rounds, sep, salt, sep, _bytes_to_text(hashed)
)
sep, algorithm, sep, rounds, sep, salt, sep, _bytes_to_text(hashed)
)
- algorithm, rounds, salt, hashed = encoded_hash[1:].split(sep)
+ import mudpy.misc
+ algorithm, rounds, salt, hashed = encoded_hash.split(sep)[1:]