summaryrefslogtreecommitdiff
path: root/paramiko/kex_group1.py
diff options
context:
space:
mode:
authorScott Maxwell <scott@codecobblers.com>2014-03-07 20:45:26 -0800
committerScott Maxwell <scott@codecobblers.com>2014-03-07 20:45:26 -0800
commitf0017b83309899bf6fffc0fa90093c36f1a7f7ea (patch)
tree582d35dee4b32f022bddc2245731a76112f7ac8e /paramiko/kex_group1.py
parent073c71a8223ff77cacd8c555ef63ce24f0c3d50c (diff)
downloadparamiko-f0017b83309899bf6fffc0fa90093c36f1a7f7ea.tar.gz
Fix import * and a bunch of PEP8 formatting
Diffstat (limited to 'paramiko/kex_group1.py')
-rw-r--r--paramiko/kex_group1.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/paramiko/kex_group1.py b/paramiko/kex_group1.py
index 05693a1f..3dfb7f18 100644
--- a/paramiko/kex_group1.py
+++ b/paramiko/kex_group1.py
@@ -23,9 +23,10 @@ Standard SSH key exchange ("kex" if you wanna sound cool). Diffie-Hellman of
from Crypto.Hash import SHA
-from paramiko.common import *
from paramiko import util
+from paramiko.common import max_byte, zero_byte
from paramiko.message import Message
+from paramiko.py3compat import byte_chr, long, byte_mask
from paramiko.ssh_exception import SSHException
@@ -39,6 +40,7 @@ G = 2
b7fffffffffffffff = byte_chr(0x7f) + max_byte * 7
b0000000000000000 = zero_byte * 8
+
class KexGroup1(object):
name = 'diffie-hellman-group1-sha1'
@@ -71,10 +73,8 @@ class KexGroup1(object):
return self._parse_kexdh_reply(m)
raise SSHException('KexGroup1 asked to handle packet type %d' % ptype)
-
### internals...
-
def _generate_x(self):
# generate an "x" (1 < x < q), where q is (p-1)/2.
# p is a 128-byte (1024-bit) number, where the first 64 bits are 1.
@@ -84,8 +84,8 @@ class KexGroup1(object):
while 1:
x_bytes = self.transport.rng.read(128)
x_bytes = byte_mask(x_bytes[0], 0x7f) + x_bytes[1:]
- if (x_bytes[:8] != b7fffffffffffffff) and \
- (x_bytes[:8] != b0000000000000000):
+ if (x_bytes[:8] != b7fffffffffffffff and
+ x_bytes[:8] != b0000000000000000):
break
self.x = util.inflate_long(x_bytes)