Need Help ?

Home / Expert Answers / Other / help-asap2-example-3-1-background-in-cryptography-a-caesar-cipher-also-known-as-caesar-s-cipher-the-

(Answered): Help ASAP2.example 3: 1 Background In cryptography, a Caesar cipher, also known as Caesar's cipher, ...



Help ASAP

1 Background In cryptography, a Caesar cipher, also known as Caesars cipher, the shift cipher, Caesars code or Caesar shift

Problem Description Write a program using the Haskell programming language that implements the Vigenère cipher. Your program

Figure 2: Vigenère square used by the Vigenère cipher. The Vigenère cipher is an example of a polyalphabetic cipher because i

2.

Given the following grammar can you describe in English the set of strings it describes? S + a Sab Sbable Given the grammar i

example 3:

An unambiguous grammar for the same language E T E T F Expr+ Term ExprExpr+ Term ExprExpr - Term Term Factor Term Term * Fact

1 Background In cryptography, a Caesar cipher, also known as Caesar's cipher, the shift cipher, Caesar's code or Caesar shift, is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. For example, with a left shift of 3, D would be replaced by A, E would become B, and so on. The method is named after Julius Caesar, who used it in his private correspondence. This cipher is an example of monoalphabetic substitution cipher because it uses only one cipher alphabet per message. To confuse potential cryptanalysts, Leon Battista Alberti (born in 1404) proposed using two or more cipher alphabets and switching between them during encryption (see Figure 1). To understand how the Leon Battista Alberti cipher works, let us encipher the message hello. Encrypt the first letter h with the first cipher alphabet, the second letter e with the second cipher alphabet, the third letter l with the first cipher alphabet, the fourth letter 1 with the second cipher alphabet, and so on. Using this approach the plain text hello is enciphered as AFPAD. Plain alphabet a b c d e f g h i j k l m n o p q r s t u v w x y z Cipher alphabet 1 FZB VK I XAYMEPLSDH JORGNQ CUTW Cipher alphabet 2 GOX BEWTHQILAPZJDE S VY CRKUHN Figure 1: Multiple cipher alphabets Blaise de Vigenère (born 1523) refined Alberti's idea and turned it into a new cipher - Vigenère cipher - which uses twenty-six distinct cipher alphabets to encrypt a message (see Figure 2). Each cipher alphabet in the square is shifted by one letter with respect to the previous alphabet. Row 1 represents a cipher alphabet with a Caesar shift of 1, row 2 represents a cipher alphabet with a Caesar shift of 2, and so on. In the Vigenère cipher, a different row of the square (a different cipher alphabet) is used to encrypt different letters of the message. To decrypt the message, the intended receiver needs to know which row of the square has been used to decipher each letter. This calls for an agreed system of switching between rows, which is achieved by using a key phrase. We illustrate this process with an example. Let us encrypt the message divert troops to east ridge, using the key phrase WHITE. Position the key phrase (aka keyword) and the plaintext as shown in Figure 3. Each letter in the plaintext is associated with a letter from the keyword. To encrypt the first letter d, identify the key letter above it (which is W). This letter in turn defines a particular row in the Vigenère square. The row beginning with W (i.e., 22) is the cipher alphabet that will be used to find the substitute letter for the plaintext letter d. The substitute letter for d is Z. This process is repeated for the remaining letters in the plaintext. Longer keywords bring more rows into the encryption process and increase the complexity of the cipher. The great advantage of the Vigenère cipher is that it is not vulnerable to the frequency analysis, whereas the Caesar cipher is. Problem Description Write a program using the Haskell programming language that implements the Vigenère cipher. Your program should: 1. Read a key phrase from keyboard. This assignment is based on The Code Book: The Science of Secrecy from Ancient Egypt to Quantum Cryptography, by Simon Singh. Plain abcdefghij k l m n o p q r s t u v w x y z 1 BCDEFGHIJKLMNOPQRSTUVWX Y ZA 2 CDEFGHIJKLMNOPQRSTUVWX Y Z AB 3 DEFGHIJKLMNOPQRSTUVWX Y Z A BC 4 EFGHIJKLMNOPQRSTUVWX Y Z A B CD 5 FGHIJKLMNOPQRSTUVWX Y Z A B C DE 6 GHIJKLMNOPQRSTUVWXYZ ABCDEF 7 HIJKLMNOPQRSTUVWXYZ ABCDEFG 8 I J KLMNOPQRSTUVWX Y Z A B C D E F GH 9 JKLMNOPQRSTUVWXYZ ABCDEFGHI 10 KLMNOPQRSTUVWX Y Z ABCDEFGHIJ 11 LMNOPQRSTUVWX Y Z ABCDEFGHIJK 12 MNOPQRSTUVWX Y Z ABCDEFGH I J KL 13 NOPQRSTUVWXYZ ABCDEFGHIJKLM 14 OPQRSTUVWX Y Z A B C D E F G H I J K L MN 15 PQRSTUVWX Y Z ABCDEFGHIJKLMNO 16 QRSTUVWX Y Z A B C D E F G H I J K L MNOP 17 RSTU VWX Y Z ABCDEFGHIJKLMNOPQ STUVWXY ZABCDEFGHIJKLMNOPQR 19 TU VWX Y Z ABCDEFGHIJKLMNOPQRS 20 U VWX Y Z A B CDEFGHIJKLMNOPQRST 21 VWXYZ ABCDEFGHIJKLMNOPQRSTU 22 WX Y Z ABCDEFGHIJKLMNOPQRSTUV 23 XYZ ABCDEFGHIJKLMNOPQRSTUVW 24 Y ZABCDEFGHIJKLMNOPQRSTUVWX 25 ZABCDEFGHIJKLMNOPQRSTUVWXY 26 ABCDEFGHIJKLMNOPQRSTUVWXYZ 18 Figure 2: Vigenère square used by the Vigenère cipher. The Vigenère cipher is an example of a polyalphabetic cipher because it employs several cipher alphabets per message. Keyword WHITEWHITEWHITEWHITEWHI Plaintext diverttroops toe astridge Ciphertext ZPDXV PAZHSLZBHI WZB KMZ NM Figure 3: Vigenère cipher example 2. Read a message from keyboard. 3. Encrypt the message using the key phrase. 4. Print the encrypted message. 5. Decrypt the encrypted message using the key phrase. 6. Print the decrypted message. This should be same as the message read from the keyboard. Neither the key phrase nor the message should not be hardcoded into your solution. Instead, your program should work with any valid key phrase and message. Submission Submit your work as one file containing all your code, via Canvas. The name of the file should be either hw3.hs (in whielease i.e., it should compile with GHCi or repl.it ), or-hws.ipynb fin-whiel-case-it-should --withHaskell). Given the following grammar can you describe in English the set of strings it describes? S + a Sab Sbable Given the grammar in example (3) above, give a leftmost derivation for the following expression. Underline the non-terminal that is substituted at each step. (2 + 2 * 2) - (1/2) An unambiguous grammar for the same language E T E T F Expr+ Term ExprExpr+ Term ExprExpr - Term Term Factor Term Term * Factor Term Term / Factor Factor number Factor identifier Factor (Expr) 3 This grammar respects precedence rules. It also respects left-associativity,


We have an Answer from Expert

View Expert Answer

Expert Answer


Answer to 1 Background In cryptography, a Caesar cipher, also known as Caesar's cipher, the shift cipher, Caesar's code or Caesar ...

The Problem has Answer!

We have detailed solutions for you for more understanding.

View Answer