Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Background message in another text file, image or even sound file. It differs from cryptography in that the overall file/video/audio looks reasonably normal and still
Background message" in another text file, image or even sound file. It differs from cryptography in that the overall file/video/audio looks reasonably normal and still conveys information, making it hard to tell that there is a secret hidden inside. We are going to write a steganographic encoder/decoder for text We are going to take a plaintext message, one that anyone can read, and embed in that message a secret message which smone, whe knows the ende, ean deeipher The process is this. We are going to take the plaintext message, reduce the plaintext message to all lower case, then encode the secret message in the plaintext based on combinations of UPPER or lower case. Thus it is the scowcence of upper message that and lower ease letters in the plaintext encode our secret message. We do this as follows. Each individual letter of the secret message is turned into a binary string of 5 0's and I's Exactly 5 for each letter. We will only recognize letters and will ignore any other characters in the secret message. For each of these binary strings, we take the next 5 letters of the plaintext and modify them as follows: for every 0 in the secret message binary string we lower case the plaintext letter, for every 1 we upper case the letter. We do this only for letters, ignoring all other characters in the plaintext. Let's consider the following example. The secret message is "help "and the original text is "Mom please send more money!" The index of each letter is its position in the alphabet with aat 0, 2 at 25 Secret letter Letter index binary Encoded 5 letters moM PL eaSe s 15 01011 eNd MO 00111 00100 rE MON The new message, with the encoded secret message would be (hard to write with autocorrect) "moM PLeaSe seNd MOrE MONey!". As we said, we can only capitalize leters so we ignore (don't count as one of the 3 letters) any other character in the plaintext message which just gets passed through unaltered Reverse the process for decoding: take 3 letters from the encoded plaintext, ignoring any other characters, determine the binary string the capitalization indicates, and add the new letter that binary string represents as the next letter of the secret message. Rules of the Precess. we ignore non-alphabetic characters in the plaintext and pass them through to the encoded text as is we also ignore any non-alphabetic characters in the secret message. Those non-alphabetic characters will not be encoded. Thus spaces will be lost in decoding the secret message. as will any numbers of punctuation marks. if there are "Heft over" letters in the plaintext, letters we do not require to encode a portion of the secret message) we just pass them through into the encoded text unchanged. ifthere are not enough letters the Plainlexi to encode the secret message, that is an error condition and we indicate as such and quit. We mentioned that, if there are more letters than necessary to encode the secret message in the plaintext, then we just pass the "extra" letters through. On decoding that may create garbage at the end of our decoded message. That's OK e . * * . ASCII As a note, you don't need a string to turn a letter into an index number. The index order of an ascii letler can be found by subtracting the character a from any other lower-case letter. Thus the letter 'E' is index 3, found by 'E" "a". You did this in lab last week. Program Specifications string lower case (string s) e returns the lower case version of the imput string s, that is all alphabetie characters are converted to lower case. string to binay (char c) returns 5 bit string that is the index of the character argument if the provided character is not a lower-case alphabetic character, return the empty string- o char from binary(string bit stz) e returns the character that the bit binary string bit str represents. if any of the following conditions are not o true: the size of bit str is 5 s every element ofbit str must be a I" or a 0 the character produced must be a lower case letter return the character 0 (the NULL char) bool check sessage (string plaintext, string secret message returns true if there are at least Sx the count of characters in secret message as in plaintoxt, false otherwise Remember, only alphabetic characters matter, all other characters in the plaintext are ignored. We are counting whether there are enough useable characters in plaintext. string encode (string plaintext, string secret message) plaintext and secret message should be converted to lower case by lower case e the plaintext string should have been checked by check message o if check message is false, return the string "Error". otherwise returns encoded text encoded (as described) with the secret message string decode (string to_decode) e returns the original secret_message as a string if there were more characters in to decode than 5*characters in the secret-message, you will get extra message if the number of characters in to decode is not a multiple of 5, it will be ragged. By that I mean that you will get 4 or less characters at the end of to_decode. Since we cannot turn those characters into a secret message character (we need 5), they should be ignored. o characters at the end of the decoded o Deliverables You will turn in one file: proj05_functions.cpp inside a directory names proj05.We provide you with proj05_functions_05.h, as well as a main proj05_main.cpp you can use to test your functions. However, Mimir can test the individual functions without a main program which is how the tests are structured. It is still a good idea for you to test your own code with a main. This will be the last time we provide you with a main you can use to test your functions. You should start doing that yourself. Remember to include your section, the date, project number and comments and you do not provide main.cpp. If you turn in a main with your code Mimir it will be ignored. 1. 2. 3. Please be sure to use the specified file names Always a good idea to save a copy of your file in your H: drive on EGR. Submit to Mimir as always. There will be a mix of visible and not-visible cases. Assignment Notes 1. You turn in only the proj05/proj05 functions.cpp 2. The proj05_functions.h will be provided by Mimir as well as in the project directory Mimir will compile against the provided .h file, even if you provide one in the directory. Background message" in another text file, image or even sound file. It differs from cryptography in that the overall file/video/audio looks reasonably normal and still conveys information, making it hard to tell that there is a secret hidden inside. We are going to write a steganographic encoder/decoder for text We are going to take a plaintext message, one that anyone can read, and embed in that message a secret message which smone, whe knows the ende, ean deeipher The process is this. We are going to take the plaintext message, reduce the plaintext message to all lower case, then encode the secret message in the plaintext based on combinations of UPPER or lower case. Thus it is the scowcence of upper message that and lower ease letters in the plaintext encode our secret message. We do this as follows. Each individual letter of the secret message is turned into a binary string of 5 0's and I's Exactly 5 for each letter. We will only recognize letters and will ignore any other characters in the secret message. For each of these binary strings, we take the next 5 letters of the plaintext and modify them as follows: for every 0 in the secret message binary string we lower case the plaintext letter, for every 1 we upper case the letter. We do this only for letters, ignoring all other characters in the plaintext. Let's consider the following example. The secret message is "help "and the original text is "Mom please send more money!" The index of each letter is its position in the alphabet with aat 0, 2 at 25 Secret letter Letter index binary Encoded 5 letters moM PL eaSe s 15 01011 eNd MO 00111 00100 rE MON The new message, with the encoded secret message would be (hard to write with autocorrect) "moM PLeaSe seNd MOrE MONey!". As we said, we can only capitalize leters so we ignore (don't count as one of the 3 letters) any other character in the plaintext message which just gets passed through unaltered Reverse the process for decoding: take 3 letters from the encoded plaintext, ignoring any other characters, determine the binary string the capitalization indicates, and add the new letter that binary string represents as the next letter of the secret message. Rules of the Precess. we ignore non-alphabetic characters in the plaintext and pass them through to the encoded text as is we also ignore any non-alphabetic characters in the secret message. Those non-alphabetic characters will not be encoded. Thus spaces will be lost in decoding the secret message. as will any numbers of punctuation marks. if there are "Heft over" letters in the plaintext, letters we do not require to encode a portion of the secret message) we just pass them through into the encoded text unchanged. ifthere are not enough letters the Plainlexi to encode the secret message, that is an error condition and we indicate as such and quit. We mentioned that, if there are more letters than necessary to encode the secret message in the plaintext, then we just pass the "extra" letters through. On decoding that may create garbage at the end of our decoded message. That's OK e . * * . ASCII As a note, you don't need a string to turn a letter into an index number. The index order of an ascii letler can be found by subtracting the character a from any other lower-case letter. Thus the letter 'E' is index 3, found by 'E" "a". You did this in lab last week. Program Specifications string lower case (string s) e returns the lower case version of the imput string s, that is all alphabetie characters are converted to lower case. string to binay (char c) returns 5 bit string that is the index of the character argument if the provided character is not a lower-case alphabetic character, return the empty string- o char from binary(string bit stz) e returns the character that the bit binary string bit str represents. if any of the following conditions are not o true: the size of bit str is 5 s every element ofbit str must be a I" or a 0 the character produced must be a lower case letter return the character 0 (the NULL char) bool check sessage (string plaintext, string secret message returns true if there are at least Sx the count of characters in secret message as in plaintoxt, false otherwise Remember, only alphabetic characters matter, all other characters in the plaintext are ignored. We are counting whether there are enough useable characters in plaintext. string encode (string plaintext, string secret message) plaintext and secret message should be converted to lower case by lower case e the plaintext string should have been checked by check message o if check message is false, return the string "Error". otherwise returns encoded text encoded (as described) with the secret message string decode (string to_decode) e returns the original secret_message as a string if there were more characters in to decode than 5*characters in the secret-message, you will get extra message if the number of characters in to decode is not a multiple of 5, it will be ragged. By that I mean that you will get 4 or less characters at the end of to_decode. Since we cannot turn those characters into a secret message character (we need 5), they should be ignored. o characters at the end of the decoded o Deliverables You will turn in one file: proj05_functions.cpp inside a directory names proj05.We provide you with proj05_functions_05.h, as well as a main proj05_main.cpp you can use to test your functions. However, Mimir can test the individual functions without a main program which is how the tests are structured. It is still a good idea for you to test your own code with a main. This will be the last time we provide you with a main you can use to test your functions. You should start doing that yourself. Remember to include your section, the date, project number and comments and you do not provide main.cpp. If you turn in a main with your code Mimir it will be ignored. 1. 2. 3. Please be sure to use the specified file names Always a good idea to save a copy of your file in your H: drive on EGR. Submit to Mimir as always. There will be a mix of visible and not-visible cases. Assignment Notes 1. You turn in only the proj05/proj05 functions.cpp 2. The proj05_functions.h will be provided by Mimir as well as in the project directory Mimir will compile against the provided .h file, even if you provide one in the directory
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started