vernam cipher project preliminaries csc112 march 14, 2011 oskars j. rieksts computer science...

29
Vernam Cipher Vernam Cipher Project Preliminaries Project Preliminaries CSC112 CSC112 March 14, 2011 March 14, 2011 Oskars J. Rieksts Oskars J. Rieksts Computer Science Department Computer Science Department Kutztown University Kutztown University

Upload: allen-lewis

Post on 13-Jan-2016

218 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Vernam Cipher Project Preliminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

Vernam CipherVernam CipherProject PreliminariesProject Preliminaries

CSC112CSC112March 14, 2011March 14, 2011

Oskars J. RiekstsOskars J. RiekstsComputer Science DepartmentComputer Science Department

Kutztown UniversityKutztown University

Page 2: Vernam Cipher Project Preliminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

2008 Kutztown University 2

Early/Simple ExamplesEarly/Simple Examples SteganographySteganography Caesar cipherCaesar cipher Substitution cipherSubstitution cipher Transposition cipherTransposition cipher Vigenere cipherVigenere cipher Vernam cipherVernam cipher

Page 3: Vernam Cipher Project Preliminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

2008 Kutztown University 3

SteganographySteganography Merriam-Webster: The art or practice of concealing a Merriam-Webster: The art or practice of concealing a

message, image, or file within another message, image, or message, image, or file within another message, image, or file file from Greekfrom Greek

» steganos = coveredsteganos = covered» grafo = writegrafo = write

Histiaeus – tyrant of MiletusHistiaeus – tyrant of Miletus shaved head of most trusted slaveshaved head of most trusted slave tattooed a messagetattooed a message hair grew back covering messagehair grew back covering message

Advantage – does not draw attention toAdvantage – does not draw attention to itselfitself messengermessenger recipientrecipient

Often combined with cryptographyOften combined with cryptography

Page 4: Vernam Cipher Project Preliminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

2008 Kutztown University 4

Steganography ExampleSteganography ExampleYou may have seen the TV show – In Plain Sight –which is You may have seen the TV show – In Plain Sight –which is

based entirely on the federal witness protection program. based entirely on the federal witness protection program. The show is about people who have testified or will be The show is about people who have testified or will be testifying soon as witnesses in criminal cases but whose testifying soon as witnesses in criminal cases but whose lives are in danger as a result. For their protection they lives are in danger as a result. For their protection they are given new identities and are moved to a new are given new identities and are moved to a new community. Ergo they are all hidden “in plain sight”. community. Ergo they are all hidden “in plain sight”. And if you think this would not work, according to the And if you think this would not work, according to the U.S. Marshalls extant website, no program participant who U.S. Marshalls extant website, no program participant who follows security guidelines has ever been harmed while follows security guidelines has ever been harmed while under the active protection of the Marshals Service.under the active protection of the Marshals Service.

Page 5: Vernam Cipher Project Preliminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

2008 Kutztown University 5

Caesar CipherCaesar Cipher Example of a shift cipherExample of a shift cipher

Encryption – forward shift by 3Encryption – forward shift by 3 Decryption – backward shift by 3Decryption – backward shift by 3

Shift ciphersShift ciphers Private keyPrivate key Symmetric keySymmetric key Key = shift amountKey = shift amount Keyspace = 25Keyspace = 25

Plain text – IHAVEASECRETPlain text – IHAVEASECRET Cipher text – LKDYHDVHFUHWCipher text – LKDYHDVHFUHW

Page 6: Vernam Cipher Project Preliminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

2008 Kutztown University 6

Caesar Cipher – ExampleCaesar Cipher – ExampleL KDYH D GUHDP WKDW RQH GDB WKLV QDWLRQ ZLOO ULVH XS DQG OLYH 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 RXW WKH WUXH PHDQLQJ RI LWV FUHHG: "ZH KROG WKHVH WUXWKV WR EH VHOI-HYLGHQW: WKDW DOO PHQ DUH FUHDWHG HTXDO."EH VHOI-HYLGHQW: WKDW DOO PHQ DUH FUHDWHG HTXDO."

L KDYH D GUHDP WKDW RQH GDB RQ WKH UHG KLOOV RI JHRUJLD WKH VRQV 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 RI IRUPHU VODYHV DQG WKH VRQV RI IRUPHU VODYH RZQHUV ZLOO EH DEOH WR VLW GRZQ WRJHWKHU DW WKH WDEOH RI EURWKHUKRRG.DEOH WR VLW GRZQ WRJHWKHU DW WKH WDEOH RI EURWKHUKRRG.

