summaryrefslogtreecommitdiff
path: root/paramiko/kex_group1.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-03-29 16:55:01 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2014-03-29 16:55:01 -0700
commit4d3e0b711a98c440810004cb599a00d0f72978d7 (patch)
treec3d0f0912f496a53dc2fd74e06c69da936b5d8e3 /paramiko/kex_group1.py
parent5a430def22aa5cbd755f347c8714e4140d6cdcab (diff)
downloadparamiko-4d3e0b711a98c440810004cb599a00d0f72978d7.tar.gz
Switched hash functions from PyCrypto to hashlib.
There's a few advantages to this: 1) It's probably fast, OpenSSL, which typically backs hashlib, receives far more attention for optimizaitons than PyCrypto. 2) It's the first step to supporting PyPy, where PyCrypto doesn't run.
Diffstat (limited to 'paramiko/kex_group1.py')
-rw-r--r--paramiko/kex_group1.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/paramiko/kex_group1.py b/paramiko/kex_group1.py
index 3dfb7f18..f792eff0 100644
--- a/paramiko/kex_group1.py
+++ b/paramiko/kex_group1.py
@@ -21,7 +21,7 @@ Standard SSH key exchange ("kex" if you wanna sound cool). Diffie-Hellman of
1024 bit key halves, using a known "p" prime and "g" generator.
"""
-from Crypto.Hash import SHA
+from hashlib import sha1
from paramiko import util
from paramiko.common import max_byte, zero_byte
@@ -105,7 +105,7 @@ class KexGroup1(object):
hm.add_mpint(self.e)
hm.add_mpint(self.f)
hm.add_mpint(K)
- self.transport._set_K_H(K, SHA.new(hm.asbytes()).digest())
+ self.transport._set_K_H(K, sha1(hm.asbytes()).digest())
self.transport._verify_key(host_key, sig)
self.transport._activate_outbound()
@@ -124,7 +124,7 @@ class KexGroup1(object):
hm.add_mpint(self.e)
hm.add_mpint(self.f)
hm.add_mpint(K)
- H = SHA.new(hm.asbytes()).digest()
+ H = sha1(hm.asbytes()).digest()
self.transport._set_K_H(K, H)
# sign it
sig = self.transport.get_server_key().sign_ssh_data(self.transport.rng, H)