Fix mrpack index: include sha512 hashes (Prism import validator)

This commit is contained in:
ReaperOfVeriod
2026-08-20 19:46:44 +02:00
parent b70e8c774f
commit ef6f050dfe
2 changed files with 8 additions and 1 deletions
Binary file not shown.
+8 -1
View File
@@ -41,6 +41,13 @@ def sha1(path):
h.update(block)
return h.hexdigest()
def sha512(path):
h = hashlib.sha512()
with open(path, "rb") as f:
for block in iter(lambda: f.read(65536), b""):
h.update(block)
return h.hexdigest()
def resolve(sha):
url = f"https://api.modrinth.com/v2/version_file/{sha}?algorithm=sha1"
req = urllib.request.Request(url, headers={"User-Agent": USER_AGENT})
@@ -64,7 +71,7 @@ def main():
sys.exit(1)
files.append({
"path": "mods/" + fname,
"hashes": {"sha1": sha1(path)},
"hashes": {"sha1": sha1(path), "sha512": sha512(path)},
"env": {"client": "required", "server": "optional"},
"downloads": [url],
"fileSize": fsize,