Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

비밀키/노수민

From ZeroWiki
Revision as of 05:29, 7 February 2021 by imported>Unknown
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

암호화

#include <iostream>
#include <fstream>

using namespace std;
void enpass()
{
	int key,index=-1;
//	cin >> "
	char buffer[300]={0};
	char fileName[10];
	cout << "파일이름 : ";
	cin >> fileName;

	ifstream fin(fileName);
	cout << "키값 : ";
	cin >> key;

	while(fin.get(buffer[++index]))
	{
		cout << char( int(buffer[index]) + key) << " ";
	}
	cout << endl;
}
void depass()
{
	int key,index=-1;
//	cin >> "
	char buffer[300]={0};
	char fileName[10];
	cout << "파일이름 : ";
	cin >> fileName;

	ifstream fin(fileName);
	cout << "키값 : ";
	cin >> key;

	while(fin.get(buffer[++index]))
	{
		cout << char( int(buffer[index]) -n key) << " ";
	}
	cout << endl;

}
int main()
{
	enpass();
	depass();
	return 0;
}

암호화실습