Support Functions

securefile.aes_algorithm.RSA

securefile.rsa_algorithm.RSA.gcd(a, b)

Euclid’s algorithm for determining the greatest common divisor Use iteration to make it faster for larger integers

securefile.rsa_algorithm.RSA.is_prime(num)

Tests to see if a number is prime

securefile.rsa_algorithm.RSA.multiplicative_inverse(a, b)

Euclid’s extended algorithm for finding the multiplicative inverse of two numbers Returns a tuple (r, i, j) such that

\[r = gcd(a, b) = ia + jb\]
r = gcd(a,b) i = multiplicitive inverse of a mod b
     or      j = multiplicitive inverse of b mod a

Neg return values for i or j are made positive mod b or a respectively Iterateive Version is faster and uses much less stack space