L KDYH D GUHDP WKDW RQH GDB HYHQ WKH VWDWH RI PLVVLVVLSSL, D L KDYH D GUHDP WKDW RQH GDB HYHQ WKH VWDWH RI PLVVLVVLSSL, D VWDWH VZHOWHULQJ ZLWK WKH KHDW RI LQMXVWLFH, VZHOWHULQJ VWDWH VZHOWHULQJ ZLWK WKH KHDW RI LQMXVWLFH, VZHOWHULQJ ZLWK WKH KHDW RI RSSUHVVLRQ, ZLOO EH WUDQVIRUPHG LQWR DQ ZLWK WKH KHDW RI RSSUHVVLRQ, ZLOO EH WUDQVIRUPHG LQWR DQ RDVLV RI IUHHGRP DQG MXVWLFH.RDVLV RI IUHHGRP DQG MXVWLFH.

L KDYH D GUHDP WKDW PB IRXU OLWWOH FKLOGUHQ ZLOO RQH GDB OLYH LQ L KDYH D GUHDP WKDW PB IRXU OLWWOH FKLOGUHQ ZLOO RQH GDB OLYH LQ D QDWLRQ ZKHUH WKHB ZLOO QRW EH MXGJHG EB WKH FRORU RI WKHLU D QDWLRQ ZKHUH WKHB ZLOO QRW EH MXGJHG EB WKH FRORU RI WKHLU VNLQ EXW EB WKH FRQWHQW RI WKHLU FKDUDFWHU.VNLQ EXW EB WKH FRQWHQW RI WKHLU FKDUDFWHU.

L KDYH D GUHDP WRGDB.L KDYH D GUHDP WRGDB.

Page 7: Vernam Cipher Project Preliminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

2008 Kutztown University 7

Substitution CipherSubstitution Cipher Randomly generated substitutionRandomly generated substitution ExampleExample

A A F F B B K K C C D D D D J J etc.etc.

CharacteristicsCharacteristics Private & symmetric keyPrivate & symmetric key MonoalphabeticMonoalphabetic Key = alphabet of substitutionsKey = alphabet of substitutions Keyspace = 26!Keyspace = 26!

Page 8: Vernam Cipher Project Preliminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

2008 Kutztown University 8

Substitution Cipher – AnalysisSubstitution Cipher – Analysis Keyspace = 26! = Keyspace = 26! =

403291461126605635584000000 = 4.03 403291461126605635584000000 = 4.03 xx 10102626

But other factors make it insecureBut other factors make it insecure Letter frequencyLetter frequencyN-gramsN-grams Strong elimination coefficientStrong elimination coefficient With patience, can be decoded by handWith patience, can be decoded by hand

Plain text – BOOKKEEPINGROCKSPlain text – BOOKKEEPINGROCKS Cipher text – JXXTTZZDOYBEXATUCipher text – JXXTTZZDOYBEXATU

Page 9: Vernam Cipher Project Preliminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

2008 Kutztown University 9

Substitution Cipher – ExampleSubstitution Cipher – ExampleHPFAIFJZIFYTPFTUVIJFBTPHWVFTHUVGHXXZHWIEMFVJXHAIUETTPITZHPFAIFJZIFYTPFTUVIJFBTPHWVFTHUVGHXXZHWIEMFVJXHAIUETTPITZ

EIYIFVHVNUCHTWDZIIJGIPUXJTPIWITZETPWTUKIWIXCIAHJIVTTPFTEIYIFVHVNUCHTWDZIIJGIPUXJTPIWITZETPWTUKIWIXCIAHJIVTTPFTFXXYIVFZIDZIFTIJIOEFXHPFAIFJZIFYTPFTUVIJFBUVTPIZIJPHXXWUCFXXYIVFZIDZIFTIJIOEFXHPFAIFJZIFYTPFTUVIJFBUVTPIZIJPHXXWUCNIUZNHFTPIWUVWUCCUZYIZWXFAIWFVJTPIWUVWUCCUZYIZWXFANIUZNHFTPIWUVWUCCUZYIZWXFAIWFVJTPIWUVWUCCUZYIZWXFAIUGVIZWGHXXKIFKXITUWHTJUGVTUNITPIZFTTPITFKXIUCKZUTPIZPIUGVIZWGHXXKIFKXITUWHTJUGVTUNITPIZFTTPITFKXI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KIFKXITURUHVPFVJWGHTPXHTTXIGPHTIKUBWFVJGPHTINHZXWFWWHWTIZWFVJKPFVJWGHTPXHTTXIGPHTIKUBWFVJGPHTINHZXWFWWHWTIZWFVJKZUTPIZWHPFAIFJZIFYTUJFBHPFAIFJZIFYTPFTUZUTPIZWHPFAIFJZIFYTUJFBHPFAIFJZIFYTPFTU

