Lecture 014

Alice and Bob: read their histroy

Ada's Lecture

Cryptography Application

\mathbb{Z}_N = \{0, 1, ..., N - 1\} is a good universe for addition / subtraction \mathbb{Z}_N^* = \{A \in \mathbb{Z}_N | \text{gcd}(A, N) = 1\} is a good universe for multiplication / division

\text{isPrime}:

\text{randomPrime}:

Private-Key Cryptography

Sender:

Public:

Receiver:

Variations:

One-time pad:

Secret Key Sharing

Secret Key Exchange

Secret Key Exchange
Sender:

Public:

Receiver:

Process:

  1. Sender pick a public prime universe N = P
  2. Sender pick a public generator for base B = G \in \mathbb{Z}_P^* (every \mathbb{Z}_P^* has a generator G) to ensure the exponentiated space is the whole universe
  3. Sender send above information to Receiver

  4. Sender pick a secret exponent R_1 \in \mathbb{Z}_{\varphi(P)}^*

  5. Sender send G^{R_1}

  6. Receiver pick a secret exponent R_2 \in \mathbb{Z}_{\varphi(P)}^*

  7. Receiver send G^{R_2}

  8. Both compute G^{R_1R_2} and let it be secret.

Breaking Encryption: solving distinct log problem (obtaining R_1 from G^{R_1} and R_2 from G^{R_2}) - proving is as hard as deciding P \text{ v.s. } NP

Public-Key Cryptography (RSA)

Sender:

Public:

Receiver:

Process:

  1. Receiver pick universe N = PQ (must be composit)
  2. Receiver compute \varphi(N) = (P - 1)(Q - 1)
  3. Receiver pick exponent E \in \mathbb{Z}_{\varphi(N)}
  4. Receiver calculate inverse E^{-1} = \text{Euclid}(E, \varphi(N))
  5. Receiver publish N, E
  6. Sender encrypt C = M^E \mod N and send to receiver
  7. Receiver calculate M = CE^{-1}

Breaking Encryption: solving distinct root problem

Modular Arithmetic

Complexity in Continuous Space:

Modular Complexity: finite set \mathbb{Z}_N = \{0, 1, 2, ..., N - 1\}

Modular Division Algorithm:

  1. Check existence of B^{-1} (checking \text{gcd}(B, N) = 1): Euclid's Algorithm
  2. Compute B^{-1}: Extension of Euclid's Algorithm

  3. miix: integral linear combination where constants are integers \text{gcd}(A, B) = kA + lB (\text{gcd}(A, B) is a mix of A and B)

  4. if we find 1 = kB + lN, B^{-1} = k by lN \equiv 0 \mod N

Modular Exponentiation Algorithm: repeatedly square and mode Modular Log Algorithm: no known poly-time algorithm Modular Root Algorithm: no known poly-time algorithm

Complexity Summery

Complexity Summery

Sutner's Lecture

Modular Arithmetic

Modular Numbers

Euclidean Algorithm (O(k^2) for mods and remainders, O(k^3) worst when inputs are two consecutive Fibonacci numbers): gcd(x, y) = gcd(y, x \mod y)

There are better GCD algorithms (Lehmer's Algorithm) that has roughly O(n \log n) complexity. See: stackoverflow

Extended Euclidean Algorithm: gcd(a, b) = x \cdot a + y \cdot b

Diophantine Equation: a \cdot x + b \cdot y = c for solution of variable x, y. Such solution is not unique, when (x_0, y_0) is a solution (x_0 + tb/d, y_0 - ta/d) is also a solution

Lattice: \langle{\mathbb{N}}, |\rangle - a partial order where any two elements have a join (supremum: least common multiple) and a meet (infimum: greatest common divisor)

Divisor Lattice

Divisor Lattice

Modular Arithmetic

Theorem: Given polynomial p(x) = ax^3 + bx^2 + cx + d, if p(0), p(1) odd, then (\forall x \in \mathbb{R}(p(x) \neq 0))

Arithmetic of remainders

We define arithmetic on equivalence classes of space \mathbb{Z}_m:

Cayley Tables

Cayley Tables

Colored Cayley Tables

Colored Cayley Tables

It is hard to solve even quadratic modular equations.

Multiplicative Inverse

Orbit (Power) of Modulo: \langle{a}\rangle = \{a^k | k \geq 0\}

Orbits for m = 25, a > 1, element 1 colored black

Orbits for m = 25, a > 1, element 1 colored black

Observations

Observations

Chinese Remainder

Solving System of Equation a_1 x \equiv b_i (\mod m_i)

Chinese Remainder Theorem: Let m_i, i = 1, ..., n be pairwise coprime, then x \equiv a_i (\mod m_i) have a unique solution in \mathbb{Z}_m: m = m_1m_2...m_n. (for n > 2, repeat)

Youtube Lecture

Addition, Multiplication: wheel level Multiplication: wheel level Exponentiation: change base in sector does not affect output setctor

Prime wheel: any number raise to p-1 sector -> on 1 sector Non-Prime wheel: prime divisor of m sector, as well as other composit in first ring sector, will not contain prime number

Euler: got to be 1 when exponent phi exponent cycles, to the 1, 2, 3, 4..., repeat there are generator to the 1, 2, 3, 4 each with new number

Table of Content