Skip to content

Commit 1efded2

Browse files
committed
kh2reg: stop using deprecated base64.decodestring.
Python 3 gave me a warning that I should have been using decodebytes instead.
1 parent 143f8a2 commit 1efded2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

contrib/kh2reg.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ def compute(self, key, string):
7373
def openssh_hashed_host_match(hashed_host, try_host):
7474
if hashed_host.startswith(b'|1|'):
7575
salt, expected = hashed_host[3:].split(b'|')
76-
salt = base64.decodestring(salt)
77-
expected = base64.decodestring(expected)
76+
salt = base64.decodebytes(salt)
77+
expected = base64.decodebytes(expected)
7878
mac = HMAC(hashlib.sha1, 64)
7979
else:
8080
return False # unrecognised magic number prefix
@@ -232,7 +232,7 @@ def handle_line(line, output_formatter, try_hosts):
232232

233233
# Treat as SSH-2-type host key.
234234
# Format: hostpat keytype keyblob64 comment...
235-
sshkeytype, blob = fields[1], base64.decodestring(
235+
sshkeytype, blob = fields[1], base64.decodebytes(
236236
fields[2].encode("ASCII"))
237237

238238
# 'blob' consists of a number of

0 commit comments

Comments
 (0)