From: Brian Wellington Date: Mon, 11 May 2020 16:59:08 +0000 (-0700) Subject: Fix nsec3_hash() with salt==None. X-Git-Tag: v2.0.0rc1~225 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae964561752b38ebb8685cf1eb91a1f6141a3399;p=thirdparty%2Fdnspython.git Fix nsec3_hash() with salt==None. The documentation claims that it supports salt==None, but it caused a TypeError. --- diff --git a/dns/dnssec.py b/dns/dnssec.py index bf5ce1e8..0e3143d8 100644 --- a/dns/dnssec.py +++ b/dns/dnssec.py @@ -548,7 +548,9 @@ def nsec3_hash(domain, salt, iterations, algorithm): raise ValueError("Wrong hash algorithm (only SHA1 is supported)") salt_encoded = salt - if isinstance(salt, str): + if salt is None: + salt_encoded = b'' + elif isinstance(salt, str): if len(salt) % 2 == 0: salt_encoded = bytes.fromhex(salt) else: