Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def output_fingerprint(kex, pkm, sha256=True, padlen=0):
# type: (Optional[SSH2.Kex], Optional[SSH1.PublicKeyMessage], bool, int) -> None
with OutputBuffer() as obuf:
fps = []
if pkm is not None:
name = 'ssh-rsa1'
fp = SSH.Fingerprint(pkm.host_key_fingerprint_data)
bits = pkm.host_key_bits
fps.append((name, fp, bits))
for fpp in fps:
name, fp, bits = fpp
fpo = fp.sha256 if sha256 else fp.md5
p = '' if out.batch else ' ' * (padlen - len(name))
out.good('(fin) {0}{1} -- {2} {3}'.format(name, p, bits, fpo))
if len(obuf) > 0:
out.head('# fingerprints')
obuf.flush()
out.sep()