A simple decryption program

zhaozj2021-02-16  54

Encryption process:

#include Void main (void) {char strch, ch; int i, x; ifstream readfile; instream writefile; readfile.open ("1.txt", ios :: in | iOS :: Nocreate); if (! readfile) {CERR << "Cannot Open Thie file for infut" << endl; exit (0);} Writefile.Open ("2.txt", ios :: in | ios :: nocreate ; If (! Writefile) {CERR << "Cannot Open THE FIL OUTPUT" << Endl; Exit (0);} while (! Readfile.eof ()) {ch = readfile.get (); x = static_cast < INT> (CH); x = (x 3)% 128; strCh = static_cast (x); writefile.put (strch);}}

Corresponding decryption process:

#include #include #include void main (void) {char strch, ch; int i, x; ifstream readfile; iestream writefile; readfile.open ("2.txt", ios :: IN | os :: nocreate; if (! readfile) {cerr << "cannot Open" "<< Endl; exit (0);} Writefile.Open (" 3.txt ", ios :: in | iOS :: nocreate); if (! Writefile) {CERR << "cannot open the file for output" << Endl; exit (0);

While (! readfile.eof ()) {ch = readfile.get (); x = static_cast (ch); x = (x-3)% 128; strCh = static_cast (x); WriteFile. PUT (STRCH);}}

转载请注明原文地址:https://www.9cbs.com/read-26972.html

New Post(0)