Skip to Content
CSE442TIntroduction to Cryptography (Lecture 8)

CSE442T Introduction to Cryptography (Lecture 8)

Chapter 2: Computational Hardness

Computational number theory/arithmetic

We want to have a easy-to-use one-way functions for cryptography.

How to find axmod  Na^x\mod N quickly. a,x,Na,x,N are positive integers. We want to reduce [amod  N][a\mod N]

Example: 12939mod  41≡(129mod  41)39mod  41=639mod  41129^{39}\mod 41\equiv (129\mod 41)^{39}\mod 41=6^{39}\mod 41

Find the binary representation of xx. e.g. express as sums of powers of 2.

x=39=bin(1,0,0,1,1,1)

Repeatedly square floor(log⁡2(x))floor(\log_2(x)) times.

639mod  41=632+4+2+1mod  41=(632mod  41)(64mod  41)(62mod  41)(61mod  41)mod  41=(−4)(25)(−5)(6)mod  41=7\begin{aligned} 6^{39}\mod 41&=6^{32+4+2+1}\mod 41\\ &=(6^{32}\mod 41)(6^{4}\mod 41)(6^{2}\mod 41)(6^{1}\mod 41)\mod 41\\ &=(-4)(25)(-5)(6)\mod 41\\ &=7 \end{aligned}

The total multiplication steps is floor(log⁡2(x))floor(\log_2(x))

looks like fast exponentiation right?

Goal: fg,p(x)=gxmod  pf_{g,p}(x)=g^x\mod p is a one-way function, for certain choice of p,gp,g (and assumptions)

A group (Nice day one for MODERN ALGEBRA)

A group GG is a set with, a binary operation ⊕\oplus. and ∀a,b∈G\forall a,b\in G, a⊕b→ca \oplus b\to c

  1. a,b∈G,a⊕b∈Ga,b\in G,a\oplus b\in G (closure)
  2. (a⊕b)⊕c=a⊕(b⊕c)(a\oplus b)\oplus c=a\oplus(b\oplus c) (associativity)
  3. ∃e\exists e such that ∀a∈G,e⊕g=g=g⊕e\forall a\in G, e\oplus g=g=g\oplus e (identity element)
  4. ∃g−1∈G\exists g^{-1}\in G such that g⊕g−1=eg\oplus g^{-1}=e (inverse element)

Example:

  • ZN={0,1,2,3,...,N−1}\mathbb{Z}_N=\{0,1,2,3,...,N-1\} with addition mod  N\mod N, with identity element 00. a∈ZN,a−1=N−aa\in \mathbb{Z}_N, a^{-1}=N-a.
  • A even simpler group is Z\Z with addition.
  • ZN∗={x:x∈Z,1≤x≤N:gcd(x,N)=1}\mathbb{Z}_N^*=\{x:x\in \mathbb{Z},1 \leq x\leq N: gcd(x,N)=1\} with multiplication mod  N\mod N (we can do division here! yeah…).
    • If N=pN=p is prime, then Zp∗={1,2,3,...,p−1}\mathbb{Z}_p^*=\{1,2,3,...,p-1\}
    • If N=24N=24, then Z24∗={1,5,7,11,13,17,19,23}\mathbb{Z}_{24}^*=\{1,5,7,11,13,17,19,23\}
      • Identity is 11.
      • Let a∈ZN∗a\in \mathbb{Z}_N^*, by Euclidean algorithm, gcd(a,N)=1gcd(a,N)=1,∃x,y∈Z\exists x,y \in Z such that ax+Ny=1,ax≡1mod  N,x=a−1ax+Ny=1,ax\equiv 1\mod N,x=a^{-1}
      • a,b∈ZN∗a,b\in \mathbb{Z}_N^*. Want to show gcd(ab,N)=1gcd(ab,N)=1. If gcd(ab,N)=d>1gcd(ab,N)=d>1, then some prime p∣dp|d. so p∣(a,b)p|(a,b), which means p∣ap|a or p∣bp|b. In either case, gcd(a,N)>dgcd(a,N)>d or gcd(b,N)>dgcd(b,N)>d, which contradicts that a,b∈CN∗a,b\in \mathbb{C}_N^*

Euler’s totient function

ϕ:Z+→Z+,ϕ(N)=∣ZN∗∣=∣{1≤x≤N:gcd(x,N)=1}∣\phi:\mathbb{Z}^+\to \mathbb{Z}^+,\phi(N)=|\mathbb{Z}_N^*|=|\{1\leq x\leq N:gcd(x,N)=1\}|

Example: ϕ(1)=1\phi(1)=1, ϕ(24)=8\phi(24)=8, ϕ(p)=p−1\phi (p)=p-1, ϕ(p⋅q)=(p−1)(q−1)\phi(p\cdot q)=(p-1)(q-1)

Euler’s Theorem

For any a∈ZN∗a\in \mathbb{Z}_N^*, aϕ(N)≡1mod  Na^{\phi(N)}\equiv 1\mod N

Consequence: axmod  Na^x\mod N, x=K⋅ϕ(N)+r,0≤r≤ϕ(N)x=K\cdot \phi(N)+r,0\leq r\leq \phi(N)

a^x\equiv a^{K \cdot \phi (N) +r}\equiv ( a^{\phi(n)} )^K \cdot a^r \mod N$

So computing axmod  Na^x\mod N is polynomial in log⁡(N)\log (N) by reducing amod  Na\mod N and xmod  ϕ(N)<Nx\mod \phi(N)<N

Corollary: Fermat’s little theorem:

1≤a≤p−1,ap−1≡1mod  p1\leq a\leq p-1,a^{p-1}\equiv 1 \mod p

Last updated on