diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2015-11-01 15:48:44 -0800 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2015-11-01 15:48:44 -0800 |
commit | aeb28073e95557122d7325f7addac9eca7b07e7f (patch) | |
tree | 1f9908c08fb0fa6ed29b4e17574a610595db4fdd | |
parent | 9b745412a9b36dffe3ba5ad7304e202a500e77fb (diff) |
Fallback to sha1 in _compute_key
-rw-r--r-- | paramiko/transport.py | 4 |
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() |