Cryptography involves transforming data using an algorithm and key to make it unreadable. Common techniques include encryption algorithms like the Caesar cipher which shifts letters by a set number, and the Vigenère cipher which uses a keyword for polyalphabetic substitution. Modern standards like the Data Encryption Standard and Advanced Encryption Standard use confusion and diffusion principles with substitution boxes and key lengths of 128+ bits for security. Key exchange methods like Diffie-Hellman allow secure key agreement without prior secrets.
2. What is Cryptography?
Encryption is the process of:
1.Transforming data (x)
2.Using an algorithm (e)
3.To make it unreadable to anyone (y)
4.except those possessing the key. (k)
K={k1,…,kn}
The Quick Brown Fox
Me (mod N) where M=The Quick Brown Fox
Uif Rvjdl Cspxo Gpy
Kerchhoffs’ principle: A cryptosystem should be secure even if the
Attacker knows all the details about the system, with the exception of
The key.
3. We shall extend the empire of Persia such that its boundaries
will be God's own sky, so the sun will not look down upon
any land beyond the boundaries of what is our own
-Xerxes (Ahasuerus) ~450 B.C.
5. The Quick Brown Fox
GSV JFRXP YILDM ULC
Substitution Ciphers
The Quick Brown Fox
ZIT JXOEA WKGVF YGB
Shift Cipher (Caesar)
The Quick Brown Fox
SGD PTHBJ AQNVM ENW
At-Bash
6. Modular ciphers
a = r mod m
42 = 9*4 + 6
r = a – m*q
42 = 6 mod 9
42 = q*9 + 6
6 = 42 – q*9
q = 0, r = 42
q = 1, r = 33
q = 2, r = 24
q = 3, r = 15
q = 4, r = 6 (0<q<m-1)
q = 5, r = -3
q = 6, r = -12
12 + 7 = 19 => 1 mod 9
14 – 2 = 12 => 3 mod 9
11 * 8 = 88 => 7 mod 9
15/5 = 3 !=> 3 mod 9
If the multiplicative inverse exists for a number
then we can divide by that number
5*2=10 => 1 mod 9
2 is the multiplicative inverse of 5 (and vice versa)
15*2 = 30 => 3 mod 9
If x is coprime with modulus then it has an inverse.
7. Caesar Cipher
Encryption: ek (x) = x + k mod 26
Decryption: ek (y) = y – k mod 26
The quick brown fox
k=3
t=20, 20 + 3 = 23 mod 26
h=8, 8 + 3 = 11 mod 26
e=5, 5 + 3 = 8 mod 26
Affine Cipher k=(a,b)
Encryption: ek (x) = a*x + b mod 26
Decryption: ek (y) = a-1 * (y – b) mod 26
The quick brown fox
k=(5, 3)
t=20, 5*20 + 3 = 103 = 25 mod 26
h=8, 5*8 + 3 = 43 = 17 mod 26
e=5, 5*5 + 3 = 28 = 2 mod 26
21 * 5 = 105 = 1 mod 26
21 * 25-3 = 462 = 20 mod 26
21 * 17-3 = 294 = 8 mod 26
21 * 2-3 = -21 = 5 mod 26
9. Abu Yūsuf Yaʻqūb ibn ʼIsḥāq
aṣ-Ṣabbāḥ al-Kindī 850 C.E.
Cryptanalysis
Letter Frequency Short word and letter combinations
the
be
to
of
and
that
have
for
not
http://www.richkni.co.uk/php/crypta/
11. Vigenère cipher
A polyalphabetic cipher
Key = KING
The sun and the man in the moon
Dpr yev ntn buk wia ox buk wwbt
4 possible ways to spell the word “the”
K – DPR I - BUK
N – GNO G - ZRM
http://www.simonsingh.net/The_Black_Chamber/vigenere_cracking_tool.html
http://sharkysoft.com/vigenere/
13. AXP AVC .. IOV NKZ .. HSA PYT .. PPZ LEX
FZD YQO .. IZL NQL .. NNQ CMA .. GUH BIS
FGT YHD .. KDY GNV .. NBJ COQ .. GOI BKK
MIW MRI .. VWG EZG .. SYX SJB .. TVB KFM
DJG UDG .. OJN QDE .. SNH SMS .. TLI KPK
LNK TMF .. ZAO RXJ .. SXV SVZ .. TYO KJJ
XKN JAE .. CTL OUL .. ERS XWU .. WHJ WBQ
BHG DBG .. CMM OTY .. EAA XXT .. JQR ISH
RZU ZQN .. UKM HAY .. YCE FGR .. JEY ICV
RTC ZUW .. QFF VLP .. PII LRK .. JCE IGP
Loops(1,4) (LTKGBDUHP) (XJINCOQVE) (FY) (RZ) (A) (M) (S) (W)
Loops(2,5) (XVFLPECGHBOKA) (ZQSYJDNMTUIRW)
Loops(3,6) (PCWIKF) (DOJQAT) (NERHSU) (VZXBMY) (L) (G)
Loops(1,4) 8, 9, 9, 2, 2, 1, 1, 1, 1
Loops(2,5) 2, 13, 13
Loops(3,6) 6, 6, 6, 6, 6, 1, 1
By the end of WWII enigma
had a key space of
159 sextillion (159*1021)
14. Confusion and Diffusion
Claude Shannon
Confusion
The relationship between the key and the ciphertext as complex and as
involved as possible.
e.g. Enigma & complex substitution (S-boxes)
011011
Diffusion
Statistics of the plaintext is "dissipated" in the
statistics of the ciphertext. If we change a
character of the plaintext, then several
characters of the ciphertext should change.
http://en.wikipedia.org/wiki/Permutation_box
P-Box
15. Left Right
ABCDEF GHIJKL
ABCDEF F() = HJLGIK
Xor = JIHGKL
JIHGKL ABCDEF
DES
Data Encryption Standard (1973)
56 bit (Lucifer cipher)
Key Length Security Estimation
56-64 bits A few hours or days
112-128 bits Several decades (w/o QC)
256 bits Several decades (w QC)
16. AES
Advance Encryption Standard (2001)
Currently accepted industry standard
Supports 128, 192 and 256 bit keys.
In 1997 National Institute of Standards and Technology (NIST)
Called for proposals for AES
• Rijandel
• Mars
• RC6
• Serpent
• Twofish
In 2001 Rijandel was adopted and renamed AES.
18. Diffie-Hellman Key Exchange (DHKE)
Discrete Logarithm Problem
1. Choose a prime modulus P. 17
2. Choose an integer A that will be known as the generator. 3
3. Alice and Bob both choose a private number
Ax mod P
Alice a – 15 Bob b – 13
315 mod 17 = 6 313 mod 17 = 12
6
<- 12
12 15 mod 17 = 10 6 13 mod 17 = 10
Hacker knows:
Alice - Ax mod P = 6
Bob - Ax mod P = 12
A is specially chosen to induce the discrete logarithm problem and ensure
a one way function.
Exponentiation is commutative: k = (Ax)y = (Ay)x
19. RSA
Rivest, Shamir, Adleman
Discrete logarithm and integer factorization
Set up
1. Choose two large primes: p=3 and q=11
2. n = p*q = 33
3. Θ(n) = (p-1)(q-1)=(3-1)(11-1)=20
4. Find a number e where gcd(e, Θ(n)) = 1 e=3
5. Find the number d where e*d = 1 mod Θ(n) d=7
Public key (n, e) = (33, 3)
Private key(d)
c = me mod n
m = cd mod n
Alice Bob
m=4
43 mod 33 = 31
31->
317 mod 20 = 4