diff options
author | Scott Maxwell <scott@codecobblers.com> | 2013-10-30 17:14:52 -0700 |
---|---|---|
committer | Scott Maxwell <scott@codecobblers.com> | 2013-10-30 17:14:52 -0700 |
commit | 0b7d0cf0a23e4f16f8552ae05a66539119e2e920 (patch) | |
tree | 2ba26a535dceb8b2684adedae99fdbc4c77b3a67 /paramiko/primes.py | |
parent | 2d738fa08b85c5065cc898d5f9e4d36ee753e871 (diff) | |
download | paramiko-0b7d0cf0a23e4f16f8552ae05a66539119e2e920.tar.gz |
Convert and detect types properly, use helper constants, use StringIO and range
Diffstat (limited to 'paramiko/primes.py')
-rw-r--r-- | paramiko/primes.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/paramiko/primes.py b/paramiko/primes.py index 1dd87daf..144454aa 100644 --- a/paramiko/primes.py +++ b/paramiko/primes.py @@ -34,7 +34,7 @@ def _generate_prime(bits, rng): # loop catches the case where we increment n into a higher bit-range x = rng.read((bits+7) // 8) if hbyte_mask > 0: - x = chr(ord(x[0]) & hbyte_mask) + x[1:] + x = byte_mask(x[0], hbyte_mask) + x[1:] n = util.inflate_long(x, 1) n |= 1 n |= (1 << (bits - 1)) @@ -59,7 +59,7 @@ def _roll_random(rng, n): while True: x = rng.read(byte_count) if hbyte_mask > 0: - x = chr(ord(x[0]) & hbyte_mask) + x[1:] + x = byte_mask(x[0], hbyte_mask) + x[1:] num = util.inflate_long(x, 1) if num < n: break |