110 likes | 249 Views
General Process. E=Plaintext P= Numerical Representation Encryption E Decryption D C=E(P) P=D(C) C= Ciphertext C= Numerical Represeantion. Character Ciphers. Numerical Transformation:
E N D
General Process E=Plaintext P= Numerical Representation Encryption E Decryption D C=E(P) P=D(C) C= Ciphertext C= Numerical Represeantion
Character Ciphers Numerical Transformation: Restriction to the alphabet and to English work modulo 26 (finite representation of large to infinite number of words/plaintexts) Inverse modulo 26
Cryptology Tools section(online PARI/GP) • Frequency Count: cut-and-paste a block of text to return the counts of letters from A to Z. • Letter Block Count: to count the frequency of blocks of consecutive letters (bigrams, trigrams, etc.) in a text. • Subtext Count: This tool gives the letter frequencies of a subtext of a given text, consisting of each n-th letter starting with the k-th one. • Caesar Cipher: This tool encodes and decodes according to the simple shift cipher • Affine Ciphers: This encodes and decodes texts by affine transformations C= s(P+t) NOT C=sP+t. • General Monoalphabetic Cipher: This encodes and decodes text using a monoalphabetic substitution. • Babbage-Kasiski Method: This tool tabulates repeated blocks in any text and gives the distances (in numbers of letters) between the repetitions. The method of Babbage and Kasiski involves looking for common factors in these distances as a guess for the length of the keyword. The distances are factored to aid this guess. Friedman's Method: This tool calculates the index of coincidence of any text and uses that to guess the length of the keyword (or more generally the number of alphabets in a polyalphabetic cipher). • Subtext Count: This is the same tool as mentioned above for counting subtext frequencies. Once you have a reasonable guess for the keyword length, use this tool to guess the individual keyword letters. • Keyword Guesser: This tool is a shortcut that guesses the keyword based on the keylength and on identifying the most common cipher letter as the translation of `E'. This is not always a good choice! • Frequency Chart Alignment: Use this tool to additively shift a ciphertext to fit the pattern of English letter frequencies.
8.2.1 Vigenere Ciphers (see web & pages 287-292) • Consists of a Keywordof length n: l1 l2… ln • It numerical equivalence is then: k1 k2… kn • Split plaintext into blocks of length n: p1 p2… pn • Transform it into ciphertext blocks: c1 c2… cn Such that: ci = pi + ki (mod 26) for i=1,2,…,n or C=P+L C =(c1, c2, … , cn) P=(c1, c2, … , cn) L =(c1, c2, … , cn) To decrypt: pi = ci - ki (mod 26) for i=1,2,…,n • A dummy letter can be used for a terminal block of less than n letters
8.2.1 Cryptanalysis of Vigenere Ciphers • Less vulnerable to cryptanalysis than Character Ciphers. • If the specific length n of the block is known, breakable using Letter Frequencies. • Unbreakable for many years since not easy to find n. • Find/guess n using Kasiski method (Prussuan military officer, although it was found earlier by Babbage/British military) • Check that the validity of the guessed length n using index of coincidence method by Friedman
Kasiski Method to guess the length n Theorem:Supppse a plaintext message is encrypted using Vigenere cipher. Then Identical strings of characters separated by a multiple of the key length are encrypted to the same string of ciphertext characters • Let n be the key length • k1 k2… kn the numerical equivalents of the letters of the keyword. • Divide the plaintext p1 p2… pj...... into blocks of length n: p1 p2… pn • If pi = pj are separated by a multiple of the key length n|(j-i ) j = i + a n • Assume pi is at the position m in its block • Then pj will be in the same position m in its own block. • So the encryption: ci ≡ pi + km ≡ pj + km ≡ cj (mod 26).
Kasiski Method Example: • Ciphertext : RHPVQ QLHQL GSHYM PYZLV EUSDZ MNLLB AOUVQ QTZRN JIAWT CESVM RHHQB FEZHI QAUGI LDPVI ZOBWB FRLHU GLLVT MNNLB QBYHI BTODB LOWRQ LTLAK CEKVI OUHUB CRVII KISHQ RIZVM NAYDB CDMUW KTOHU YIUOI LDIBI QCHUK CLFSM PCLSB GBSHK PELNW MZPQO GTZZI WTOUW SGODE GLKHZ LEZVW DRLHL QAUGA JITHI DACRZ GTLUM QOYWW DTOHU YRZKP CNAKM TENHB YTPRV YSTLO FTIHA SPWRA CDPVA AAUWW PAAOM YSAGE YRMLA FNVWZ CEZRN YNFPI ENPWC BEHUM ROIHA CEUQM YRAKM UEZWM PNLAB PETLB WWOHZ CFVUB KOBOB PILVB YNKVI LDDKM PEHUM QOTHU GSLUI ZLLIZ YMLEC GLKLV ESAHV YNAHL BUYLV ESBPU CRIBB FEMXO GTPYM QFYRU AHHUT CSARV BUZWI LDMHD CRTDG ZEMRC LDPQL CEKWP CBYLA RLFSI JMLWB MBBWB FEDKW JEPVT YNKZQ RHAKM CXJHX RIVQW DTOLA UEZWM PNWRQ LTHQL YLPQM MFODZ BWOLB CBLDK FOUWP CSLDK MAZWQ QCVYM PEKZQ RHHGM LSLXV BEYJZ MWAKW DTOHA UELWU WRAOM QOTXK FPYLH CDIBB FEORZ RIJXT RUYLA RSVIM LGSDV BTOHA FRBEP CRLRN REUDB RAPQA RHLKM GGOWW DFPIB CEURZ RWLQB WFLHB YNKIW PMZDV YLTRA RITSM LEAUI ZLLFW NPPFM ZUYWP CNPQO RHLDQ PWPWP GTZIZ YGYDV AE
Identical strings of m (>2) letters • Find at most ten blocks of length 4 that occur at least 2 times. Listed are the distances between the first letters of two consecutive blocks • WDTO (2)(5)(31) (5)(17) • QAUG (2^5)(5) • IBBF (2^2)(5)(11) • IZLL (5)(73) • UEZW (2)(3)(5)(7) • YLAR (5^2)(7) • ZWMP (2)(3)(5)(7) • BWBF (2)(3^2)(5^2) • LVES (3)(5) The greatest common divisor is 5 guess n=5
Count Letter Frequencies in the n Subsequences • Count every n=5 letters starting from letter number 1 1st letter of the key • Subsequence of text: R Q G P E M A Q J C R F Q L Z F G M Q B L L C O C K R N C K Y L Q C P G P M G W S G L D Q J D G Q D Y C T Y Y F S C A P Y Y F C Y E B R C Y U P P W C K P Y L P Q G Z Y G E Y B E C F G Q A C B L C Z L C C R J M F J Y R C R D U P L Y M B C F C M Q P R L B M D U W Q F C F R R R L B F C R R R G D C R W Y P Y R L Z N Z C R P G Y A • Letter Counts: A 4 B 7 C 22 D 6 E 4 F 10 G 11 H 0 I J 4 K 3 L 12 M 7 N 2 O 1 P 12 Q 11 R 17 S 2 T 1 U 3 V 0 W 4 X 0 Y 16 Z 5 • C E, thus E+ k1 = C, i.e., k1 = C-E =2-4=-2≡ 24 (mod 26) ≡ Y (mod 26)
Do the same for positions 2, 3, 4 and 5 1st letter Y 2nd letter A 3rd letter H 4th letter D 5th letter I Thus the Key is YAHDI
Decrypt using key “YAHDI” This Island is a very singular one. It consists of little else than the sea sand, and is about three miles long. Its breadth at no point exceeds a quarter of a mile. It is separated from the main land by a scarcely perceptible creek, oozing its way through a wilderness of reeds and slime, a favorite resort of the marsh-hen. The vegetation, as might be supposed, is scant, or at least dwarfish. No trees of any magnitude are to be seen. Near the western extremity, where Fort Moultrie stands, and where are some miserable frame buildings, tenanted, during summer, by the fugitives from Charleston dust and fever, may be found, indeed, the bristly palmetto; but the whole island, with the exception of this western point, and a line of hard, white beach on the seacoast, is covered with a dense undergrowth of the sweet myrtle, so much prized by the horticulturists of England. The shrub here often attains the height of fifteen or twenty feet, and forms an almost impenetrable coppice, buhening the air with its fragrance.