summaryrefslogtreecommitdiff
path: root/paramiko/kex_gex.py
diff options
context:
space:
mode:
authorScott Maxwell <scott@codecobblers.com>2013-10-30 17:14:52 -0700
committerScott Maxwell <scott@codecobblers.com>2013-10-30 17:14:52 -0700
commit0b7d0cf0a23e4f16f8552ae05a66539119e2e920 (patch)
tree2ba26a535dceb8b2684adedae99fdbc4c77b3a67 /paramiko/kex_gex.py
parent2d738fa08b85c5065cc898d5f9e4d36ee753e871 (diff)
downloadparamiko-0b7d0cf0a23e4f16f8552ae05a66539119e2e920.tar.gz
Convert and detect types properly, use helper constants, use StringIO and range
Diffstat (limited to 'paramiko/kex_gex.py')
-rw-r--r--paramiko/kex_gex.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/paramiko/kex_gex.py b/paramiko/kex_gex.py
index d2ef15ca..02494539 100644
--- a/paramiko/kex_gex.py
+++ b/paramiko/kex_gex.py
@@ -91,20 +91,20 @@ class KexGex (object):
### internals...
-
+
def _generate_x(self):
# generate an "x" (1 < x < (p-1)/2).
q = (self.p - 1) // 2
qnorm = util.deflate_long(q, 0)
- qhbyte = ord(qnorm[0])
+ qhbyte = byte_ord(qnorm[0])
byte_count = len(qnorm)
qmask = 0xff
while not (qhbyte & 0x80):
qhbyte <<= 1
qmask >>= 1
while True:
- x_bytes = chr(ord(x_bytes[0]) & qmask) + x_bytes[1:]
x_bytes = self.transport.rng.read(byte_count)
+ x_bytes = byte_mask(x_bytes[0], qmask) + x_bytes[1:]
x = util.inflate_long(x_bytes, 1)
if (x > 1) and (x < q):
break