From c82d81fdc1d958a3ea5021be4068d64e307a320e Mon Sep 17 00:00:00 2001 From: amazing-username Date: Thu, 13 Apr 2017 11:48:28 -0500 Subject: [PATCH] Working on Issue #5 --- Decryption.cpp | 13 +++++++++++++ Encryption.cpp | 13 +++++++++++++ GenerateKeys.cpp | 2 ++ 3 files changed, 28 insertions(+) diff --git a/Decryption.cpp b/Decryption.cpp index 03b0ee0..a034f49 100644 --- a/Decryption.cpp +++ b/Decryption.cpp @@ -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() +} diff --git a/Encryption.cpp b/Encryption.cpp index 74c1d9d..a6e77b9 100644 --- a/Encryption.cpp +++ b/Encryption.cpp @@ -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)]; diff --git a/GenerateKeys.cpp b/GenerateKeys.cpp index 4be3c60..74c7d72 100644 --- a/GenerateKeys.cpp +++ b/GenerateKeys.cpp @@ -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; }