gdata.tlslite.utils.cryptomath | index /usr/local/google/home/afshar/src/external-gdata-release/google3/src/gdata/tlslite/utils/cryptomath.py

`cryptomath module
This module has basic math/crypto code.`

Modules
`` |  |
Crypto array | base64 binascii | math os | sys traceback

Functions
`` |  | base64ToBytes(s) base64ToNumber(s) base64ToString(s) bytesToBase64(bytes) bytesToNumber(bytes) gcd(a, b) getBase64Nonce(numChars=22) getRandomBytes(howMany) getRandomNumber(low, high) getRandomPrime(bits, display=False) getRandomSafePrime(bits, display=False) `#Unused at the moment...` hashAndBase64(s) invMod(a, b) `#Returns inverse of a mod b, zero if none #Uses Extended Euclidean Algorithm` isPrime(n, iterations=5, display=False) lcm(a, b) makeSieve(n) `#Pre-calculate a sieve of the ~100 primes < 1000:` mpiToNumber(mpi) numBytes(n) numberToBase64(n) numberToBytes(n) numberToMPI(n) numberToString(s) powMod(base, power, modulus) `#Copied from Bryan G. Olson's post to comp.lang.python #Does left-to-right instead of pow()'s right-to-left, #thus about 30% faster than the python built-in with small bases` sha1 = openssl_sha1(...) `Returns a sha1 hash object; optionally initialized with a string` stringToBase64(s) stringToNumber(s)

Data
`` |  | cryptlibpyLoaded = False gmpyLoaded = False m2cryptoLoaded = False prngName = 'os.urandom' pycryptoLoaded = True sieve = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, ...]