From e238b8bffea1296a3d0c292c616158dacd211bdd Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Wed, 14 Sep 2022 10:15:10 +0200 Subject: Fix ValueError on unsupported hashes in broken Python versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- gemato/hash.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gemato/hash.py b/gemato/hash.py index 8749bfa..e46ea75 100644 --- a/gemato/hash.py +++ b/gemato/hash.py @@ -39,7 +39,12 @@ def get_hash_by_name(name): # general hash support if name in hashlib.algorithms_available: - return hashlib.new(name) + try: + return hashlib.new(name) + except ValueError: + # some broken Python versions list unsupported algos + # in algorithms_available with OpenSSL-3 + pass raise UnsupportedHash(name) -- cgit v1.2.3