Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Here is the header code: #ifndef PROJ05_FOURSQUARE #define PROJ05_FOURSQUARE #include using std:: string; string clean_string(string s); string create_encoding(string key); string encode_digraph(string dg, string block1, string

image text in transcribedimage text in transcribedimage text in transcribed

Here is the header code:

#ifndef PROJ05_FOURSQUARE #define PROJ05_FOURSQUARE #include using std:: string; string clean_string(string s); string create_encoding(string key); string encode_digraph(string dg, string block1, string block2); string decode_digraph(string dg, string block1, string block2); string encode(string msg, string key1, string key2); string decode(string msg, string key1, string key2); #endif 
Keywords Block 1 represents an encoding of the keyword "example". The letters are enumerated, starting with the keyword, so that only 1 occurrence of each letter is represented. Thus, the first letters in Block 1 are "exampl" (note the last 'e' is not included, it is already in the block). Subsequently all the letters that are not represented are place in the block in alphabetical order! The same is then done for Block 2 using the keyword "keyword". Encoding Encoding uses the 4 blocks to encode a message in groups of two characters. Note that the underlying message is assumed to have an even number of letters, and if not the letter 'x' is added arbitrarily at the end of the message. Let's encode (as the Wikipedia does) "Hello World!" First, we process the message so that it consists of only alphabetic, lower case letters. Thus we will actually be encoding "helloworld". Done in pairs, the first digraph (an example of two letters) is "he". Lets encode that: 0 0 1 2 3 4 0 1 2 34 0 1 2 3 4 0 1 2 3 4 We look up the two letters of "he", the first, 'h', in Block 0 and the second, 'e' in Block 2. We use their location as a way to access letters in the same row and column in Blocks 1 and 3. The 'h' and 'e' point to 'f in Block 1 and 'y' in Block 3. The first two letters are therefore encoded as 'fy' in that order. Keep repeating that process for every pair of letters in the message, you get: "fyhghzhsje". Follow the blue arrows for encoding Keywords Block 1 represents an encoding of the keyword "example". The letters are enumerated, starting with the keyword, so that only 1 occurrence of each letter is represented. Thus, the first letters in Block 1 are "exampl" (note the last 'e' is not included, it is already in the block). Subsequently all the letters that are not represented are place in the block in alphabetical order! The same is then done for Block 2 using the keyword "keyword". Encoding Encoding uses the 4 blocks to encode a message in groups of two characters. Note that the underlying message is assumed to have an even number of letters, and if not the letter 'x' is added arbitrarily at the end of the message. Let's encode (as the Wikipedia does) "Hello World!" First, we process the message so that it consists of only alphabetic, lower case letters. Thus we will actually be encoding "helloworld". Done in pairs, the first digraph (an example of two letters) is "he". Lets encode that: 0 0 1 2 3 4 0 1 2 34 0 1 2 3 4 0 1 2 3 4 We look up the two letters of "he", the first, 'h', in Block 0 and the second, 'e' in Block 2. We use their location as a way to access letters in the same row and column in Blocks 1 and 3. The 'h' and 'e' point to 'f in Block 1 and 'y' in Block 3. The first two letters are therefore encoded as 'fy' in that order. Keep repeating that process for every pair of letters in the message, you get: "fyhghzhsje". Follow the blue arrows for encoding

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

MongoDB Applied Design Patterns Practical Use Cases With The Leading NoSQL Database

Authors: Rick Copeland

1st Edition

1449340040, 978-1449340049

More Books

Students also viewed these Databases questions

Question

What is the use of bootstrap program?

Answered: 1 week ago

Question

What is a process and process table?

Answered: 1 week ago

Question

What is Industrial Economics and Theory of Firm?

Answered: 1 week ago

Question

Does it exceed two pages in length?

Answered: 1 week ago

Question

Does it avoid typos and grammatical errors?

Answered: 1 week ago