210 likes | 335 Views
Cryptograpy. By Roya Furmuly. 9. O. D. I. C. L. S. 1. 7. W. 3. F. P. 2. H. What Is It?.
E N D
Cryptograpy By Roya Furmuly 9 O D I C L S 1 7 W 3 F P 2 H
What Is It? Enables two people (Alice and Bob) to communicate over an insecure channel in such a way so that an opponent (Oscar) cannot understand what is being said.
How Does It Work? • Alice encrypts the information (Plaintext), using a predetermined key, then sends the result (Ciphertext) to Bob. • Oscar cannot determine the plaintext because he doesn’t know the key. • Bob, who knows the encryption key, decrypts the ciphertext and reconstructs the plaintext.
Formal Definition A Cryptosystem is a five-tuple (P,C,K,E,D) P= finite set of plaintexts C= finite set of ciphertexts K= finite set of keys (keyspace) For each K KeK Eand a corresponding dK D.Each eK:P Cand dK:C Pare functions such that dK(eK(x))=x x P.
Observations • The encryption function eK must be injective to avoid ambiguity. i.e. if y= eK(x1)= eK(x2) where x1 not equalx2 Bob doesn’t know whether y= x1 or y= x2 • If P = C, then the encryption function is a permutation.
Protocol • Choose random key K in K(when Oscar notpresent or through a secure channel). • Alice Message: x=x1x2...xn wherei in (1,n), xi inP encrypts each xi using encryption rule yi= eK(xi) y=y1y2…yn • Bob uses decryption function dK(yi)=xi x=x1x2...xn
Diagram Oscar Oscar x y x Alice encrypter decrypter Bob K key source
What makes a Cryptosystem practical? 1. Encryption and Decryption functions should be efficiently computable. 2. Upon seeing ciphertext y, the opponent should be unable to determine the key K used (“security”).
Shift Cipher Let P =C =K = Z26. eK(x)=x+K mod 26 and dK(y)=y-K mod 26 (x,y in Z26) cool fact: for K=3, cryptosystem is called the Caesar Cipher.
Shift Cipher (cont’d) • We encrypt English text, by the following correspondence: A 0, B 1, …, Z 25, A B C D E F G H I J K L M N O P Q R S T U V W 0 1 2 3 4 5 6 7 8 9 101112 13 14 15161718192021 22 X Y Z 23 24 25
Let’s Encrypt! Let the key be K=7, encrypt: UCLA BRUINS convert letters to integers using chart: 20 2 11 0 1 17 20 8 13 18 add 7 to each value, reduce mod 26: 1 9 18 7 8 24 1 15 20 25 convert to sequence of integers: BJSHIYBPUZ
Let’s Decrypt! BJSHIYBPUZ convert letters to integers: 1 9 18 7 8 24 1 15 20 25 subtract 7, reduce mod 26: 20 2 11 0 1 17 20 8 13 18 convert to letters: UCLA BRUINS
Shift Cipher, any Good? • Nope! Fails security property. • Keyspace is very small, only 25 possible keys. • Can easily be deciphered by an exhaustive key search. • Try K=1…25, until get a text that makes sense.
Vigenere Cipher Let m>0 be fixed. Let P =C =K = (Z26)m For a key K=(k1,k2,…km) define eK(x1,x2,…,xm)=(x1+k1, x2+k2,…,xm+km) and dK(y1,y2,…,ym)=(y1-k1, y2-k2,…,ym-km) *all operations done in Z26
Let’s Encrypt! Let key=hot=(7,14,19), encrypt: SUMMER IS HERE convert to integers & “add” the keyword mod 26: 18 20 12 12 4 17 8 18 7 4 18 4 7 14 19 7 14 19 7 14 19 7 14 19 ---------------------------------------------------- 25 8 5 19 18 10 15 6 0 11 6 23 ZIFTSKPGALGX
Let’s Decrypt! ZIFTSKPGALGX convert to integers and “subtract” the keyword hot=(7,14,19) mod 26: 25 8 5 19 18 10 15 6 0 11 6 23 7 14 19 7 14 19 7 14 19 7 14 19 -------------------------------------------------------- 18 20 12 12 4 17 8 18 7 4 18 4 SUMMER IS HERE
Vigenere Cipher, any Good? • Better than Shift Cipher • Possible number of keys of length m is (26)m • Say m=5, then keyspace size is (26)5 approx 1.1x107 • So, exhaustive key search not feasible by hand (but OK by computer).
Other Cryptosystems • Data Encryption Standard (DES) Based on permutaion of 64 bits at a time. • RSA Based on difficulty of factoring large integers into primes. • Enigma Machine with rotors that shifted letters in complicated manner.
Summary • Cryptography allows us to communicate through insecure channels. • Shift Cipher…insecure (small keyspace) • Vigenere Cipher…less insecure • Complicated Cryptosystems DES, RSA, ENIGMA