1.2k likes | 1.38k Views
Cryptography A Perspective. Ursinus College September 25, 2008 Oskars J. Rieksts Computer Science Department Kutztown University. Overview. Cryptography in history Basic terms & concepts Early/Simple examples Current cryptosystems Factoradic encryption. Cryptography in History.
E N D
CryptographyA Perspective Ursinus College September 25, 2008 Oskars J. Rieksts Computer Science Department Kutztown University
Overview • Cryptography in history • Basic terms & concepts • Early/Simple examples • Current cryptosystems • Factoradic encryption Kutztown University
Cryptography in History • Mary, Queen of Scots • World War II • Enigma machine • Japanese JN-25 code Kutztown University
Mary, Queen of Scots • In prison in London • Imprisoned by cousin Queen Elizabeth • 1586 • Supporters plotted to free her • Depose Elizabeth • Place her on throne • Needed her imprimatur • Smuggled encrypted messages in barrel Kutztown University
Mary, Queen of Scots • Messages discovered • Decoded by frequency analysis • Altered • Plot broken up • Plotters executed • Mary herself also executed Kutztown University
Enigma Machine • Coding machine • Invented by Albert Scherbius • 1918 • Sold to Wehrmacht • Meanwhile • Polish cryptographers stymied • 3 Poznan University math grad students • Marian Rejewski • Henryk Zygalski • Jerzy Rozycki • Uncovered algebraic basis to cipher text • Developed techniques for decryption Kutztown University
Enigma Machine • Conference of cryptographers • Summer of 1939 • Polish, French & British cryptographers • Enigma info passed to French & British • Bletchley Park • Code breaking activity • The Bombe • Alan Turing • Traffic analysis to predict some text Kutztown University
Japanese JN-25 Code • Japanese naval code • Broken by group led by Joseph Rochefort • Analysis of patterns • News of impending attack on . . • Aleutian Islands, or • Midway • Location encoded as “AF” • Dilemma – where to commit resources? Kutztown University
Japanese JN-25 Code • The Plan • Send transmission from Midway • Water distillation plant severely damaged • Listen • Japanese transmission • AF is short of water • Therefore AF = Midway • Commit aircraft carrier fleet to intercept attack Kutztown University
Basic Terms & Concepts • Cryptology • Cryptography • Cryptanalysis • Basic components of cryptosystem • Plain text • Cipher text • Key(s) • Basic types of cryptosystems • Symmetric/asymmetric key • Public/private key Kutztown University
Basic Terms & Concepts (cont.) • Measures • Keyspace • Cryptographic strength • Key principles • Confusion • Diffusion Kutztown University
Early/Simple Examples • Steganography • Caesar cipher • Substitution cipher • Transposition cipher • Vigenere cipher • Vernam cipher Kutztown University
Steganography • Merriam-Webster: The art or practice of concealing a message, image, or file within another message, image, or file • from Greek • steganos = covered • grafo = write • Histiaeus – tyrant of Miletus • shaved head of most trusted slave • tattooed a message • hair grew back covering message • Advantage – does not draw attention to • itself • messenger • recipient • Often combined with cryptography Kutztown University
Steganography Example You may have seen the TV show – In Plain Sight –which is based entirely on the federal witness protection program. The show is about people who have testified or will be testifying soon as witnesses in criminal cases but whose lives are in danger as a result. For their protection they are given new identities and are moved to a new community. Ergo they are all hidden “in plain sight”. And if you think this would not work, according to the U.S. Marshalls extant website, no program participant who follows security guidelines has ever been harmed while under the active protection of the Marshals Service. Kutztown University
Caesar Cipher • Example of a shift cipher • Encryption – forward shift by 3 • Decryption – backward shift by 3 • Shift ciphers • Private key • Symmetric key • Key = shift amount • Keyspace = 25 • Plain text – IHAVEASECRET • Cipher text – LKDYHDVHFUHW Kutztown University
Caesar Cipher – Analysis • Cryptographic strength weak • Numerous clues • Letter frequency • Small keyspace • N-grams (e.g. double letters) • Strong elimination coefficient (“qm” rarely occurs) • Easily decoded by hand Kutztown University
Caesar Cipher – Example L KDYH D GUHDP WKDW RQH GDB WKLV QDWLRQ ZLOO ULVH XS DQG OLYH RXW WKH WUXH PHDQLQJ RI LWV FUHHG: "ZH KROG WKHVH WUXWKV WR EH VHOI-HYLGHQW: WKDW DOO PHQ DUH FUHDWHG HTXDO." L KDYH D GUHDP WKDW RQH GDB RQ WKH UHG KLOOV RI JHRUJLD WKH VRQV RI IRUPHU VODYHV DQG WKH VRQV RI IRUPHU VODYH RZQHUV ZLOO EH DEOH WR VLW GRZQ WRJHWKHU DW WKH WDEOH RI EURWKHUKRRG. L KDYH D GUHDP WKDW RQH GDB HYHQ WKH VWDWH RI PLVVLVVLSSL, D VWDWH VZHOWHULQJ ZLWK WKH KHDW RI LQMXVWLFH, VZHOWHULQJ ZLWK W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OLWWOHZKLWHERBVDQGZKLWHJLUOVDVVLVWHUVDQGEURWKHUVLKDYHDGUHDPWRGDB Kutztown University
Substitution Cipher • Randomly generated substitution • Example • A F • B K • C D • D J • etc. • Characteristics • Private & symmetric key • Monoalphabetic • Key = alphabet of substitutions • Keyspace = 26! Kutztown University
Substitution Cipher – Analysis • Keyspace = 26! = 403291461126605635584000000 = 4.03 x 1026 • But other factors make it insecure • Letter frequency • N-grams • Strong elimination coefficient • With patience, can be decoded by hand • Plain text – BOOKKEEPINGROCKS • Cipher text – JXXTTZZDOYBEXATU Kutztown University
Substitution Cipher – Example • H PFAI F JZIFY TPFT UVI JFB TPHW VFTHUV GHXX ZHWI EM FVJ XHAI UET TPI TZEI YIFVHVN UC HTW DZIIJ: "GI PUXJ TPIWI TZETPW TU KI WIXC-IAHJIVT: TPFT FXX YIV FZI DZIFTIJ IOEFX." • H PFAI F JZIFY TPFT UVI JFB UV TPI ZIJ PHXXW UC NIUZNHF TPI WUVW UC CUZYIZ WXFAIW FVJ TPI WUVW UC CUZYIZ WXFAI UGVIZW GHXX KI FKXI TU WHT JUGV TUNITPIZ FT TPI TFKXI UC KZUTPIZPUUJ. • H PFAI F JZIFY TPFT UVI JFB IAIV TPI WTFTI UC YHWWHWWHMMH, F WTFTI WGIXTIZHVN GHTP TPI PIFT UC HVREWTHDI, WGIXTIZHVN GHTP TPI PIFT UC UMMZIWWHUV, GHXX KI TZFVWCUZYIJ HVTU FV UFWHW UC CZIIJUY FVJ REWTHDI. • H PFAI F JZIFY TPFT YB CUEZ XHTTXI DPHXJZIV GHXX UVI JFB XHAI HV F VFTHUV GPIZI TPIB GHXX VUT KI REJNIJ KB TPI DUXUZ UC TPIHZ WSHV KET KB TPI DUVTIVT UC TPIHZ DPFZFDTIZ. • H PFAI F JZIFY TUJFB. • H PFAI F JZIFY TPFT UVI JFB, JUGV HV FXFKFYF, GHTP HTW AHDHUEW ZFDHWTW, GHTP HTW NUAIZVUZ PFAHVN PHW XHMW JZHMMHVN GHTP TPI GUZJW UC HVTIZMUWHTHUV FVJ VEXXHCHDFTHUV; UVI JFB ZHNPT TPIZI HV FXFKFYF, XHTTXI KXFDS KUBW FVJ KXFDS NHZXW GHXX KI FKXI TU RUHV PFVJW GHTP XHTTXI GPHTI KUBW FVJ GPHTI NHZXW FW WHWTIZW FVJ KZUTPIZW. • H PFAI F JZIFY TUJFB. • H PFAI F JZIFY TPFT UVI JFB IAIZB AFXXIB WPFXX KI ILFXTIJ, IAIZB PHXX FVJ YUEVTFHV WPFXX KI YFJI XUG, TPI ZUENP MXFDIW GHXX KI YFJI MXFHV, FVJ TPI DZUUSIJ MXFDIW GHXX KI YFJI WTZFHNPT, FVJ TPI NXUZB UC TPI XUZJ WPFXX KI ZIAIFXIJ, FVJ FXX CXIWP WPFXX WII HT TUNITPIZ. Kutztown University
Substitution Cipher – Example HPFAIFJZIFYTPFTUVIJFBTPHWVFTHUVGHXXZHWIEMFVJXHAIUETTPITZEIYIFVHVNUCHTWDZIIJGIPUXJTPIWITZETPWTUKIWIXCIAHJIVTTPFTFXXYIVFZIDZIFTIJIOEFXHPFAIFJZIFYTPFTUVIJFBUVTPIZIJPHXXWUCNIUZNHFTPIWUVWUCCUZYIZWXFAIWFVJTPIWUVWUCCUZYIZWXFAIUGVIZWGHXXKIFKXITUWHTJUGVTUNITPIZFTTPITFKXIUCKZUTPIZPUUJHPFAIFJZIFYTPFTUVIJFBIAIVTPIWTFTIUCYHWWHWWHMMHFWTFTIWGIXTIZHVNGHTPTPIPIFTUCHVREWTHDIWGIXTIZHVNGHTPTPIPIFTUCUMMZIWWHUVGHXXKITZFVWCUZYIJHVTUFVUFWHWUCCZIIJUYFVJREWTHDIHPFAIFJZIFYTPFTYBCUEZXHTTXIDPHXJZIVGHXXUVIJFBXHAIHVFVFTHUVGPIZITPIBGHXXVUTKIREJNIJKBTPIDUXUZUCTPIHZWSHVKETKBTPIDUVTIVTUCTPIHZDPFZFDTIZHPFAIFJZIFYTUJFBHPFAIFJZIFYTPFTUVIJFBJUGVHVFXFKFYFGHTPHTWAHDHUEWZFDHWTWGHTPHTWNUAIZVUZPFAHVNPHWXHMWJZHMMHVNGHTPTPIGUZJWUCHVTIZMUWHTHUVFVJVEXXHCHDFTHUVUVIJFBZHNPTTPIZIHVFXFKFYFXHTTXIKXFDSKUBWFVJKXFDSNHZXWGHXXKIFKXITURUHVPFVJWGHTPXHTTXIGPHTIKUBWFVJGPHTINHZXWFWWHWTIZWFVJKZUTPIZWHPFAIFJZIFYTUJFBHPFAIFJZIFYTPFTU Kutztown University
Transposition Cipher • Generate permutation of n objects • Transpose letters • Permutation of 0 through 7 • 6 – 3 – 7 – 1 – 4 – 8 – 5 – 2 • Yields value transposition 1 6 2 3 3 7 4 1 5 4 6 8 7 5 8 2 Kutztown University
Transposition Cipher – Example • Plain text Say not the Struggle Naught Availeth by Arthur Hugh Clough (1819 – 1861) Say not the struggle naught availeth, The labour and the wounds are vain, The enemy faints not, nor faileth, And as things have been they remain. If hopes were dupes, fears may be liars; It may be, in yon smoke conceal'd, Your comrades chase e'en now the fliers, And, but for you, possess the field. For while the tired waves, vainly breaking, Seem here no painful inch to gain, Far back, through creeks and inlets making, Comes silent, flooding in, the main. And not by eastern windows only, When daylight comes, comes in the light; In front the sun climbs slow, how slowly! But westward, look, the land is bright! [I remember sitting at home in Reading as a boy of 9 listening to the radio. It was 1941, a very bad time for England in the Second World War. Winston Churchill was reading a poem, Say Not the Struggle Naught Availeth by Arthur Clough. - Cardinal Cormac Murphy-O’Connor] Kutztown University
Transposition Cipher – Example Say not the Struggle Naught Availeth by Arthur Hugh Clough (1819 – 1861) Say not the struggle naught availeth, The labour and the wounds are vain, The enemy faints not, nor faileth, And as things have been they remain. If hopes were dupes, fears may be liars; It may be, in yon smoke conceal'd, Your comrades chase e'en now the fliers, And, but for you, possess the field. Kutztown University
Transposition Cipher – Example • Cipher text TYTSNHOAGTGERLUSHATEUAGNTIHVLBEAURRYTHHAOHUUCGLGOATHYTNSUSGHTGREGNHLATUEEATAIHLVBEOTLUAHHNERDWTAANRODESUHIEVNETAAMINYNFENNOTORTSTIHFLAEAHAINSNTDEHBGAEVSYTREHEENFIHMNOIARSEPWDEEEEAUSRFPEALSYIBMMSAAIYTROINBNSYEOKNMECCOOLUEDRYADMECRSAOEAECSNEHEWFNTLHONRDISBAEYFOUOURTSSSPSTEOLFDHIFEELWEOHTIRETDHIWREAEIASNVVABKLRIEYMSHNEEEGANIRONPECLHFITNUFAAOIRNGHCRBKOTAEHEUCKRGNNLSDEIAIMNTAGKSSMICELSOOTOEFDLNTGHIIENNNIDMNNAAABSOYTETNNDEWOIRYOWWNHLSLDIEAGYNECSHOCMTNETOSHIMTIIEGNHLTOHFNETRINMSCBLUHLOSOWWSYOBSWULLWEATSRTWTOHDOEKLSNBLDRIARHEITMIGSBIEETRMTNHTGOAIEIAMNDREAGBIAOSNSFTYLEIOONTNGHTIOAIEDTIRESRWAYVAMDEBTFIALEAONNGRENSDTEHIONRCDLWOIANDRSWWUNRTCCHOALSHLRWIGDAEIPNAYMNOSOAETHRTEUSTALUGEGNGIALHVEATRBTTYHAHUCGULHORNRACDLIACRMCMUAOCHORYNOPCRONYNOO Kutztown University
Vigenere Cipher • Polyalphabetic substitution • Use n randomly generated substitutions • 1st letter is encoded by 1st substitution alphabet • 2nd letter is encoded by 2nd substitution alphabet • . . . • nth letter is encoded by nth substitution alphabet • n+1st letter is encoded by 1st substitution alphabet • etc. Kutztown University
Vigenere – Simple Example • Key = 3752 • Successive letters are shifted by 3, 7, 5, 2 • Plain text – BOOKKEEPINGROCKS • Cipher text – EVTMNLJRLULTRJPU • Eliminates double letters • Scatters N-grams Kutztown University
Vigenere Cipher • Advantages • Creates confusion • Same letter can be encoded n different ways • Pretty much eliminates n-grams • Keyspace > 26! Kutztown University
Vigenere Cipher • le chiffre indéchiffrable • Named for Blaise de Vigenère • Invented by Giovan Battista Bellaso ca. 1550 • Broken by • Charles Babbage in 1854 (unpublished) • Major Friedrich Kasiski in 1863 • Prussian infantry office Kutztown University
Vigenere Cipher – Example T KRCS L GILOX WYHH ZQV KOJ WYPG YDKPCY ZZSZ CLJL IA DEK ZTYV VIE WYL HCXV TSLQZUU ZI ZAG NUVLR: "HH YVZO WYLGP WIBHSV KV PP VVST-PYZKSYW: KOOE DCS APQ RYS NUVHHPG VXILO." Z OOGH R KFPDD AVLW FUS ODP VB EKV YSO KZSZD RW NSZUXPO EKV ZCYV FM TZUDLF DORCSD DEK HSH JVBD RW MCCPVY GWDML CHQVYG HLCS PP DSSS ER JPH ORNU HZJVAVPU RA HSH KHPWH FM PCRKOSCKFVR. T KRCS L GILOX WYHH ZQV KOJ HMLB EKV ZHLWV VT XLJZWDVZWDT, D JAOEH JDSWWVYWYJ NPHS WYL VPDK VT TQABGELTL, GHHCASCLEN KTWY AVP KVHH ZI FWDCHJZWZQ, NPZW EV AFLQJMCCPVK WYWF HB ZDJPG ZI WYSPGFT OYG ABGELTL. W SDML O OUVHA EKRA AJ IFBF WLKAZP FYPZOUVU KTOC VBP GRF ZTYV PB L QRAWZQ NOSCH KOSJ ZZSZ YRK IS UXUNSO EP AVP FFSCC RW AVPLI ZYTQ SBH MB KOS NREASYW FM HSHZY QSDIHQEHI. P VLYV H RCHRT HZGRF. W SDML O OUVHA EKRA CYH UHM, ORNU WY DCHPLPR, DWEK ZAG GLTPCFV IHQTVKZ, KTWY PHD JFCSCQFY VLYZUU SLJ SWAV UYWASZUU HLKO HSH NVFOV FM WYWVYDZVZAWZQ RUR YXCSWQLTHHTRE; VBP GRF FTJYA HSHIL WY DCHPLPR, SWEWCL PWDTR PZBJ HBO ECHQV JZYZD ZZSZ MH RIZP WF QCTQ YHBOV NPHS OZAHWH NOWEH SVMD DEK KSLKL UTUCZ OD VZZHPUJ HBO EIVHSHIZ. W SDML O OUVHA ERUHM. T KRCS L GILOX WYHH ZQV KOJ HMLFJ YRSZPB JOOWO SL SIDCASO, HMLFJ KZSZ LQU TCFQKHWY VYHZW EV TOOH Kutztown University
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GHRSSODEKO Kutztown University
Vigenere Cipher – Example Analysis TKRCSLGILO XWYHHZQVKO JWYPGYDKPC YZZSZCLJLI ADEKZTYVVI EWYLHCXVTS LQZUUZIZAG NUVLRHHYVZ OWYLGPWIBH SVKVPPVVST PYZKSYWKOO EDCSAPQRYS NUVHHPGVXI LOZOOGHRKF PDDAVLWFUS ODPVBEKVYS OKZSZDRWNS ZUXPOEKVZC YVFMTZUDLF DORCSDDEKH SHJVBDRWMC CPVYGWDMLC HQVYGHLCSP PDSSSERJPH ORNUHZJVAV PURAHSHKHP WHFMPCRKOS CKFVRTKRCS LGILOXWYHH ZQVKOJHMLB EKVZHLWVVT XLJZWDVZWD TDJAOEHJDS WWVYWYJNPH SWYLVPDKVT TQABGELTLG Kutztown University
Vigenere Cipher – Example Analysis HHCASCLENK TWYAVPKVHH ZIFWDCHJZW ZQNPZWEVAF LQJMCCPVKW YWFHBZDJPG ZIWYSPGFTO YGABGELTLW SDMLOOUVHA EKRAAJIFBF WLKAZPFYPZ OUVUKTOCVB PGRFZTYVPB LQRAWZQNOS CHKOSJZZSZ YRKISUXUNS OEPAVPFFSC CRWAVPLIZY TQSBHMBKOS NREASYWFMH SHZYQSDIHQ EHIPVLYVHR CHRTHZGRFW SDMLOOUVHA Kutztown University
Compare to Substitution HPFAIFJZIF YTPFTUVIJF BTPHWVFTHU VGHXXZHWIE MFVJXHAIUE TTPITZEIYI FVHVNUCHTW DZIIJGIPUX JTPIWITZET PWTUKIWIXC IAHJIVTTPF TFXXYIVFZI DZIFTIJIOE FXHPFAIFJZ Kutztown University
Compare to Substitution IFYTPFTUVI JFBUVTPIZI JPHXXWUCNI UZNHFTPIWU VWUCCUZYIZ WXFAIWFVJT PIWUVWUCCU ZYIZWXFAIU GVIZWGHXXK IFKXITUWHT JUGVTUNITP IZFTTPITFK XIUCKZUTPI ZPUUJHPFAI FJZIFYTPFT UVIJFBIAIV Kutztown University
Compare to Substitution TPIWTFTIUC YHWWHWWHMM HFWTFTIWGI XTIZHVNGHT PTPIPIFTUC HVREWTHDIW GIXTIZHVNG HTPTPIPIFT UCUMMZIWWH UVGHXXKITZ FVWCUZYIJH VTUFVUFWHW UCCZIIJUYF VJREWTHDIH PFAIFJZIFY TPFTYBCUEZ Kutztown University
Compare to Substitution XHTTXIDPHX JZIVGHXXUV IJFBXHAIHV FVFTHUVGPI ZITPIBGHXX VUTKIREJNI JKBTPIDUXU ZUCTPIHZWS HVKETKBTPI DUVTIVTUCT PIHZDPFZFD TIZHPFAIFJ ZIFYTUJFBH PFAIFJZIFY TPFTUVIJFB JUGVHVFXFK FYFGHTPHTW Kutztown University
Compare to Substitution AHDHUEWZFD HWTWGHTPHT WNUAIZVUZP FAHVNPHWXH MWJZHMMHVN GHTPTPIGUZ JWUCHVTIZM UWHTHUVFVJ VEXXHCHDFT HUVUVIJFBZ HNPTTPIZIH VFXFKFYFXH TTXIKXFDSK UBWFVJKXFD SNHZXWGHXX KIFKXITURU HVPFVJWGHT PXHTTXIGPH TIKUBWFVJG PHTINHZXWF WWHWTIZWFV JKZUTPIZWH PFAIFJZIFY TUJFBHPFAI FJZIFYTPFTU Kutztown University
Deciphering Vigenere • Determine the number of alphabets • Compute distances between matching sequences • Compute GCD of distances • Treat cipher text as n separate texts • For each separate text & each of 25 possible shifts • Compute Index of Coincidence • based on frequencies found in cipher text • using table of frequencies of letters in English • Index of Coincidence formula • fee = S {relFreqTab(k, ciphLet) * charFreq(ciphLet)} Kutztown University
Frequency Table – English A 0.08; B 0.015; C 0.03; D 0.04; E 0.13; F 0.02; G 0.015; H 0.06; I 0.065; J 0.005 K 0.005; L 0.035; M 0.03; N 0.07; O 0.08 P 0.02; Q 0.002; R 0.065; S 0.06; T 0.09 U 0.03; V 0.01; W 0.015; X 0.005; Y 0.02 Z 0.002 Kutztown University
Deciphering Algorithm • Using the key length and the file charFreqEng.txt • Generate tables of letter frequency and relative frequency (within the text) • Generate the Fee Table • Sort the Fee Table to produce a ranked order Kutztown University
Code to Produce Fee Table Public Sub genFeeTable(ByVal keyLen As Integer) Dim k, shift, ciphLet As Integer Dim fee As Double For k = 1 To keyLen For shift = 0 To 25 fee = 0 For ciphLet = 0 To 25 fee = fee + relFreqTab(k, ciphLet) * charFreq((ciphLet + 26 - shift)Mod 26) Next ciphLet feeTab(k, shift) = fee Next shift Next k End Sub Kutztown University
Vigenere – Final Step • Produce possible plain texts • using combination of • highest ranking fee table values • Choose best plain text • This step can be automated • Rate each possible plain text • using n-gram information • or list of 5 letter words in English Kutztown University
Vernam Cipher • Gilbert Sandford Vernam – inventor • Also known as one-time pad • Invented ca. 1919 • Proven unbreakable by Claude Shannon • Communication Theory of Secrecy Systems • 1949 • Unbreakable if and only if • Key is same length as plain text • Key is never re-used Kutztown University
Vernam Cipher • Basic operation – bitwise XOR • XOR table • 0 xor 0 = 0 • 0 xor 1 = 1 • 1 xor 0 = 1 • 1 xor 1 = 0 • Plain text is represented as bit stream • Key is random bit stream of same length • Cipher text is produced via bitwise XOR of plain bit stream and key bit stream. Kutztown University
Vernam Cipher – Example • Plain text :: Grade = A – Great! • Plain text in ASCII • 71 114 97 100 101 32 61 32 65 32 45 32 71 114 101 97 116 33 • Plain text as bit stream 01000111 01110010 01100001 01100100 01100101 00100000 00111101 00100000 01000110 00100000 10010110 00100000 01010011 01101111 01110010 01110010 01111001 00100001 Kutztown University
Vernam Cipher – Example • Key as bit stream 11000001 01110000 11011110 10111001 01100001 10001000 01101100 11111010 00110011 01001110 01111001 00011110 00001000 10010001 10100100 01000000 10000000 01000010 • Cipher text as bit stream 10000110 00000010 10111111 11011101 00000100 10101000 01010001 11011010 01110010 01101110 01010100 00111110 01001111 11100011 11000001 00100001 11110100 01100011 Kutztown University
Vernam Cipher – Why Unbreakable • Try attack by exhaustive search • Among possible keys 11000001 01110000 11011110 10111001 01100001 10001000 01101100 11111010 00110100 01001110 01111001 00011110 00011100 10001100 10110011 01010011 10001101 01000010 • Produces this recovered plain text: • Grade = F – Sorry! Kutztown University
Vernam Cipher – Why Unbreakable • Exhaustive search will produce every possible combination of 18 characters. • And there is no way to distinguish between them • Among the possible recovered texts: • Tickle me Elmo now • Jabberwocky Rocks! • Attack tomorrow am • Attack tomorrow pm • Grade = C++ & Java Kutztown University