mirror of
https://github.com/evennia/evennia.git
synced 2026-04-02 22:17:17 +02:00
Correct hashlib calls
This commit is contained in:
parent
6546ad8651
commit
f23f107b33
3 changed files with 5 additions and 5 deletions
|
|
@ -922,7 +922,7 @@ class CmdIRC2Chan(COMMAND_DEFAULT_CLASS):
|
|||
self.msg("Account '%s' already exists and is not a bot." % botname)
|
||||
return
|
||||
else:
|
||||
password = hashlib.md5(str(time.time())).hexdigest()[:11]
|
||||
password = hashlib.md5(bytes(str(time.time()), 'utf-8')).hexdigest()[:11]
|
||||
try:
|
||||
bot = create.create_account(botname, None, password, typeclass=botclass)
|
||||
except Exception as err:
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ def homogenize_prototype(prototype, custom_keys=None):
|
|||
if "prototype_key" not in prototype:
|
||||
# assign a random hash as key
|
||||
homogenized["prototype_key"] = "prototype-{}".format(
|
||||
hashlib.md5(str(time.time())).hexdigest()[:7])
|
||||
hashlib.md5(bytes(str(time.time()), 'utf-8')).hexdigest()[:7])
|
||||
|
||||
if "typeclass" not in prototype and "prototype_parent" not in prototype:
|
||||
homogenized["typeclass"] = settings.BASE_OBJECT_TYPECLASS
|
||||
|
|
|
|||
|
|
@ -230,14 +230,14 @@ def prototype_from_object(obj):
|
|||
# no unambiguous prototype found - build new prototype
|
||||
prot = {}
|
||||
prot['prototype_key'] = "From-Object-{}-{}".format(
|
||||
obj.key, hashlib.md5(str(time.time())).hexdigest()[:7])
|
||||
obj.key, hashlib.md5(bytes(str(time.time()), 'utf-8')).hexdigest()[:7])
|
||||
prot['prototype_desc'] = "Built from {}".format(str(obj))
|
||||
prot['prototype_locks'] = "spawn:all();edit:all()"
|
||||
prot['prototype_tags'] = []
|
||||
else:
|
||||
prot = prot[0]
|
||||
|
||||
prot['key'] = obj.db_key or hashlib.md5(str(time.time())).hexdigest()[:6]
|
||||
prot['key'] = obj.db_key or hashlib.md5(bytes(str(time.time()), 'utf-8')).hexdigest()[:6]
|
||||
prot['typeclass'] = obj.db_typeclass_path
|
||||
|
||||
location = obj.db_location
|
||||
|
|
@ -690,7 +690,7 @@ def spawn(*prototypes, **kwargs):
|
|||
# we must always add a key, so if not given we use a shortened md5 hash. There is a (small)
|
||||
# chance this is not unique but it should usually not be a problem.
|
||||
val = prot.pop("key", "Spawned-{}".format(
|
||||
hashlib.md5(str(time.time())).hexdigest()[:6]))
|
||||
hashlib.md5(bytes(str(time.time()), 'utf-8')).hexdigest()[:6]))
|
||||
create_kwargs["db_key"] = init_spawn_value(val, str)
|
||||
|
||||
val = prot.pop("location", None)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue