Question: Write a program that implements an elementary bit stream cipher. An elementary level bit stream cipher is an encryption algorithm that encrypts 1 byte of

 Write a program that implements an elementary bit stream cipher. An

elementary level bit stream cipher is an encryption algorithm that encrypts 1

Write a program that implements an elementary bit stream cipher. An elementary level bit stream cipher is an encryption algorithm that encrypts 1 byte of plain text at a time. This one uses a given 4-bit bit pattern as the key. The size of the encrypted message that we want to be able to send has a maximum length of 200 characters. You must: 1. prompt the user to input the clear text to be encrypted. You must use printf() to send the prompt to the user, 2. you must use the getchar program to read each ASCII clear text character and store it in a character array. Each character will be a lower case character. 3. when a ' ' character is detected, this indicates that the last character read in (not the ' ') was the last clear text character, 4. Use printf() to print out the received clear text so that the user can verify their input, 5. then use printf to print out the clear text as hexadecimal numbers rather than ASCII characters. The format should be 10 hexadecimal numbers per row and each number should be represented as 2 hexadecimal digits. 6. use printf() to prompt the user for a 4-bit key to encrypt the data (e.g. 0110, 1010, etc.) 7. use getchar() to read in each digit of the 4 digit key 8. Without storing the four digits of the key, create an 8-bit key from those 4 digits using the bitwise OR instruction. For example, if the user specifies 0110, then your internal key must be 0110 0110. As an alternative, you could use the bitwise OR instruction and a shift instruction. 9. Once you have created an 8-bit key, you must XOR the key with each character of clear text to get each character of cipher text. 10. Print out each hexadecimal cipher text value with 10 values per row. It should be similar to the output of the hex encoding above. enter cleartext: two fat dogs Text entered is: two fat dogs Hex encoding is: 74 77 6F 20 66 61 74 20 64 6F 67 73 enter 4-bit key: 0110 hex ciphertext: 12 11 09 46 00 07 12 46 02 09 01 15

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!