25 def hashCacheName(name: str, suffix: str) -> str:
26 if MAX_NAME_LENGTH - len(name) < 8:
27 raise ValueError(
">> [Coretex] Failed to cache dataset. Dataset name too long")
29 suffixByteHash = hashlib.md5(suffix.encode()).digest()
30 suffixHash = base64.b64encode(suffixByteHash)
31 cacheName = name +
"-" + suffixHash.decode(
"ascii")
32 cacheName = cacheName.lower()
33 cacheName = cacheName.replace(
"+",
"0")
34 cacheName = cacheName.replace(
"/",
"0")
35 cacheName = cacheName.replace(
"=",
"0")
37 return cacheName[:MAX_NAME_LENGTH]
if len(cacheName) > MAX_NAME_LENGTH
else cacheName