Date post: | 29-Jun-2015 |
Category: |
Technology |
Upload: | benlamm |
View: | 222 times |
Download: | 1 times |
Cryptography 101
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.
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.
(Spartan) Scytale
Rail Fence Cipher
Route Cipher
Transposition Ciphers
The Quick Brown FoxGSV JFRXP YILDM ULC
Substitution Ciphers
The Quick Brown FoxZIT JXOEA WKGVF YGB
Shift Cipher (Caesar)
The Quick Brown FoxSGD PTHBJ AQNVM ENW
At-Bash
Modular ciphers
a = r mod m42 = 9*4 + 6r = a – m*q
42 = 6 mod 942 = q*9 + 66 = 42 – q*9
q = 0, r = 42q = 1, r = 33q = 2, r = 24q = 3, r = 15q = 4, r = 6 (0<q<m-1)q = 5, r = -3q = 6, r = -12
12 + 7 = 19 => 1 mod 914 – 2 = 12 => 3 mod 911 * 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 number5*2=10 => 1 mod 9 2 is the multiplicative inverse of 5 (and vice versa)15*2 = 30 => 3 mod 9If x is coprime with modulus then it has an inverse.
Caesar CipherEncryption: ek (x) = x + k mod 26Decryption: ek (y) = y – k mod 26
The quick brown foxk=3
t=20, 20 + 3 = 23 mod 26h=8, 8 + 3 = 11 mod 26e=5, 5 + 3 = 8 mod 26
Affine Cipher k=(a,b)Encryption: ek (x) = a*x + b mod 26Decryption: ek (y) = a-1 * (y – b) mod 26
The quick brown foxk=(5, 3)
t=20, 5*20 + 3 = 103 = 25 mod 26h=8, 5*8 + 3 = 43 = 17 mod 26e=5, 5*5 + 3 = 28 = 2 mod 26
21 * 5 = 105 = 1 mod 26
21 * 25-3 = 462 = 20 mod 2621 * 17-3 = 294 = 8 mod 2621 * 2-3 = -21 = 5 mod 26
Brute-Force Attacks
Given: y = SGD PTHBJ AQNVM ENWKeyspace = {1,…,25}Decryption : ki(y) =? x
Abu Yūsuf Yaʻqūb ibn ʼIsḥāq aṣ-Ṣabbāḥ al-Kindī 850 C.E.
Cryptanalysis
Letter Frequency Short word and letter combinations
thebetoofandthathavefornot
http://www.richkni.co.uk/php/crypta/
Normal English letter frequency
Ciphertext letter frequency
Vigenère cipherA polyalphabetic cipher
Key = KINGThe sun and the man in the moonDpr yev ntn buk wia ox buk wwbt
4 possible ways to spell the word “the”K – DPR I - BUKN – GNO G - ZRM
http://www.simonsingh.net/The_Black_Chamber/vigenere_cracking_tool.html
http://sharkysoft.com/vigenere/
Enigma
http://cryptoclub.math.uic.edu/shiftcipher/shiftcipher.phphttp://enigma.louisedade.co.uk/enigma.html
AXP AVC .. IOV NKZ .. HSA PYT .. PPZ LEXFZD YQO .. IZL NQL .. NNQ CMA .. GUH BISFGT YHD .. KDY GNV .. NBJ COQ .. GOI BKKMIW MRI .. VWG EZG .. SYX SJB .. TVB KFMDJG UDG .. OJN QDE .. SNH SMS .. TLI KPKLNK TMF .. ZAO RXJ .. SXV SVZ .. TYO KJJXKN JAE .. CTL OUL .. ERS XWU .. WHJ WBQBHG DBG .. CMM OTY .. EAA XXT .. JQR ISHRZU ZQN .. UKM HAY .. YCE FGR .. JEY ICVRTC 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)
Confusion and Diffusion
Claude Shannon
ConfusionThe 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
Left Right
ABCDEF GHIJKL
ABCDEF F() = HJLGIK
Xor = JIHGKL
JIHGKL ABCDEF
DESData 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)
AESAdvance Encryption Standard (2001)Currently accepted industry standardSupports 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.
Diffie-Hellman Key Exchange (DHKE)Discrete Logarithm Problem
Used in:SSHTLSIPSec
Diffie-Hellman Key Exchange (DHKE)Discrete Logarithm Problem
1. Choose a prime modulus P. 172. Choose an integer A that will be known as the generator. 33. Alice and Bob both choose a private number
Ax mod PAlice a – 15 Bob b – 13315 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 = 6Bob - Ax mod P = 12
A is specially chosen to induce the discrete logarithm problem and ensurea one way function.Exponentiation is commutative: k = (Ax)y = (Ay)x
RSARivest, Shamir, Adleman
Discrete logarithm and integer factorization
Set up1. Choose two large primes: p=3 and q=112. n = p*q = 33 3. Θ(n) = (p-1)(q-1)=(3-1)(11-1)=204. Find a number e where gcd(e, Θ(n)) = 1 e=35. Find the number d where e*d = 1 mod Θ(n) d=7
Public key (n, e) = (33, 3) Private key(d)c = me mod nm = cd mod n
Alice Bobm=443 mod 33 = 31
31->317 mod 20 = 4