Question: In cryptography, a substitution cipher is a method of encoding by which units of plaintext are replaced with ciphertext , according to a regular system;
In cryptography, a substitution cipher is a method of encoding by which units of plaintext are replaced with ciphertext, according to a regular system; the "units" may be single letters (the most common), pairs of letters, triplets of letters, mixtures of the above, and so forth. There are a number of different types of substitution cipher. One type of substitution cipher is simple substitution cipher which operates on single letters. Substitution of single letters separatelysimple substitutioncan be demonstrated by writing out the alphabet in some order to represent the substitution. This is termed a substitution alphabet. Keys for the simple substitution cipher usually consist of 26 letters. Write a C++ program to encrypt or cipher a text file ( eFile.txt ). The text files does contain small letters, capital letter , numbers , spaces , and symbols. The output ( encrypted text ) will be displayed on the screen as 50 characters per line.
For this program , the following keys are used :
Plaintext alphabet: ABCDEFGHIJKLMNOPQRSTUVWXYZ
Ciphertext alphabet : EMNVDLWAUCPOKXQBIZJRYTGSHF
Numbers : 0123456789
Cipher numbers : 9876543210
Special symbols : !$%&'()*+,-./;<=>?@[]}{
Cipher special symbols : {}][@?>=<;/.-,+*)('&%$!
Space replacer symbols : ^~#`:
An example encryption using the above keys:
flee at once. we are discovered! 10-4 is encrypted to LODD^ER~QXND.#GD`EZD:VUJNQTDZDV{_89\5
Sample Run : The program must produce the following output wording and format :
The Original Text File contains the following :
If people do not believe that mathematics is simple, it is only because they do not realize how complicated life is.
Remark made by von Neumann as keynote speaker at the first national meeting of the Association for Computing Machinery in 1947, as mentioned by Franz L. Alt at the end of 'Archaeology of computers - Reminiscences, 1945--1947', Communications of the ACM, volume 15, issue 7, July 1972, special issue --- Twenty-fifth nniversary of the Association for Computing Machinery, p. 694.
The Encrypted Text is
UL^BDQBOD~VQ#XQR`MDOUDTD:RAER^KERADKERUNJ~UJ#JUKBO D;`UR:UJ^QXOH~MDNEYJD#RADH`VQ:XQR^ZDEOUFD~AQG#NQKB OUNERDV`OULD:UJ.ZDKEZP^KEVD~MH#TQX`XDYKEXX:EJ^PDHX QRD~JBDEPDZ#ER`RAD:LUZJR^XERUQXEO~KDDRUXW#QL`RAD:E JJQNUERUQX^LQZ~NQKBYRUXW#KENAUXDZH`UX:8052;^~EJ#KD XRUQXDV`MH:LZEXF^O.~EOR#ER`RAD:DXV^QL~@EZNAEDQOQWH #QL`NQKBYRDZJ:/^~ZDKUXUJNDXNDJ;#8054//8052@;`NQKKY XUNERUQXJ:QL^RAD~ENK;#TQOYKD`84;:UJJYD^2;~CYOH#802 7;`JBDNUEO:UJJYD^///~#RGDXRH/LULRA`EXXUTDZJEZH:QL^ RAD~EJJQNUERUQX#LQZ`NQKBYRUXW:KENAUXDZH;^B.~305.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