Page 10: Vernam Cipher Project Preliminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

2008 Kutztown University 10

Transposition CipherTransposition Cipher Generate permutation of n objectsGenerate permutation of n objects Transpose lettersTranspose letters Permutation of 0 through 7Permutation of 0 through 7

6 – 3 – 7 – 1 – 4 – 8 – 5 – 26 – 3 – 7 – 1 – 4 – 8 – 5 – 2 Yields value transpositionYields value transposition

1 1 6 6 2 2 3 3 3 3 7 7 4 4 1 1 5 5 4 4 6 6 8 8 7 7 5 5 8 8 2 2

Page 11: Vernam Cipher Project Preliminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

2008 Kutztown University 11

Transposition Cipher – ExampleTransposition Cipher – Example Cipher textCipher text

TYTSNHOAGTGERLUSHATEUAGNTIHVLBEAURRYTHHAOHTYTSNHOAGTGERLUSHATEUAGNTIHVLBEAURRYTHHAOHUUCGLGOATHYTNSUSGHTGREGNHLATUEEATAIHLVBEOTUUCGLGOATHYTNSUSGHTGREGNHLATUEEATAIHLVBEOTLUAHHNERDWTAANRODESUHIEVNETAAMINYNFENNOTOLUAHHNERDWTAANRODESUHIEVNETAAMINYNFENNOTORTSTIHFLAEAHAINSNTDEHBGAEVSYTREHEENFIHMNOIARRTSTIHFLAEAHAINSNTDEHBGAEVSYTREHEENFIHMNOIARSEPWDEEEEAUSRFPEALSYIBMMSAAIYTROINBNSYEOKNMSEPWDEEEEAUSRFPEALSYIBMMSAAIYTROINBNSYEOKNMECCOOLUEDRYADMECRSAOEAECSNEHEWFNTLHONRDISBECCOOLUEDRYADMECRSAOEAECSNEHEWFNTLHONRDISBAEYFOUOURTSSSPSTEOLFDHIFEELWEOHTIRETDHIWREAEIAEYFOUOURTSSSPSTEOLFDHIFEELWEOHTIRETDHIWREAEIASNVVABKLRIEYMSHNEEEGANIRONPECLHFITNUFAAOIRNASNVVABKLRIEYMSHNEEEGANIRONPECLHFITNUFAAOIRNGHCRBKOTAEHEUCKRGNNLSDEIAIMNTAGKSSMICELSOOTGHCRBKOTAEHEUCKRGNNLSDEIAIMNTAGKSSMICELSOOTOEFDLNTGHIIENNNIDMNNAAABSOYTETNNDEWOIRYOWWOEFDLNTGHIIENNNIDMNNAAABSOYTETNNDEWOIRYOWWNHLSLDIEAGYNECSHOCMTNETOSHIMTIIEGNHLTOHFNETRNHLSLDIEAGYNECSHOCMTNETOSHIMTIIEGNHLTOHFNETRINMSCBLUHLOSOWWSYOBSWULLWEATSRTWTOHDOEKLSINMSCBLUHLOSOWWSYOBSWULLWEATSRTWTOHDOEKLSNBLDRIARHEITMIGSBIEETRMTNHTGOAIEIAMNDREAGBIANBLDRIARHEITMIGSBIEETRMTNHTGOAIEIAMNDREAGBIAOSNSFTYLEIOONTNGHTIOAIEDTIRESRWAYVAMDEBTFIALOSNSFTYLEIOONTNGHTIOAIEDTIRESRWAYVAMDEBTFIALEAONNGRENSDTEHIONRCDLWOIANDRSWWUNRTCCHOALEAONNGRENSDTEHIONRCDLWOIANDRSWWUNRTCCHOALSHLRWIGDAEIPNAYMNOSOAETHRTEUSTALUGEGNGIALHVSHLRWIGDAEIPNAYMNOSOAETHRTEUSTALUGEGNGIALHVEATRBTTYHAHUCGULHORNRACDLIACRMCMUAOCHORYNEATRBTTYHAHUCGULHORNRACDLIACRMCMUAOCHORYNOPCRONYNOOOPCRONYNOO

