From 7f50e2c6e52219bb11cdd8def71f199303c8f104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Witanowski?= Date: Fri, 16 Feb 2024 01:30:01 +0100 Subject: [PATCH] Fix case sensitivity when comparing SHA hashes (#191) --- Client/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Client/utils.py b/Client/utils.py index 3900ac0..bd04a89 100644 --- a/Client/utils.py +++ b/Client/utils.py @@ -233,7 +233,7 @@ def download_opening_book(book_sha, book_source, book_name): print ('Download %s\n' % (sha256.upper())) # We have to have the correct SHA to continue - if book_sha != sha256: + if book_sha.upper() != sha256.upper(): os.remove(book_path) raise OpenBenchCorruptedBookException('Invalid sha for %s' % (book_name)) @@ -262,9 +262,10 @@ def download_network(server, username, password, engine, net_name, net_sha, net_ sha256 = hashlib.sha256(network.read()).hexdigest()[:8].upper() # Verify the download and delete partial or corrupted ones + net_sha = net_sha.upper() if net_sha != sha256: os.remove(net_path) - raise OpenBenchCorruptedNetworkException('Invalid SHA for %s' % (network_sha)) + raise OpenBenchCorruptedNetworkException('Invalid SHA for %s' % (net_sha)) def download_public_engine(engine, net_path, branch, source, make_path, out_path, compiler=None):