Rsa

· blur66's blog


<!doctype html>

Variables

p=p=p= prime
q=q=q= other prime
n=p∗qn=p*qn=pq
e=e=e= private key
d=d=d= public key


encrypted message:
m=2000decm = 2000_{dec}m=2000dec

private key:
d=13dec=1101bind = 13_{dec} = 1101_{bin}d=13dec=1101bin

Decomposing binary into it significant digits did_idi. Least significamt digit d0d_0d0 is the right most.

d=(23∗1)+(22∗1)+(21∗0)+(20∗1)d=∑i=0n−1 di∗2i \begin{align*} &d = (2^3*1) + (2^2*1) + (2^1*0) + (2^0*1) \\ &d = \sum_{i=0}^{n-1} \: {d_i*2^i} \end{align*} d=(231)+(221)+(210)+(201)d=i=0n1di2i

Where did_idi is the ithi^{th}ith significant digit. 0 is least significant (LSD 🌀), right to left

https://en.wikipedia.org/wiki/Modular_exponentiation


Encrypting a message

c=memod(n)c = m^e mod(n)c=memod(n)

Decrypting a message (m) with private key (p)

t=cd∗mod(n)t = c^d*mod(n)t=cdmod(n)

last updated: