Module contains functions used for number theory problems in cryprography.
Algorithms:
- Prime numbers test (Miller-Rabin)
- greatest common divisor - gcd
- multiplicative inverse mod n
- Euler's function
- matrix inverse mod n
- primitive root mod n
- Cesar chiper
- Hill chiper
- Affine chiper
Implementation of f function from DES using S-boxes. This function is used for 16 iterations in DES algorithm. Function f takes 2 array arguments A and J , the first one is 32 bits and the second is 48 bits long.
There are 4 stages of calculating this function output.
1.The first argument A is expanded with expand function E , such that it becomes array E(A) of the 48 bits.
2.B = E(A) XOR J = B1B2...B8
3.For each Bj using S-box Sj , Cj = Sj(Bj) is computed.
4.f(A,J) = P(C1...C8) where P is final permutation.
Example of asymetric cryptosystem based on public-key cryptography. It is based on difficulty to solve discrete-logarithm problem in multiplicaition group of remainders mod p (p is prime number).This cryptosystem can be defined over any cyclic group G. The security depends on properties of chosen group G.