-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
46 lines (35 loc) · 1.07 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
* Author: Justin Muskopf
* Instructor: Mark Hoffman
* Course: CSCE 4550, Fall 2018
* Assignment: Project 2
*/
#include <iostream>
#include "file.h"
#include "cipherengine.h"
int main()
{
std::string plaintext; // The plaintext
std::string key; // The key
File plainTextFile("plaintext");// The plaintext file
File keyFile("key"); // The key file
File outputFile("output"); // The output file
CipherEngine cipherEngine; // The cipher engine for encryption
// Initialize the plaintext and key files
plainTextFile.openFromInput();
keyFile.openFromInput();
outputFile.openFromInput(WRITE);
// Get the plaintext and key from files
plaintext = plainTextFile.getContents();
key = keyFile.getContents();
// Close plaintext and key files
plainTextFile.close();
keyFile.close();
// Set the output file
cipherEngine.setOutputFile(outputFile);
// Encrypt plaintext using key
cipherEngine.encrypt(plaintext, key);
// Close output file
outputFile.close();
return 0;
}