diff --git a/game/scripts/doll/body.rpy b/game/scripts/doll/body.rpy index 07c509c4..e03829cd 100644 --- a/game/scripts/doll/body.rpy +++ b/game/scripts/doll/body.rpy @@ -23,7 +23,7 @@ init python: def generate_hash(self): bodyparts_hash = str([x[0]._hash for x in self.char.states.values() if istype(x[0], DollBodypart) and x[2]]) salt = str( [self.char.name, self.char.pose, str(self.matrix.__hash__()), bodyparts_hash]) - return hash(salt) + return hashstring(salt) @functools.cache def get_layers(self, hash): diff --git a/game/scripts/doll/bodypart.rpy b/game/scripts/doll/bodypart.rpy index fccf8b98..deeec2ed 100644 --- a/game/scripts/doll/bodypart.rpy +++ b/game/scripts/doll/bodypart.rpy @@ -16,7 +16,7 @@ init 1 python: def generate_hash(self): salt = str( [self.name, self.type, self.char.pose, self.id, str(self.char.body._hash)] ) - return hash(salt) + return hashstring(salt) @functools.cache def get_layers(self, hash, subpath=""): diff --git a/game/scripts/doll/clothes.rpy b/game/scripts/doll/clothes.rpy index 1d4fbc08..24403d80 100644 --- a/game/scripts/doll/clothes.rpy +++ b/game/scripts/doll/clothes.rpy @@ -67,7 +67,7 @@ init python: def generate_hash(self): salt = str( [self.name, self.char.pose, self.type, self.id, str(self.color), str(self.char.body._hash)] ) - return hash(salt) + return hashstring(salt) @functools.cache # <- TODO: Reevaluate if this function should allow multiple caches (aside from different subpaths) def get_layers(self, hash, subpath=""): diff --git a/game/scripts/doll/clothes_dynamic.rpy b/game/scripts/doll/clothes_dynamic.rpy index 4b9c24f6..9b800cc4 100644 --- a/game/scripts/doll/clothes_dynamic.rpy +++ b/game/scripts/doll/clothes_dynamic.rpy @@ -30,7 +30,7 @@ init python: tracking_object = self.tracking_object tracking_hash = str(tracking_object._hash) if tracking_object else "default" salt = str( [self.name, self.char.pose, self.type, self.id, str(self.color), str(self.char.body._hash)] ) + tracking_hash - return hash(salt) + return hashstring(salt) @functools.cache def get_layers(self, hash, subpath="", _ignore_equipped=False): diff --git a/game/scripts/doll/cum.rpy b/game/scripts/doll/cum.rpy index 5e1c1561..91ed8a8b 100644 --- a/game/scripts/doll/cum.rpy +++ b/game/scripts/doll/cum.rpy @@ -21,7 +21,7 @@ init python: def generate_hash(self): salt = str( [self.char.name, self.char.pose, str(self.char.face._hash), str(self.char.face._hash), str([x[0]._hash for x in self.char.states.values() if x[0] and x[2]]), sorted(list(self._cum.items()))] ) - return hash(salt) + return hashstring(salt) def set_cum(self, *args, **kwargs): if args: diff --git a/game/scripts/doll/face.rpy b/game/scripts/doll/face.rpy index 2befdd73..668a6124 100644 --- a/game/scripts/doll/face.rpy +++ b/game/scripts/doll/face.rpy @@ -25,7 +25,7 @@ init python: def generate_hash(self): salt = str( [self.char.name, self.char.pose, str(self.char.body._hash), sorted(list(self._face.items()))] ) - return hash(salt) + return hashstring(salt) @functools.cache def get_layers(self, hash, subpath=""): diff --git a/game/scripts/doll/main.rpy b/game/scripts/doll/main.rpy index a8ee4af9..4179b051 100644 --- a/game/scripts/doll/main.rpy +++ b/game/scripts/doll/main.rpy @@ -86,7 +86,7 @@ init python: def generate_hash(self): clothes_hash = str([x[0]._hash for x in self.states.values() if istype(x[0], (DollCloth, DollClothDynamic, DollMakeup)) and x[2]]) salt = str( [self.name, self.pose, str(self.body._hash), str(self.face._hash), str(self.cum._hash), clothes_hash] ) - return hash(salt) + return hashstring(salt) def show(self, force=False, ignore_skipping=False): if renpy.get_screen(("wardrobe", "animatedCG", "studio")) or renpy.showing("cg"): diff --git a/game/scripts/doll/makeup.rpy b/game/scripts/doll/makeup.rpy index 041e8199..a716a3ff 100644 --- a/game/scripts/doll/makeup.rpy +++ b/game/scripts/doll/makeup.rpy @@ -10,7 +10,7 @@ init python: def generate_hash(self): salt = str( [self.name, self.type, self.char.pose, self.id, str(self.color), str(self.char.face._hash), str(self.char.body._hash)] ) - return hash(salt) + return hashstring(salt) @functools.cache def get_layers(self, hash, subpath=""): diff --git a/game/scripts/doll/outfits.rpy b/game/scripts/doll/outfits.rpy index d6e6313c..51b28b86 100644 --- a/game/scripts/doll/outfits.rpy +++ b/game/scripts/doll/outfits.rpy @@ -38,7 +38,7 @@ init python: def generate_hash(self): salt = str( [x._hash for x in self.group] ) + str(self.schedule) - return hash(salt) + return hashstring(salt) def delete(self): if self in self.char.outfits: diff --git a/game/scripts/rooms/init.rpy b/game/scripts/rooms/init.rpy index b9e81ffc..8b5ccf8d 100644 --- a/game/scripts/rooms/init.rpy +++ b/game/scripts/rooms/init.rpy @@ -51,7 +51,7 @@ init -1 python: self.action, self.hovered, self.unhovered, self.tooltip, self.decoration, self.zorder, self.hidden, self.overlay] ) - return hash(salt) + return hashstring(salt) def set_image(self, idle, hover=None): self.idle = idle diff --git a/game/scripts/utility/common_functions.rpy b/game/scripts/utility/common_functions.rpy index e2dec0aa..a8f77bf7 100644 --- a/game/scripts/utility/common_functions.rpy +++ b/game/scripts/utility/common_functions.rpy @@ -10,11 +10,15 @@ init python early: import re import functools import timeit as timeit_module + import hashlib from operator import itemgetter from collections import OrderedDict get_volume_preference = renpy.game.preferences.get_volume + def hashstring(input_string): + return int(hashlib.md5(input_string.encode("utf-8")).hexdigest(), 16) + def num_to_word(n, readable=True): """Transcript numbers (integers) into readable words.""" n = int(n)