讲解:CSE 232、c/c++、Programming、c/c++Haskell|Haskell

CSE 232 Spring 2019Programming Project 05Assignment OverviewThis assignment is worth 40 points (4.0% of the course grade) and must be completed and turnedin before 11:59pm on Monday, Feb 25th. Thats two weeks because of the midterm on Thur, Feb14th.BackgroundSteganographySteganography (https://en.wikipedia.org/wiki/Steganography) is the process of hiding a secretmessage in another text file, image or even sound file. It differs from cryptography in that theoverall file/video/audio looks reasonably normal and still conveys information, making it hard totell that there is a secret hidden inside. We are going to write a steganographic encoder/decoderfor text.A Simple SteganographyWe are going to take a plaintext message, one that anyone can read, and embed in that message asecret message which someone, who knows the code, can decipher.The process is this. We are going to take the plaintext message, reduce the plaintext message toall lower case, then encode the secret message in the plaintext based on combinations ofUPPER or lower case. Thus it is the sequence of upper and lower case letters in the plaintextmessage that encode our secret message.We do this as follows. Each individual letter of the secret message is turned into a binary stringof 5 0s and 1s. Exactly 5 for each letter. We will only recognize letters and will ignore any othercharacters in the secret message. For each of these binary strings, we take the next 5 letters of theplaintext and modify them as follows: for every 0 in the secret message binary string we lowercase the plaintext letter, for every 1 we upper case the letter. We do this only for letters, ignoringall other characters in the plaintext. Lets consider the following example. The secret message ishelp and the original text is Mom please send more money! The index of each letter is itsposition in the alphabet with a at 0, z at 25.Secret letter h e l pLetter index 7 4 11 15binary 00111 00100 01011 01111Encoded 5 letters moM PL eaSe s eNd MO rE MONThe 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 letters so we ignore(don’t count as one of the 5 letters) any other character in the plaintext message which just getspassed through unaltered.Reverse the process for decoding: take 5 letters from the encoded plaintext, ignoring any othercharacters, determine the binary string the capitalization indicates, and add the new letter thatbinary string represents as the next letter of the secret message.Rules of the Process. we ignore non-alphabetic characters in the plaintext and pass them through to theencoded text as is. we also ignore any non-alphabetic characters in the secret message. Those non-alphabeticcharacters will not be encoded. Thus spaces will be lost in decoding the secret message,as will any numbers of punctuation marks. if there are left over letters in the plaintext, letters we do not require to encode a portionof the secret message) we just pass them through into the encoded text unchanged. if there are not enough letters in the plaintext to encode the secret message, that is anerror condition and we indicate as such and quit. We mentioned that, if there are more letters than necessary to encode the secret messagein the plaintext, then we just pass thCSE 232留学生作业代做、代写c/c++程序设计作业、Programming作业代做、代写c/c++实验作业 帮做He extra letters through. On decoding that may creategarbage at the end of our decoded message. That’s OKASCIIAs a note, you dont need a string to turn a letter into an index number. The index order of anascii letter can be found by subtracting the character a from any other lower-case letter. Thusthe letter f is index 5, found by f – a . You did this in lab last week.Program Specificationsstring lower_case(string s) returns the lower case version of the input string s, that is all alphabetic characters areconverted to lower case.string to_binary(char c) returns 5 bit string that is the index of the character argument.o if the provided character is not a lower-case alphabetic character, return the emptystring.char from_binary(string bit_str) returns the character that the 5 bit binary string bit_str represents.o if any of the following conditions are not true: the size of bit_str is 5 every element of bit_str must be a ‘1’ or a ‘0’ the character produced must be a lower case letter return the character 0 (the NULL char).bool check_message(string plaintext, string secret_message) returns true if there are at least 5x the count of characters in secret_message as inplaintext, false otherwise? Remember, only alphabetic characters matter, all other characters in the plaintext areignored. 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 the plaintext string should have been checked by check_messageo 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) returns the original secret_message as a string.o if there were more characters in to_decode than 5*characters in thesecret_message, you will get extra ‘a’ characters at the end of the decodedmessage.o 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. Sincewe cannot turn those characters into a secret_message character (we need 5),they should be ignored.DeliverablesYou will turn in one file: proj05_functions.cpp inside a directory names proj05 .Weprovide you with proj05_functions_05.h , as well as a main proj05_main.cpp youcan use to test your functions. However, Mimir can test the individual functions without a mainprogram which is how the tests are structured. It is still a good idea for you to test your own codewith a main. This will be the last time we provide you with a main you can use to test yourfunctions. You should start doing that yourself.Remember to include your section, the date, project number and comments and you do notprovide main.cpp. If you turn in a main with your code Mimir it will be ignored.1. Please be sure to use the specified file names2. Always a good idea to save a copy of your file in your H: drive on EGR.3. Submit to Mimir as always. There will be a mix of visible and not-visible cases.Assignment Notes1. You turn in only the proj05/proj05_functions.cpp2. 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. 转自:http://ass.3daixie.com/2019022673302303.html

你可能感兴趣的:(讲解:CSE 232、c/c++、Programming、c/c++Haskell|Haskell)