kh2reg: stop using deprecated base64.decodestring.

Python 3 gave me a warning that I should have been using decodebytes
instead.
This commit is contained in:
Simon Tatham 2020-03-09 19:27:17 +00:00
Родитель 143f8a2d10
Коммит 1efded20a1
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -73,8 +73,8 @@ class HMAC(object):
def openssh_hashed_host_match(hashed_host, try_host):
if hashed_host.startswith(b'|1|'):
salt, expected = hashed_host[3:].split(b'|')
salt = base64.decodestring(salt)
expected = base64.decodestring(expected)
salt = base64.decodebytes(salt)
expected = base64.decodebytes(expected)
mac = HMAC(hashlib.sha1, 64)
else:
return False # unrecognised magic number prefix
@ -232,7 +232,7 @@ def handle_line(line, output_formatter, try_hosts):
# Treat as SSH-2-type host key.
# Format: hostpat keytype keyblob64 comment...
sshkeytype, blob = fields[1], base64.decodestring(
sshkeytype, blob = fields[1], base64.decodebytes(
fields[2].encode("ASCII"))
# 'blob' consists of a number of