Page 12: Vernam Cipher Project Preliminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

2008 Kutztown University 12

Vigenere CipherVigenere Cipher Polyalphabetic substitutionPolyalphabetic substitution Use n randomly generated substitutionsUse n randomly generated substitutions

11stst letter is encoded by 1 letter is encoded by 1stst substitution alphabet substitution alphabet 22ndnd letter is encoded by 2 letter is encoded by 2ndnd substitution alphabet substitution alphabet . . .. . . nnthth letter is encoded by n letter is encoded by nthth substitution alphabet substitution alphabet n+1n+1stst letter is encoded by 1 letter is encoded by 1stst substitution alphabet substitution alphabet etc.etc.

Page 13: Vernam Cipher Project Preliminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

2008 Kutztown University 13

Vigenere – Simple ExampleVigenere – Simple Example

Key = 3752Key = 3752 Successive letters are shifted by 3, 7, 5, 2Successive letters are shifted by 3, 7, 5, 2 Plain text – BOOKKEEPINGROCKSPlain text – BOOKKEEPINGROCKS Cipher text – EVTMNLJRLULTRJPUCipher text – EVTMNLJRLULTRJPU Eliminates double lettersEliminates double letters Scatters N-gramsScatters N-grams

Page 14: Vernam Cipher Project Preliminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

2008 Kutztown University 14

Vigenere CipherVigenere Cipher AdvantagesAdvantages

Creates confusionCreates confusion Same letter can be encoded n different waysSame letter can be encoded n different ways Pretty much eliminates n-gramsPretty much eliminates n-grams Keyspace > 26!Keyspace > 26!

Page 15: Vernam Cipher Project Preliminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

2008 Kutztown University 15

Vigenere CipherVigenere Cipher le chiffre indéchiffrablele chiffre indéchiffrable Named for Blaise de Vigenère Named for Blaise de Vigenère Invented by Giovan Battista Bellaso Invented by Giovan Battista Bellaso

ca. 1550ca. 1550 Broken byBroken by

Charles Babbage in 1854 (unpublished)Charles Babbage in 1854 (unpublished) Major Friedrich Kasiski in 1863Major Friedrich Kasiski in 1863

» Prussian infantry officePrussian infantry office

Page 16: Vernam Cipher Project Preliminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

2008 Kutztown University 16

Vigenere Cipher – ExampleVigenere Cipher – ExampleT KRCST KRCS L GILOX WYHH ZQV KOJ WYPG YDKPCY ZZSZ CLJL IA DEK ZTYV VIE WYL HCXV 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 TSLQZUU ZI ZAG NUVLR: "HH YVZO WYLGP WIBHSV KV PP VVST-PYZKSYW: KOOE DCS APQ RYS NUVHHPG VXILO."APQ RYS NUVHHPG VXILO."

Z OOGH R KFPDD AVLW FUS ODP VB EKV YSO KZSZD RW NSZUXPO EKV ZCYV FM TZUDLF 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 DORCSD DEK HSH JVBD RW MCCPVY GWDML CHQVYG HLCS PP DSSS ER JPH ORNU HZJVAVPU RA HSH KHPWH FM PCRKOSCKFVR.HZJVAVPU RA HSH KHPWH FM PCRKOSCKFVR.

T KRCST KRCS L GILOX WYHH ZQV KOJ HMLB EKV ZHLWV VT XLJZWDVZWDT, D JAOEH L GILOX WYHH ZQV KOJ HMLB EKV ZHLWV VT XLJZWDVZWDT, D JAOEH JDSWWVYWYJ NPHS WYL VPDK VT TQABGELTL, GHHCASCLEN KTWY AVP KVHH ZI JDSWWVYWYJ NPHS WYL VPDK VT TQABGELTL, GHHCASCLEN KTWY AVP KVHH ZI FWDCHJZWZQ, NPZW EV AFLQJMCCPVK WYWF HB ZDJPG ZI WYSPGFT OYG ABGELTL.FWDCHJZWZQ, NPZW EV AFLQJMCCPVK WYWF HB ZDJPG ZI WYSPGFT OYG ABGELTL.

