summaryrefslogtreecommitdiff
path: root/paramiko/primes.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-03-29 17:17:20 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2014-03-29 17:17:20 -0700
commit23528069ec2d14464c8cb5754cca8e039692f255 (patch)
treea3a6a7c0bc4a9c5dc2bf4c0c497900afad723717 /paramiko/primes.py
parent5a430def22aa5cbd755f347c8714e4140d6cdcab (diff)
downloadparamiko-23528069ec2d14464c8cb5754cca8e039692f255.tar.gz
Remove unused function
Diffstat (limited to 'paramiko/primes.py')
-rw-r--r--paramiko/primes.py20
1 files changed, 0 insertions, 20 deletions
diff --git a/paramiko/primes.py b/paramiko/primes.py
index 58d158c8..5279b1a5 100644
--- a/paramiko/primes.py
+++ b/paramiko/primes.py
@@ -20,31 +20,11 @@
Utility functions for dealing with primes.
"""
-from Crypto.Util import number
-
from paramiko import util
from paramiko.py3compat import byte_mask, long
from paramiko.ssh_exception import SSHException
-def _generate_prime(bits, rng):
- """primtive attempt at prime generation"""
- hbyte_mask = pow(2, bits % 8) - 1
- while True:
- # loop catches the case where we increment n into a higher bit-range
- x = rng.read((bits + 7) // 8)
- if hbyte_mask > 0:
- x = byte_mask(x[0], hbyte_mask) + x[1:]
- n = util.inflate_long(x, 1)
- n |= 1
- n |= (1 << (bits - 1))
- while not number.isPrime(n):
- n += 2
- if util.bit_length(n) == bits:
- break
- return n
-
-
def _roll_random(rng, n):
"""returns a random # from 0 to N-1"""
bits = util.bit_length(n - 1)