From e299181a5dda25aed4879ebcbe1359604448b3ae Mon Sep 17 00:00:00 2001 From: "Jeremy T. Bouse" Date: Fri, 27 Nov 2009 16:25:55 -0500 Subject: Imported Upstream version 1.7.6 --- docs/paramiko.primes-pysrc.html | 82 ++++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 41 deletions(-) (limited to 'docs/paramiko.primes-pysrc.html') diff --git a/docs/paramiko.primes-pysrc.html b/docs/paramiko.primes-pysrc.html index 41800d7..dee92dc 100644 --- a/docs/paramiko.primes-pysrc.html +++ b/docs/paramiko.primes-pysrc.html @@ -54,24 +54,24 @@

Source Code for Module paramiko.primes

-  1  # Copyright (C) 2003-2007  Robey Pointer <robey@lag.net> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
+  1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
+  2  # 
+  3  # This file is part of paramiko. 
+  4  # 
+  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
+  6  # terms of the GNU Lesser General Public License as published by the Free 
+  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
+  8  # any later version. 
+  9  # 
+ 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
+ 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
+ 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
+ 13  # details. 
+ 14  # 
+ 15  # You should have received a copy of the GNU Lesser General Public License 
+ 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
+ 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
+ 18   
  19  """ 
  20  Utility functions for dealing with primes. 
  21  """ 
@@ -87,7 +87,7 @@
  31      hbyte_mask = pow(2, bits % 8) - 1 
  32      while True: 
  33          # loop catches the case where we increment n into a higher bit-range 
- 34          x =  34          x =  50      hbyte_mask = pow(2, bits % 8) - 1 
  51   
  52      # so here's the plan: 
- 53      # we fetch as many random bits as we'd need to fit N-1, and if the 
- 54      # generated number is >= N, we try again.  in the worst case (N-1 is a 
- 55      # power of 2), we have slightly better than 50% odds of getting one that 
- 56      # fits, so i can't guarantee that this loop will ever finish, but the odds 
- 57      # of it looping forever should be infinitesimal. 
- 58      while True: 
+ 53      # we fetch as many random bits as we'd need to fit N-1, and if the 
+ 54      # generated number is >= N, we try again.  in the worst case (N-1 is a 
+ 55      # power of 2), we have slightly better than 50% odds of getting one that 
+ 56      # fits, so i can't guarantee that this loop will ever finish, but the odds 
+ 57      # of it looping forever should be infinitesimal. 
+ 58      while True: 
  59          x = rpool.get_bytes(bytes) 
  60          if hbyte_mask > 0: 
@@ -151,7 +151,7 @@ paramiko.rng.StrongLockingRandomPool.get_bytes" class="py-name" href="#" onclick
  73   
 
74 - def __init__(self, rpool):
75 # pack is a hash of: bits -> [ (generator, modulus) ... ] - 76 self.pack = {} + 76 self.pack = {} 77 self.discarded = [] 78 self. 87 modulus = long(modulus, 16) 88 89 # weed out primes that aren't at least: - 90 # type 2 (meets basic structural requirements) - 91 # test 4 (more than just a small-prime sieve) - 92 # tries < 100 if test & 4 (at least 100 tries of miller-rabin) - 93 if (mod_type < 2) or (tests < 4) or ((tests & 4) and (tests < 8) and (tries < 100)): + 90 # type 2 (meets basic structural requirements) + 91 # test 4 (more than just a small-prime sieve) + 92 # tries < 100 if test & 4 (at least 100 tries of miller-rabin) + 93 if (mod_type < 2) or (tests < 4) or ((tests & 4) and (tests < 8) and (tries < 100)): 94 self.discarded.append((modulus, 'does not meet basic requirements')) 95 return 96 if generator == 0: 97 generator = 2 98 99 # there's a bug in the ssh "moduli" file (yeah, i know: shock! dismay! -100 # call cnn!) where it understates the bit lengths of these primes by 1. -101 # this is okay. -102 bl = util.bit_length(modulus) +100 # call cnn!) where it understates the bit lengths of these primes by 1. +101 # this is okay. +102 bl = util.bit_length(modulus) 103 if (bl != size) and (bl != size + 1): 104 self.discarded.append((modulus, 'incorrectly reported bit length %d' % size)) 105 return @@ -239,24 +239,24 @@ paramiko.win_pageant.PageantConnection.close" class="py-name" href="#" onclick=" 130 raise SSHException('no moduli available') 131 good = -1 132 # find nearest bitsize >= preferred -133 for b in bitsizes: +133 for b in bitsizes: 134 if (b >= prefer) and (b < max) and ((b < good) or (good == -1)): 135 good = b 136 # if that failed, find greatest bitsize >= min -137 if good == -1: +137 if good == -1: 138 for b in bitsizes: 139 if (b >= min) and (b < max) and (b > good): 140 good = b 141 if good == -1: 142 # their entire (min, max) range has no intersection with our range. -143 # if their range is below ours, pick the smallest. otherwise pick -144 # the largest. it'll be out of their range requirement either way, -145 # but we'll be sending them the closest one we have. -146 good = bitsizes[0] +143 # if their range is below ours, pick the smallest. otherwise pick +144 # the largest. it'll be out of their range requirement either way, +145 # but we'll be sending them the closest one we have. +146 good = bitsizes[0] 147 if min > good: 148 good = bitsizes[-1] 149 # now pick a random modulus of this bitsize -150 n = _roll_random(self.150 n = _roll_random(self. - Generated by Epydoc 3.0.1 on Sun Jul 6 18:30:37 2008 + Generated by Epydoc 3.0.1 on Sun Nov 1 22:14:18 2009