From ae964561752b38ebb8685cf1eb91a1f6141a3399 Mon Sep 17 00:00:00 2001 From: Brian Wellington Date: Mon, 11 May 2020 09:59:08 -0700 Subject: [PATCH] Fix nsec3_hash() with salt==None. The documentation claims that it supports salt==None, but it caused a TypeError. --- dns/dnssec.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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: -- 2.47.3