* lib/mudpy/password.py: Python 3000 is deprecating xrange in favor of
an iterator-based range which will be effectively as efficient, so stop
using xrange in preparation for the transition.
import math
import random
salt = []
import math
import random
salt = []
- for i in xrange(int(math.ceil(salt_len * 0.75))):
+ for i in range(int(math.ceil(salt_len * 0.75))):
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]
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))
return "%s%s%s%s%s%s%s%s" % (
# this needs to become a byte() call in 2to3
collapsed += chr(int(legacy_hash[2 * i:2 * i + 2], 16))
return "%s%s%s%s%s%s%s%s" % (
# iterate the hashing algorithm over its own digest the specified
# number of times
# iterate the hashing algorithm over its own digest the specified
# number of times
- for i in xrange(2 ** rounds):
+ for i in range(2 ** rounds):
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