W SDMLW SDML O OUVHA EKRA AJ IFBF WLKAZP FYPZOUVU KTOC VBP GRF ZTYV PB L QRAWZQ 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 NOSCH KOSJ ZZSZ YRK IS UXUNSO EP AVP FFSCC RW AVPLI ZYTQ SBH MB KOS NREASYW FM HSHZY QSDIHQEHI.NREASYW FM HSHZY QSDIHQEHI.

P VLYV H RCHRT HZGRF.P VLYV H RCHRT HZGRF.W SDMLW SDML O OUVHA EKRA CYH UHM, ORNU WY DCHPLPR, DWEK ZAG GLTPCFV IHQTVKZ, O OUVHA EKRA CYH UHM, ORNU WY DCHPLPR, DWEK ZAG GLTPCFV IHQTVKZ,

KTWY PHD JFCSCQFY VLYZUU SLJ SWAV UYWASZUU HLKO HSH NVFOV FM KTWY PHD JFCSCQFY VLYZUU SLJ SWAV UYWASZUU HLKO HSH NVFOV FM WYWVYDZVZAWZQ RUR YXCSWQLTHHTRE; VBP GRF FTJYA HSHIL WY DCHPLPR, WYWVYDZVZAWZQ RUR YXCSWQLTHHTRE; VBP GRF FTJYA HSHIL WY DCHPLPR, SWEWCL PWDTR PZBJ HBO ECHQV JZYZD ZZSZ MH RIZP WF QCTQ YHBOV NPHS OZAHWH SWEWCL PWDTR PZBJ HBO ECHQV JZYZD ZZSZ MH RIZP WF QCTQ YHBOV NPHS OZAHWH NOWEH SVMD DEK KSLKL UTUCZ OD VZZHPUJ HBO EIVHSHIZ.NOWEH SVMD DEK KSLKL UTUCZ OD VZZHPUJ HBO EIVHSHIZ.

W SDMLW SDML O OUVHA ERUHM. O OUVHA ERUHM.T KRCST KRCS L GILOX WYHH ZQV KOJ HMLFJ YRSZPB JOOWO SL SIDCASO, HMLFJ KZSZ LQU L GILOX WYHH ZQV KOJ HMLFJ YRSZPB JOOWO SL SIDCASO, HMLFJ KZSZ LQU

TCFQKHWY VYHZW EV TOOH TCFQKHWY VYHZW EV TOOH

Page 17: Vernam Cipher Project Preliminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

2008 Kutztown University 17

Vigenere Cipher – Example AnalysisVigenere Cipher – Example AnalysisTK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liminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

2008 Kutztown University 18

Vigenere Cipher – Example AnalysisVigenere Cipher – Example AnalysisTKRCSTKRCSLGILOLGILOXWYHHZQVKOXWYHHZQVKOJWYPGYDKPCJWYPGYDKPCYZZSZCLJLIYZZSZCLJLIADEKZTYVVIADEKZTYVVIEWYLHCXVTSEWYLHCXVTSLQZUUZIZAGLQZUUZIZAGNUVLRHHYVZNUVLRHHYVZOWYLGPWIBHOWYLGPWIBHSVKVPPVVSTSVKVPPVVSTPYZKSYWKOOPYZKSYWKOOEDCSAPQRYSEDCSAPQRYSNUVHHPGVXINUVHHPGVXILOZOOGHRKFLOZOOGHRKFPDDAVLWFUSPDDAVLWFUSODPVBEKVYSODPVBEKVYSOKZSZDRWNSOKZSZDRWNSZUXPOEKVZCZUXPOEKVZCYVFMTZUDLFYVFMTZUDLFDORCSDDEKHDORCSDDEKHSHJVBDRWMCSHJVBDRWMCCPVYGWDMLCCPVYGWDMLCHQVYGHLCSPHQVYGHLCSPPDSSSERJPHPDSSSERJPHORNUHZJVAVORNUHZJVAVPURAHSHKHPPURAHSHKHPWHFMPCRKOSWHFMPCRKOSCKFVRCKFVRTKRCSTKRCSLGILOXWYHHLGILOXWYHHZQVKOJHMLBZQVKOJHMLBEKVZHLWVVTEKVZHLWVVTXLJZWDVZWDXLJZWDVZWDTDJAOEHJDSTDJAOEHJDSWWVYWYJNPHWWVYWYJNPHSWYLVPDKVTSWYLVPDKVTTQABGELTLGTQABGELTLG

