Working on Issue #5

This commit is contained in:
amazing-username
2017-04-13 11:48:28 -05:00
parent f3800a8d7a
commit c82d81fdc1
3 changed files with 28 additions and 0 deletions
+13
View File
@@ -70,3 +70,16 @@ std::string Decryption::getDecryptedMessage() const
return decryptedMessage;
}
unsigned short getTwoNumberedKey(unsigned short& number)
{
std::string wholeNumber = std::to_string(number);
char hundred[] = {wholeNumber.at(0)};
char ten[] = {wholeNumber.at(1)};
char one[] {wholeNumber.at(2)};
unsigned short hundread, ten, one;
hundread = number.at()
}
+13
View File
@@ -21,10 +21,23 @@ void Encryption::setEncryptedMessage(const std::string& encryptedMessage)
}
void Encryption::encryptMessage()
{
int numberOfNewLines{0};
GenerateKeys* gk = new GenerateKeys;
ioEvent.open("encryptedFile.txt", std::ios::out);
std::cout << "String to encrypt: " << message << std::endl;
//while (numberOfNewLines != message.size())
for (unsigned int index = 0; index != message.size(); ++index)
{
char stringIndex = message.at(index);
//if (message.at(index) == "\n")
//if (message.at(index).compare("\n") == 0)
if (stringIndex == '\n')
{
++numberOfNewLines;
}
}
std::cout << "The message has " << numberOfNewLines << " new lines" << std::endl;
for (unsigned short indexOfString = 0; indexOfString < message.size(); indexOfString++)
{
ioEvent << gk->encryptedCharacters[message.at(indexOfString)];
+2
View File
@@ -22,6 +22,7 @@ void GenerateKeys::populateDecryptedValues()
}
}
decryptedCharacters[32] = (char) 32;
decryptedCharacters[10] = (char) 10;
//std::cout << std::endl;
//decryptedCharacters[whiteSpaceCharacter] = ' ';
//std::cout << "Whitespace character" << decryptedCharacters[whiteSpaceCharacter] << "d" << std::endl;
@@ -34,6 +35,7 @@ void GenerateKeys::populateEncryptedValues()
//std::cout << encryptedCharacters[decryptedCharacters[key]] << " ";
}
encryptedCharacters[(char) 32] = 32;
encryptedCharacters[(char) 10] = 10;
//encryptedCharacters[decryptedCharacters[startingCharacter]] = startingCharacter;
//std::cout << std::endl;
}