Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Oracle Autonomous Database In Enterprise Architecture

Authors: Bal Mukund Sharma, Krishnakumar KM, Rashmi Panda

1st Edition

1801072248, 978-1801072243

More Books

Students also viewed these Databases questions

Question

1. Discuss the four components of language.

Answered: 1 week ago

Question

a. How many different groups were represented?

Answered: 1 week ago