Page 19: Vernam Cipher Project Preliminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

2008 Kutztown University 19

Vigenere Cipher – Example AnalysisVigenere Cipher – Example AnalysisHHCASCLENKHHCASCLENKTWYAVPKVHHTWYAVPKVHHZIFWDCHJZWZIFWDCHJZWZQNPZWEVAFZQNPZWEVAFLQJMCCPVKWLQJMCCPVKWYWFHBZDJPGYWFHBZDJPGZIWYSPGFTOZIWYSPGFTOYGABGELTLWYGABGELTLWSDMLSDMLOOUVHAOOUVHAEKRAAJIFBFEKRAAJIFBFWLKAZPFYPZWLKAZPFYPZOUVUKTOCVBOUVUKTOCVBPGRFZTYVPBPGRFZTYVPBLQRAWZQNOSLQRAWZQNOSCHKOSJZZSZCHKOSJZZSZYRKISUXUNSYRKISUXUNSOEPAVPFFSCOEPAVPFFSCCRWAVPLIZYCRWAVPLIZYTQSBHMBKOSTQSBHMBKOSNREASYWFMHNREASYWFMHSHZYQSDIHQSHZYQSDIHQEHIPVLYVHREHIPVLYVHRCHRTHZGRFWCHRTHZGRFWSDMLSDMLOOUVHAOOUVHA

Page 20: Vernam Cipher Project Preliminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

2008 Kutztown University 20

Deciphering VigenereDeciphering Vigenere Determine the number of alphabetsDetermine the number of alphabets

Compute distances between matching sequencesCompute distances between matching sequences Compute GCD of distancesCompute GCD of distances

Treat cipher text as n separate textsTreat cipher text as n separate texts For each separate text & each of 25 possible shiftsFor each separate text & each of 25 possible shifts

Compute Index of CoincidenceCompute Index of Coincidence based on frequencies found in cipher textbased on frequencies found in cipher text using table of frequencies of letters in Englishusing table of frequencies of letters in English

Index of Coincidence formulaIndex of Coincidence formula fee = fee = {relFreqTab(k, ciphLet) * {relFreqTab(k, ciphLet) *

charFreq(ciphLet)}charFreq(ciphLet)}

Page 21: Vernam Cipher Project Preliminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

2008 Kutztown University 21

Frequency Table – EnglishFrequency Table – English

A 0.08; B 0.015; C 0.03; D 0.04; E 0.13; 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.005F 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.08K 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.09P 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.02U 0.03; V 0.01; W 0.015; X 0.005; Y 0.02

Z 0.002Z 0.002

Page 22: Vernam Cipher Project Preliminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

2008 Kutztown University 22

Vigenere – Final StepVigenere – Final Step Produce possible plain textsProduce possible plain texts

using combination ofusing combination of highest ranking fee table valueshighest ranking fee table values

Choose best plain textChoose best plain text This step can be automatedThis step can be automated

Rate each possible plain textRate each possible plain text using n-gram informationusing n-gram information or list of 5 letter words in Englishor list of 5 letter words in English

Page 23: Vernam Cipher Project Preliminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

2008 Kutztown University 23

Vernam CipherVernam Cipher Gilbert Sandford Vernam – inventorGilbert Sandford Vernam – inventor

Also known as one-time padAlso known as one-time pad Invented ca. 1919Invented ca. 1919

Proven unbreakable by Claude ShannonProven unbreakable by Claude Shannon Communication Theory of Secrecy SystemsCommunication Theory of Secrecy Systems 19491949

Unbreakable if and only ifUnbreakable if and only if Key is same length as plain textKey is same length as plain text Key is never re-usedKey is never re-used

Page 24: Vernam Cipher Project Preliminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

2008 Kutztown University 24

Vernam CipherVernam Cipher Basic operation – bitwise XORBasic operation – bitwise XOR XOR tableXOR table

0 xor 0 = 00 xor 0 = 0 0 xor 1 = 10 xor 1 = 1 1 xor 0 = 11 xor 0 = 1 1 xor 1 = 01 xor 1 = 0

