leyna
Uploaded by
8 SLIDES
208 VUES
80LIKES

Advanced Substitution Cipher Implementation with ASCII Encoding and Decoding

DESCRIPTION

This document details an advanced implementation of a substitution cipher model, utilizing ASCII encoding for cleartext characters. The encipher and decipher tables facilitate the substitution process by mapping plaintext characters to their corresponding ciphertext characters. The provided code snippet demonstrates a loop for reading input characters, encoding or decoding based on specified tasks, and writing the output characters. This resource is beneficial for developers and cryptography enthusiasts looking to understand and implement secure text encryption.

1 / 8

Télécharger la présentation

Advanced Substitution Cipher Implementation with ASCII Encoding and Decoding

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. IM cipher code

  2. Cipher model • Substitution cipher • For cleartext character, substitute character in encipher table • For ciphertext character, substitute character in decipher table

  3. ASCII Table (first half)

  4. Format of encryption table

  5. Encipher Table charencr[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 'b', '.', 0, 'c', '[', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'R', 'u', ',', 'q', '\t', 'Y', '\n', '\'', 'n', 's', 'v', 'e', 'H', 'o', 'N', 'M', 'r', '=', '0', ';', 'z', '/', '`', 'E', '\"', 'k', '&', '5', '>', 'i', 'p', ')', '$', '!', '2', 'O', '(', 'I', 'J', '%', 'Z', 'g', '\\', '{', 'h', '7', 'S', 'P', 'a', ' ', 'W', 'x', 'y', 'T', '+', '8', '-', 'L', '9', 'f', '#', 'F', '\r', 'B', '3', 'D', ']', 'V', '?', '*', 'G', '6', 'w', '@', '}', '|', 'C', 'l', '_', 'j', 'K', '^', '1', 't', 'Q', '<', 'U', 'd', 'm', ':', 'A', 'X', '\f', '4', '~', 0, 0, 0 };

  6. Decipher Table char decr[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, '$', '&', 0, '|', '^', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Q', 'A', '8', '\\', '@', 'G', ':', '\'', 'D', '?', 'e', 'V', '\"', 'X', '\n', '5', '2', 'r', 'B', '`', '}', ';', 'g', 'M', 'W', 'Z', 'y', '3', 'u', '1', '<', 'd', 'i', 'z', '_', 'l', 'a', '7', ']', 'f', ',', 'E', 'F', 'p', 'Y', '/', '.', 'C', 'O', 't', ' ', 'N', 'U', 'v', 'c', 'R', '{', '%', 'H', '\r', 'J', 'b', 'q', 'n', '6', 'P', '\t', '\f', 'w', '+', '[', 'I', 'L', '=', 'o', '9', 'm', 'x', '(', '-', '>', '#', '0', ')', 's', '!', '*', 'h', 'S', 'T', '4', 'K', 'k', 'j', '~', 0, 0, 0};

  7. Basic code snippet while (fin.get(inchar)) { if (((int) inchar) < 32) //for debugging cout<< "Read (" << (int)inchar << ") "; if (task == 'e') // we are encoding { outchar= encr[(int)inchar]; } else { outchar= decr[(int)inchar]; } fout << outchar; if (((int) inchar) < 32) //for debugging cout<< ": Wrote " << outchar << endl; }

  8. example [root@bridge ~]# psad -m /var/log/messages.1 --gnuplot --CSV-fields "dst:not192.168.10.0/24 dp:countuniq" --gnuplot-graph points --gnuplot-xrange 0:10000 --gnuplot-file-prefix test1 [+] Entering Gnuplot mode... [+] Parsing iptables log messages from file: /var/log/messages.1 [+] Parsed 71992 iptables log messages. [+] Writing parsed iptables data to: test1.dat [+] Writing gnuplot directive file: test1.gnu [root@bridge ~]# gnuplottest1.gnu f1jjQ$]1@?6*R~FqRKtD?RolRMUD1MCj6Ml*ttD6*tN=Roo6_<KCjQRooOx+oG@*C?tR,?tQ&_jQ=k0N=`"N=rNrM0zR?K&Vj<_Q<_@^,Roo6_<KCjQo61DKwRKj@_QtRoo6_<KCjQom1D_6*Rr&=rrrrRoo6_<KCjQoG@C*oK1*G@mRQ*tQ=.feFRI_Q*1@_6R%_<KCjQRlj?*NNN.feFRaD1t@_6R@KQD]C*tRCj6Rl*ttD6*tRG1jlRG@C*&RMUD1MCj6Ml*ttD6*tN=.feFRaD1t*?RE=kk0R@KQD]C*tRCj6Rl*ttD6*tN.feFR81@Q@_6RKD1t*?R@KQD]C*tR?DQDRQj&RQ*tQ=N?DQ.feFR81@Q@_6R6_<KCjQR?@1*VQ@U*RG@C*&RQ*tQ=N6_<..f1jjQ$]1@?6*R~FqR6_<KCjQRQ*tQ=N6_<.

More Related