Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

In Visual Basics please using windows forms applications with a lot of comments. Introduction Encryption provide a method of increasing the privacy of the message

image text in transcribed

In Visual Basics please using windows forms applications with a lot of comments.

image text in transcribed

image text in transcribed

image text in transcribed

Introduction Encryption provide a method of increasing the privacy of the message sent with the more elaborate encryption techniques providing greater security. In this lab you will get practical experience in programing encryption and decryption methods. Caesar Cipher One of the earliest and simplest codes replaces each plaintext character with another character, called a monoalphabetic cipher or Caesar cipher, reputedly dating back to the days of Julius Caesar. For example, you might add 1 (the encryption key) to the ASCII code of each character. Thus, the plaintext message CAT gets encrypted as DBU. The decryption algorithm normally reverses the encryption steps. In the previous example, subtracting 1 from the ASCII codes of each cipher text character yields the original plain text character. Although Ceasar ciphers are simple to describe and certainly seem to yield unintelligible messages, they are relatively easy to decode. Polyalphabetic Cipher One way to add complexity is through a polyalphabetic cipher. Like the monoalphabetic cipher, it replaces each character with another. The difference is that a given plain text character is not always replaced with the same cipher text one. We choose a replacement depending not only on the actual plaintext character but on its position in the message as well. The following logic illustrates a simple example. P and C represent plain text and cipher text characters, respectively, K is the integer key, and M is the modulus. For each character p in the plain text, C = P + Key + (character position mod M) Suppose K = 1 and M = 3. Then 1 is added to the ASCII codes of characters in positions 0, 3, 6 and so on; 2 is added to the codes in positions 1, 4, 7, and so on; and 3 is added to the codes in positions 2, 5, 8, and so on. In this case the string THEMTHENTHEY is encrypted as UJHNVKFPWIG\. This cipher reduced but does not eliminate the repetition problem. Transposition Cipher In a transposition, the message is written out in rows of a fixed length, and then read out again column by column, and the columns are chosen in some scrambled order. Both the width of the rows and the order of the columns are usually defined by the order key. For example, column order of 4,2,6,1,3,5, has a row length of 6. To illustrate, suppose we have a column order of 2, 4, 3, 1, 5 for encrypting: FOLLOW THE YELLOW BRICK ROAD First arrange the message in rows 5 characters long. Column Numbers 3 E 0 0 Second, read them out in the column order of 2, 4, 3, 1, 5. This results in the following cypher text: 0 YwCALHLB LTE KDFW DIODELRR In order to decrypt message, the incoming characters are stored in columns in the order of the permutation. In this example, the incoming characters would be stored in column 2 followed by columns 4, 3, 1, and 5. Note that the length of the columns may not be the same. Your program will need to determine the number of incoming characters to store in each column. Bit-level XOR Ciphering This cypher is accomplished by taking a bit level XOR () of the binary representation of the character with a key. For example, the string "Wiki" (01010111 01101001 01101011 01101001 in 8-bit ASCII) can be encrypted with the repeating key of Hex 1B or Binary 00011011 as follows: 01010111 01101001 01101011 01101001 0 00011011 00011011 00011011 00011011 01001100 01110010 01110000 01110010 Hex: 4C 72 70 ASCII r r 72 And conversely, for decryption: 01001100 01110010 01110000 01110010 00011011 00011011 00011011 00011011 = 01010111 01101001 01101011 01101001 Hex: ASCII Wik Procedure In this lab assignment you will encrypt and decrypt any text file using the methods described above. The text file for testing are on e- conestoga (Jokes.txt and ABC.txt, MultiLine.txt). Use TestApp2020 located in the Lab 2 folder on e-conestoga to confirm your encryption/decryption is working properly. The key ranges for each of the different encryption types is provided in the table below: Encryption Method Polyalphabetic cipher Transposition cipher Bit-level ciphering Key Range 1 to 20 for both the shift and the mod 3 to 9 columns &H01 to &H1F Program Design The program could be organized as follows: Get the filenames from the user. Open the files. As each character is read from the input file, either encrypt or decrypt the character. Write the character to the output file. Close the files. Introduction Encryption provide a method of increasing the privacy of the message sent with the more elaborate encryption techniques providing greater security. In this lab you will get practical experience in programing encryption and decryption methods. Caesar Cipher One of the earliest and simplest codes replaces each plaintext character with another character, called a monoalphabetic cipher or Caesar cipher, reputedly dating back to the days of Julius Caesar. For example, you might add 1 (the encryption key) to the ASCII code of each character. Thus, the plaintext message CAT gets encrypted as DBU. The decryption algorithm normally reverses the encryption steps. In the previous example, subtracting 1 from the ASCII codes of each cipher text character yields the original plain text character. Although Ceasar ciphers are simple to describe and certainly seem to yield unintelligible messages, they are relatively easy to decode. Polyalphabetic Cipher One way to add complexity is through a polyalphabetic cipher. Like the monoalphabetic cipher, it replaces each character with another. The difference is that a given plain text character is not always replaced with the same cipher text one. We choose a replacement depending not only on the actual plaintext character but on its position in the message as well. The following logic illustrates a simple example. P and C represent plain text and cipher text characters, respectively, K is the integer key, and M is the modulus. For each character p in the plain text, C = P + Key + (character position mod M) Suppose K = 1 and M = 3. Then 1 is added to the ASCII codes of characters in positions 0, 3, 6 and so on; 2 is added to the codes in positions 1, 4, 7, and so on; and 3 is added to the codes in positions 2, 5, 8, and so on. In this case the string THEMTHENTHEY is encrypted as UJHNVKFPWIG\. This cipher reduced but does not eliminate the repetition problem. Transposition Cipher In a transposition, the message is written out in rows of a fixed length, and then read out again column by column, and the columns are chosen in some scrambled order. Both the width of the rows and the order of the columns are usually defined by the order key. For example, column order of 4,2,6,1,3,5, has a row length of 6. To illustrate, suppose we have a column order of 2, 4, 3, 1, 5 for encrypting: FOLLOW THE YELLOW BRICK ROAD First arrange the message in rows 5 characters long. Column Numbers 3 E 0 0 Second, read them out in the column order of 2, 4, 3, 1, 5. This results in the following cypher text: 0 YwCALHLB LTE KDFW DIODELRR In order to decrypt message, the incoming characters are stored in columns in the order of the permutation. In this example, the incoming characters would be stored in column 2 followed by columns 4, 3, 1, and 5. Note that the length of the columns may not be the same. Your program will need to determine the number of incoming characters to store in each column. Bit-level XOR Ciphering This cypher is accomplished by taking a bit level XOR () of the binary representation of the character with a key. For example, the string "Wiki" (01010111 01101001 01101011 01101001 in 8-bit ASCII) can be encrypted with the repeating key of Hex 1B or Binary 00011011 as follows: 01010111 01101001 01101011 01101001 0 00011011 00011011 00011011 00011011 01001100 01110010 01110000 01110010 Hex: 4C 72 70 ASCII r r 72 And conversely, for decryption: 01001100 01110010 01110000 01110010 00011011 00011011 00011011 00011011 = 01010111 01101001 01101011 01101001 Hex: ASCII Wik Procedure In this lab assignment you will encrypt and decrypt any text file using the methods described above. The text file for testing are on e- conestoga (Jokes.txt and ABC.txt, MultiLine.txt). Use TestApp2020 located in the Lab 2 folder on e-conestoga to confirm your encryption/decryption is working properly. The key ranges for each of the different encryption types is provided in the table below: Encryption Method Polyalphabetic cipher Transposition cipher Bit-level ciphering Key Range 1 to 20 for both the shift and the mod 3 to 9 columns &H01 to &H1F Program Design The program could be organized as follows: Get the filenames from the user. Open the files. As each character is read from the input file, either encrypt or decrypt the character. Write the character to the output file. Close the files

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions