Package tlslite :: Package utils :: Module cryptomath
[hide private]
[frames] | no frames]

Module cryptomath

source code

cryptomath module

This module has basic math/crypto code.

Functions [hide private]
 
HMAC_MD5(k, b) source code
 
HMAC_SHA1(k, b) source code
 
HMAC_SHA256(k, b) source code
 
HMAC_SHA384(k, b) source code
 
MD5(b) source code
 
SHA1(b) source code
 
bytesToNumber(b) source code
 
gcd(a, b) source code
 
getRandomBytes(howMany) source code
 
getRandomNumber(low, high) source code
 
getRandomPrime(bits, display=False) source code
 
getRandomSafePrime(bits, display=False) source code
 
invMod(a, b) source code
 
isPrime(n, iterations=5, display=False, sieve=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 5...) source code
 
lcm(a, b) source code
 
makeSieve(n) source code
 
mpiToNumber(mpi) source code
 
numBits(n) source code
 
numBytes(n) source code
 
numberToByteArray(n, howManyBytes=None)
Convert an integer into a bytearray, zero-pad to howManyBytes.
source code
 
numberToMPI(n) source code
 
powMod(base, power, modulus) source code
Variables [hide private]
  __package__ = 'tlslite.utils'
  gmpyLoaded = True
  m2cryptoLoaded = True
  prngName = 'os.urandom'
  pycryptoLoaded = True
Function Details [hide private]

numberToByteArray(n, howManyBytes=None)

source code 

Convert an integer into a bytearray, zero-pad to howManyBytes.

The returned bytearray may be smaller than howManyBytes, but will not be larger. The returned bytearray will contain a big-endian encoding of the input integer (n).