Minor optimization in HashDB

This commit is contained in:
Miroslav Stampar
2025-12-30 13:25:00 +01:00
parent ea622b829f
commit 63cecb6480
4 changed files with 8 additions and 7 deletions

View File

@@ -56,7 +56,7 @@ def cachedmethod(f):
"^".join("%s=%r" % (k, kwargs[k]) for k in sorted(kwargs))
)
try:
key = struct.unpack(">Q", hashlib.md5("`".join(parts).encode(UNICODE_ENCODING)).digest()[:8])[0] & 0x7fffffffffffffff
key = struct.unpack("<Q", hashlib.md5("`".join(parts).encode(UNICODE_ENCODING)).digest()[:8])[0] & 0x7fffffffffffffff
except (struct.error, ValueError):
return f(*args, **kwargs)