t 79 159 cryptography and data security
play

T-79.159 Cryptography and Data Security Lecture 2: 2.1 Classical - PDF document

T-79.159 Cryptography and Data Security Lecture 2: 2.1 Classical cryptosystems 2.2.Introduction to modern cryptographic primitives Kaufman et al: Chapter 2 Stallings: Chapter 2 1 2.1 Classical Cryptosystems Ceasar Cipher, or Shift Cipher


  1. T-79.159 Cryptography and Data Security Lecture 2: 2.1 Classical cryptosystems 2.2.Introduction to modern cryptographic primitives Kaufman et al: Chapter 2 Stallings: Chapter 2 1 2.1 Classical Cryptosystems Ceasar Cipher, or Shift Cipher Plain: meet me after the toga party Cipher: PHHW PH DIWHU WKH WRJD SDUWB Alphabets Plain: abcdefghijklmnopqrstuvwxyz Cipher: ABCDEFGHIJKLMNOPQRSTUVWXYZ Or, Plain: 0123456789... 24,25 Cipher: 0123456789... 24,25 Substitution is a mapping from ”Plain” to ”Cipher” 2 1

  2. Caesar cipher p = plaintext letter, {0,1,2,…,25} ∋ p C = ciphertext letter , {0,1,2,…,25} ∋ C Caesar substitution E E: C = E ( p ) = ( p + 3) mod 26 0 -> 3; 1 -> 4; … 22 -> 25; 23 -> 0; 24 -> 1; 25 -> 2 Caesar substitution, inverse transformation D D: p = D ( C ) = ( C – 3) mod 26 0 -> 23; 1 -> 24; 2-> 25; 3 -> 0; … ; 25 -> 22 3 Brute force cryptanalysis of shift cipher Shift cipher: E: C = E ( p ) = p + K mod 26 K = key; {0,1,2,3,…,25} ∋ K We need only some piece of ciphertxt to do exhaustive search K PHHW PH DIWHU WKH WRJD SDUWB 1 oggv .. 2 nffu .. 3 meet me after the toga party 4 2

  3. Monoalphabetic substitution Alphabets Plain: abcdefghijklmnopqrstuvwxyz Cipher: ABCDEFGHIJKLMNOPQRSTUVWXYZ Key = permutation of the 26 characters Size of key space 26! ≅ 4 x 10 26 Cryptanalysis based on statistical properties of the plaintext 5 Relative Frequency of Letters in English Text N 6.749 A 8.167 O 7.507 B 1.492 P 1.929 C 2.782 Q 0.095 D 4.253 R 5.987 E 12.702 S 6.327 F 2.228 T 9.056 G 2.015 U 2.758 H 6.094 V 0.978 I 6.996 W 2.360 J 0.153 X 0.150 K 0.772 Y 1.974 L 4.025 Z 0.074 M 2.406 6 3

  4. Ciphertext obtained from a Substitution Cipher YIFQF MZRWQ FYVEC FMDZP CVMRZ WNMDZ VEJBT XCDDU MJNDI FEFMD ZCDMQ ZKCEY FCJMY RNCWJ CSZRE XCHZU NMXZN ZUCDR JXYYS MRTME YIFZW DYVZV YFZUM RZCRW NZDZJ JXZWG CHSMR NMDHN CMFQC HZJMX JZWIE JYUCF WDJNZ DIR 7 Frequency table A 0 N 9 B 1 O 0 C 15 P 1 D 13 Q 4 R 10 E 7 F 11 S 3 G 1 T 2 U 5 H 4 I 5 V 5 J 11 W 8 X 6 K 1 L 0 Y 10 M 16 Z 20 8 4

  5. Simple substitution: frequency analysis cont’d The most frequent character: Z The most frequent character in English: e Guess: D ( Z ) = e The next most frequent characters { M,C,D,F,J,R,Y,N } The next most frequent characters in English { t,a,o,i,n,s,h,r } The most frequent digrams with Z are: DZ , ZW (4 times); NZ,ZU (3 times); RZ,HZ,XZ,FZ,ZR,ZV,ZC,ZD (two times each) 9 Using comon digrams… NZ is common but ZN occurs only once; guess D ( N ) = h ZW is common and WZ not at all and W is rare; guess D ( W ) = d DZ( 4 times) and ZD (2 times) are both common we guess { r,s,t } ∋ D ( D ) ZRW and RZW occur, and RW occurs, and R is frequent we guess D ( R ) = n 10 5

  6. Now we have end e ne dh e YIFQF MZRWQ FYVEC FMDZP CVMRZ WNMDZ VEJBT h e e nh d XCDDU MJNDI FEFMD ZCDMQ ZKCEY FCJMY RNCWJ en e h eh n n ed CSZRE XCHZU NMXZN ZUCDR JXYYS MRTME YIFZW e e ne nd he e ed n h h DYVZV YFZUM RZCRW NZDZJ JXZWG CHSMR NMDHN e ed d he n CMFQC HZJMX JZWIE JYUCF WDJNZ DIR ne_ndhe suggests that D ( C ) = a 11 end a e a ne dh e YIFQF MZRWQ FYVEC FMDZP CVMRZ WNMDZ VEJBT a h ea ea a nhad XCDDU MJNDI FEFMD ZCDMQ ZKCEY FCJMY RNCWJ a en a e h eh a n n ed CSZRE XCHZU NMXZN ZUCDR JXYYS MRTME YIFZW e e neand he e ed a n h h DYVZV YFZUM RZCRW NZDZJ JXZWG CHSMR NMDHN a a e ed a d he n CMFQC HZJMX JZWIE JYUCF WDJNZ DIR nh_ decrypts to RNM suggests that D ( M ) = i or o 12 6

  7. We have iend a i e a ine dhi e YIFQF MZRWQ FYVEC FMDZP CVMRZ WNMDZ VEJBT a i h i ea i ea a i nhad XCDDU MJNDI FEFMD ZCDMQ ZKCEY FCJMY RNCWJ a en a e hi eh a n in i ed CSZRE XCHZU NMXZN ZUCDR JXYYS MRTME YIFZW e e i neand he e ed a in hi h DYVZV YFZUM RZCRW NZDZJ JXZWG CHSMR NMDHN ai a e i ed a d he n CMFQC HZJMX JZWIE JYUCF WDJNZ DIR Guess { D,F,J,Y } ∋ E ( o ), then Y is the most likely 13 o iend o a i e a ine dhi e YIFQF MZRWQ FYVEC FMDZP CVMRZ WNMDZ VEJBT a i h i ea i ea o a io nhad XCDDU MJNDI FEFMD ZCDMQ ZKCEY FCJMY RNCWJ a en a e hi eh e a n oo in i o ed CSZRE XCHZU NMXZN ZUCDR JXYYS MRTME YIFZW o e o e i neand he e ed a in hi h DYVZV YFZUM RZCRW NZDZJ JXZWG CHSMR NMDHN ai a e i ed o a d he n CMFQC HZJMX JZWIE JYUCF WDJNZ DIR Remaining { D,F,J } possibly decrypt to { r,s,t } 14 7

  8. Remaining { D,F,J } possibly decrypt to { r,s,t } o r r iend ro a rise a ine dhise t YIFQF MZRWQ FYVEC FMDZP CVMRZ WNMDZ VEJBT ass iths r ris easi ea rati nhadt XCDDU MJNDI FEFMD ZCDMQ ZKCEY FCJMY RNCWJ a en a e hi eh asn t oo in i o red CSZRE XCHZU NMXZN ZUCDR JXYYS MRTME YIFZW so e re i neand heset ed a in his h DYVZV YFZUM RZCRW NZDZJ JXZWG CHSMR NMDHN air a eti ted to ar dsthe s n CMFQC HZJMX JZWIE JYUCF WDJNZ DIR 15 Try D ( Q ) = f and so on .. o rfr iendf ro a rise a ine dhise t YIFQF MZRWQ FYVEC FMDZP CVMRZ WNMDZ VEJBT ass iths r ris easif ea o ratio nhadt XCDDU MJNDI FEFMD ZCDMQ ZKCEY FCJMY RNCWJ a en a e hi eh asn t oo in i o red CSZRE XCHZU NMXZN ZUCDR JXYYS MRTME YIFZW so e ore i neand heset ed a in his h DYVZV YFZUM RZCRW NZDZJ JXZWG CHSMR NMDHN airfa eti ted to ar dsthe s n CMFQC HZJMX JZWIE JYUCF WDJNZ DIR 16 8

  9. ourfr iendf ro a rise a ine dhise t YIFQF MZRWQ FYVEC FMDZP CVMRZ WNMDZ VEJBT ass ithsu r ris easif ea o ratio nhadt XCDDU MJNDI FEFMD ZCDMQ ZKCEY FCJMY RNCWJ a en a e hi eh e asn t oo in i oured CSZRE XCHZU NMXZN ZUCDR JXYYS MRTME YIFZW so e ore i neand heset t ed a in his h DYVZV YFZUM RZCRW NZDZJ JXZWG CHSMR NMDHN airfa eti tedu to ar dsthe sun CMFQC HZJMX JZWIE JYUCF WDJNZ DIR 17 ourfr iendf rom a rise amine dhise m t YIFQF MZRWQ FYVEC FMDZP CVMRZ WNMDZ VEJBT ass ithsu r ris easif ea o ratio nhadt XCDDU MJNDI FEFMD ZCDMQ ZKCEY FCJMY RNCWJ a en a e hi eh e asn t oo in i oured CSZRE XCHZU NMXZN ZUCDR JXYYS MRTME YIFZW somem ore i neand heset t ed a in his h DYVZV YFZUM RZCRW NZDZJ JXZWG CHSMR NMDHN airfa eti tedu to ar dsthe sun CMFQC HZJMX JZWIE JYUCF WDJNZ DIR 18 9

  10. ourfr iendf rompa risex amine dhise mptyg YIFQF MZRWQ FYVEC FMDZP CVMRZ WNMDZ VEJBT lassw ithsu rpris easif evapo ratio nhadt XCDDU MJNDI FEFMD ZCDMQ ZKCEY FCJMY RNCWJ akenp lacew hileh ewasn tlook ingip oured CSZRE XCHZU NMXZN ZUCDR JXYYS MRTME YIFZW somem orewi neand heset tledb ackin hisch DYVZV YFZUM RZCRW NZDZJ JXZWG CHSMR NMDHN airfa cetil tedup towar dsthe sun CMFQC HZJMX JZWIE JYUCF WDJNZ DIR 19 Playfair Cipher M O N A R C H Y B D E F G I/J K L P Q S T U V W X Z The encryption rules Plaintext formatting Same row or column Regular case oo -> oxo ar -> RM hs -> BP mu -> CM ea -> IM 20 10

  11. Hill Cipher c 1 k 11 k 12 k 13 p 1 c 2 k 21 k 22 k 23 p 2 = x mod 26 k 31 k 32 k 34 c 3 p 3 Plain: triples of numbers in {0,1,2,…,25} Cipher: triples of numbers in {0,1,2,…,25} Key: 3x3 matrices with entries in {0,1,2,…,25} Arithmetic as in shift cipher plus multiplication 21 Polyalphabetic ciphers: Vigenère Plain and Cipher: finite sequences of characters in {0,1,2,…,25} Key of period q : k 1 k 2 k 3 … k q-1 k q sequences of length q of characters in {0,1,2,…,25} Encryption: c 1 = (p 1 + k 1 )mod 26 c q+1 =(p q+1 + k 1 )mod 26 c 2 = (p 2 + k 2 )mod 26 c q+2 = (p q+2 + k 2 )mod 26 ... ... c q = (p q + k q )mod 26 c 2q = (p 2q + k q )mod 26 and so on.. 22 11

  12. Polyalphabetic ciphers: Vigenère Example ourfr iendf rompa risex amine dhise mptyg sprin gspri ngspr ingsp rings pring sprin GJINE OWCUN EU... .. Note the repetition of a two character string resulting from a repetition in the plaintext! 23 Kasiski’s method to determine the period • Many strings of characters repeat themselves in natural languages. • Assume the interval between occurence of a string is a multiple of the period length. • Then a repetition of a character string of the same length occurs in the ciphertext. • By detecting repetitions of strings in the ciphertext one can find the period as the greatest common divisor (GCD) of the repetition intervals • Their may be false repetitions. The longer the repeating string the more significant it is. Repeating strings of length ≥ 3 are the most significant. 24 12

  13. One Time Pad • Claude Shannon laid (1949) the information theoretic fundamentals of secrecy systems. • Shannon’s pessimistic inequality: For perfect secrecy you need as much key as you have plaintext. • An example of a cipher which achieves perfect secrecy is the One Time Pad c i = (p i + k i )mod 26 where the key is a string of characters k 1 k 2 k 3 … k i chosen uniformly at random. • Practical ciphers do not provide perfect secrecy 25 2.2 Introduction to contemporary cryptographic primitives • Secret key (symmetric) primitives – Block cipher – Stream cipher – Integrity primitives • Message authentication code • Hash functions • Public key (asymmetric) primitives – Public key encryption scheme – Digital signature scheme 26 13

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend