개인키 : 70, 공개키 : 186
~cpp #include <iostream> #include <fstream> using namespace std; int main() { ifstream fin("source.txt"); ofstream fout("source_enc.txt"); int key = 70; char ch; int result, result1; while(fin.eof() != true) { fin >>ch; result = int(ch) + key; result1 = result%255; fout <<char(result1); } return 0; } #include <iostream> #include <fstream> using namespace std; int main() { ifstream fin("source_enc.txt"); ofstream fout("source1.txt"); int key1; cin >> key1; int key = 256-key1; char ch; int result; while(fin.eof() != true) { fin >>ch; result = int(ch) - key; if (result>=0 && result<=184) fout <<char(result); else fout <<char(result+255); } return 0; }