== 비밀키 == {{{~cpp #include #include using namespace std; int main() { ifstream fin("source.txt"); ofstream fout("source_enc.txt"); char input; int i; char data[100] = {'0', }; int count = 0; cout << "원본값" << endl; while(true) { fin.get(input); if (fin.eof()) break; cout << input; data[count] = input; count++; } data[count] = NULL; cout << endl; int key; cout << "Key 입력 : "; cin >> key; cout << "암호화" << endl; for (i = 0; data[i] != NULL ;i++) { data[i] += key; fout << char(data[i]); cout << char(data[i]); } cout << endl; fout << endl; cout << "복호화" << endl; for (i = 0; data[i] != NULL ;i++) { data[i] -= key; fout << char(data[i]); cout << char(data[i]); } cout << endl; return 0; } }}} ---- [암호화실습], [데블스캠프2004/목요일]