summaryrefslogtreecommitdiffhomepage
path: root/paramiko/transport.py
diff options
context:
space:
mode:
Diffstat (limited to 'paramiko/transport.py')
-rw-r--r--paramiko/transport.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/paramiko/transport.py b/paramiko/transport.py
index d2fccf07..98b810ee 100644
--- a/paramiko/transport.py
+++ b/paramiko/transport.py
@@ -1534,7 +1534,9 @@ class Transport (threading.Thread, ClosingContextManager):
m.add_bytes(self.H)
m.add_byte(b(id))
m.add_bytes(self.session_id)
- hash_algo = self.kex_engine.hash_algo
+ # Fallback to SHA1 for kex engines that fail to specify a hex
+ # algorithm, or for e.g. transport tests that don't run kexinit.
+ hash_algo = getattr(self.kex_engine, 'hex_algo', sha1)
out = sofar = hash_algo(m.asbytes()).digest()
while len(out) < nbytes:
m = Message()