From f6b286f19591caa32a5f912796ccdbea92018c0d Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Wed, 11 Jun 2025 15:32:28 -0400 Subject: [PATCH] makejson: Add SHA3, BLAKE2b, deprecate MD5 The MD5 hash algorithm has been deprecated industry-wide for many years now and we should stop using it. As a replacement, add SHA3 and BLAKE2b. We keep the MD5 hash for now but with a TODO to remove entirely it in a future release. --- scripts/makejson | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/scripts/makejson b/scripts/makejson index aa843b83..0179bc99 100755 --- a/scripts/makejson +++ b/scripts/makejson @@ -42,14 +42,15 @@ if json_file is None: sys.stderr.write("JSON file not specified!\n") sys.exit(1) -with open("wads/freedoom1.wad", "rb") as f: - iwads["freedoom1.wad"]["md5"] = hashlib.md5(f.read()).hexdigest() +for filename in iwads: + with open(os.path.join("wads", filename), "rb") as f: + data = f.read() + # TODO: MD5 is long-deprecated throughout the industry; this hash + # will be removed in a future version. + iwads[filename]["md5"] = hashlib.md5(data).hexdigest() + iwads[filename]["sha3"] = hashlib.sha3_512(data).hexdigest() + iwads[filename]["blake2b"] = hashlib.blake2b(data).hexdigest() -with open("wads/freedoom2.wad", "rb") as f: - iwads["freedoom2.wad"]["md5"] = hashlib.md5(f.read()).hexdigest() - -with open("wads/freedm.wad", "rb") as f: - iwads["freedm.wad"]["md5"] = hashlib.md5(f.read()).hexdigest() iwads["freedoom1.wad"]["url"] = ( "https://github.com/freedoom/freedoom/releases/download/v"