This repository has been archived on 2026-07-02. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
PasswordEncryption/Encryption.cpp
T
2017-06-20 18:33:38 -05:00

36 lines
849 B
C++

#include<ios>
#include<iostream>
#include<fstream>
#include<string>
#include"Encryption.h"
#include"GenerateKeys.h"
Encryption::Encryption(const std::string& message)
{
this->message = message;
encryptMessage();
}
void Encryption::setEncryptedMessage(const std::string& encryptedMessage)
{ this->encryptedMessage = encryptedMessage; }
void Encryption::encryptMessage()
{
GenerateKeys gk{};
std::fstream ioEvent{};
ioEvent.open("encryptedFile.txt", std::ios::out);
for (auto indexOfString = 0u; indexOfString!=message.size(); ++indexOfString)
{
ioEvent << gk.encryptedCharacters[message.at(indexOfString)];
encryptedMessage += (gk.encryptedCharacters[message.at(indexOfString)]);
}
this->encryptedMessage = encryptedMessage;
ioEvent.close();
}
std::string Encryption::getEncryptedMessage() const
{ return encryptedMessage; }