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]
legacy_hash), "Not a valid MD5 hexdigest"
# this needs to be declared as b"" in 2to3
collapsed = ""
- for i in xrange(16):
+ for i in range(16):
# 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
- 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