From 4f481a57a291316e75b0ce0b5f159e66b49ffe3a Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 12 Oct 2012 09:36:42 +0200 Subject: [PATCH] Store hostname hashes in memory rathen than the non-hashed host entries. Also assures that the host entries in known_hosts get saved in hashed format as it is currently standard in OpenSSH. --- paramiko/hostkeys.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/paramiko/hostkeys.py b/paramiko/hostkeys.py index e739312..da5b66c 100644 --- a/paramiko/hostkeys.py +++ b/paramiko/hostkeys.py @@ -141,6 +141,8 @@ class HostKeys (UserDict.DictMixin): if (hostname in e.hostnames) and (e.key.get_name() == keytype): e.key = key return + if not hostname.startswith('|1|') and hash_hostname: + hostname = self.hash_host(hostname) self._entries.append(HostKeyEntry([hostname], key)) def load(self, filename):