gdata.Crypto.Util.number | index /usr/local/google/home/afshar/src/external-gdata-release/google3/src/gdata/Crypto/Util/number.py

`# number.py : Number-theoretic functions
#
# Part of the Python Cryptography Toolkit
#
# Distribute and use freely; there are no restrictions on further
# dissemination and usage except those imposed by the laws of your
# country of residence. This software is provided "as is" without
# warranty of fitness for use or suitability for any purpose, express
# or implied. Use at your own risk or not at all.
#`

Modules

``

Crypto.PublicKey._fastmath | struct | warnings |

Functions

``

GCD(x, y)
  `GCD(x:long, y:long): long
  Return the GCD of x and y.`

bytes_to_long(s)
  `bytes_to_long(string) : long
  Convert a byte string to a long integer.
  This is (essentially) the inverse of long_to_bytes().`

getPrime(N, randfunc)
  `getPrime(N:int, randfunc:callable):long
  Return a random N-bit prime number.`

getRandomNumber(N, randfunc)
  `getRandomNumber(N:int, randfunc:callable):long
  Return an N-bit random number.`

inverse(u, v)
  `inverse(u:long, u:long):long
  Return the inverse of u mod v.`

isPrime(N)
  `isPrime(N:long):bool
  Return true if N is prime.`

long2str(n, blocksize=0)

long_to_bytes(n, blocksize=0)
  `long_to_bytes(n:long, blocksize:int) : string
  Convert a long integer to a byte string.
  If optional blocksize is given and greater than zero, pad the front of the
  byte string with binary zeros so that the length is a multiple of
  blocksize.`

size(N)
  `size(N:long) : int
  Returns the size of the number N in bits.`

str2long(s)

Data
`` |  | __revision__ = '$Id: number.py,v 1.13 2003/04/04 18:21:07 akuchling Exp $' sieve = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, ...]