diff options
author | Sigmund Augdal <sigmund.augdal@uninett.no> | 2014-02-22 15:52:53 +0100 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2014-08-25 22:50:09 -0700 |
commit | 16b820aede0d3050bc8c96ab59f0aa9a79bebcdb (patch) | |
tree | 78cf3c76e6ac28a1962f6a67721e6a280b508f63 | |
parent | 12e752d11aa22ee6ba959115725e386ca779c1cb (diff) |
Don't hash the input hostname when checking a host key if the input hostname is already hashed
This happens in the loop checking if a hostkey is already loaded when
loading host key files. This reduces time to load host keys file with
about two seconds for me
-rw-r--r-- | paramiko/hostkeys.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/paramiko/hostkeys.py b/paramiko/hostkeys.py index f32fbeb6..7c6a5aa5 100644 --- a/paramiko/hostkeys.py +++ b/paramiko/hostkeys.py @@ -176,7 +176,7 @@ class HostKeys (MutableMapping): entries = [] for e in self._entries: for h in e.hostnames: - if h.startswith('|1|') and constant_time_bytes_eq(self.hash_host(hostname, h), h) or h == hostname: + if h.startswith('|1|') and not hostname.startswith('|1|') and constant_time_bytes_eq(self.hash_host(hostname, h), h) or h == hostname: entries.append(e) if len(entries) == 0: return None |