Plain text is represented as bit streamPlain text is represented as bit stream Key is random bit stream of same lengthKey is random bit stream of same length Cipher text is produced via bitwise XOR of Cipher text is produced via bitwise XOR of

plain bit stream and key bit stream.plain bit stream and key bit stream.

Page 25: Vernam Cipher Project Preliminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

2008 Kutztown University 25

Vernam Cipher – ExampleVernam Cipher – Example Plain text :: Grade = A – Great!Plain text :: Grade = A – Great! Plain text in ASCIIPlain text in ASCII

71 114 97 100 101 32 61 32 65 32 45 32 71 114 97 100 101 32 61 32 65 32 45 32 71 114 101 97 116 33 71 114 101 97 116 33

Plain text as bit streamPlain text as bit stream 01000111 01110010 01100001 01100100 01000111 01110010 01100001 01100100

01100101 00100000 00111101 00100000 01100101 00100000 00111101 00100000 01000110 00100000 10010110 00100000 01000110 00100000 10010110 00100000 01010011 01101111 01110010 01110010 01010011 01101111 01110010 01110010 01111001 0010000101111001 00100001

Page 26: Vernam Cipher Project Preliminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

2008 Kutztown University 26

Vernam Cipher – ExampleVernam Cipher – Example Key as bit streamKey as bit stream

11000001 01110000 11011110 10111001 01100001 11000001 01110000 11011110 10111001 01100001 10001000 01101100 11111010 00110011 10001000 01101100 11111010 00110011

01001110 01111001 00011110 00001000 10010001 01001110 01111001 00011110 00001000 10010001 10100100 01000000 10000000 0100001010100100 01000000 10000000 01000010

Cipher text as bit streamCipher text as bit stream 10000110 00000010 10111111 11011101 00000100 10000110 00000010 10111111 11011101 00000100

10101000 01010001 11011010 01110010 10101000 01010001 11011010 01110010

01101110 01010100 00111110 01001111 11100011 01101110 01010100 00111110 01001111 11100011 11000001 00100001 11110100 0110001111000001 00100001 11110100 01100011

Page 27: Vernam Cipher Project Preliminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

2008 Kutztown University 27

Vernam Cipher – Why UnbreakableVernam Cipher – Why Unbreakable Try attack by exhaustive searchTry attack by exhaustive search Among possible keysAmong possible keys

11000001 01110000 11011110 10111001 11000001 01110000 11011110 10111001 01100001 10001000 01101100 11111010 01100001 10001000 01101100 11111010 00110100 01001110 01111001 00011110 00110100 01001110 01111001 00011110 00011100 10001100 10110011 01010011 00011100 10001100 10110011 01010011 10001101 0100001010001101 01000010

Produces this recovered plain text:Produces this recovered plain text: Grade = F – Sorry!Grade = F – Sorry!

Page 28: Vernam Cipher Project Preliminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

2008 Kutztown University 28

Vernam Cipher – Why UnbreakableVernam Cipher – Why Unbreakable Exhaustive search will produce every Exhaustive search will produce every

possible combination of 18 characters.possible combination of 18 characters. And there is no way to distinguish between And there is no way to distinguish between

themthem Among the possible recovered texts:Among the possible recovered texts:

Tickle me Elmo nowTickle me Elmo now Jabberwocky Rocks!Jabberwocky Rocks! Attack tomorrow amAttack tomorrow am Attack tomorrow pmAttack tomorrow pm Grade = C++ & JavaGrade = C++ & Java

Page 29: Vernam Cipher Project Preliminaries CSC112 March 14, 2011 Oskars J. Rieksts Computer Science Department Kutztown University

2008 Kutztown University 29

Vernam Cipher – Why Look Vernam Cipher – Why Look Elsewhere?Elsewhere?

Key distribution problemKey distribution problem Every sender/recipient must have same padEvery sender/recipient must have same pad N sender recipient pairs require N sender recipient pairs require OO(N(N22) pads) pads Pad distribution is security riskPad distribution is security risk

Key coordination problemKey coordination problem Sheets on pad must match exactlySheets on pad must match exactly Messages must arrive in order sentMessages must arrive in order sent

Key generation problemKey generation problem High quality random numbers hard to generateHigh quality random numbers hard to generate

Bottom line – has some limited useBottom line – has some limited use