Working on Issue #5
This commit is contained in:
@@ -70,3 +70,16 @@ std::string Decryption::getDecryptedMessage() const
|
|||||||
|
|
||||||
return decryptedMessage;
|
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()
|
||||||
|
}
|
||||||
|
|||||||
@@ -21,10 +21,23 @@ void Encryption::setEncryptedMessage(const std::string& encryptedMessage)
|
|||||||
}
|
}
|
||||||
void Encryption::encryptMessage()
|
void Encryption::encryptMessage()
|
||||||
{
|
{
|
||||||
|
int numberOfNewLines{0};
|
||||||
GenerateKeys* gk = new GenerateKeys;
|
GenerateKeys* gk = new GenerateKeys;
|
||||||
ioEvent.open("encryptedFile.txt", std::ios::out);
|
ioEvent.open("encryptedFile.txt", std::ios::out);
|
||||||
|
|
||||||
std::cout << "String to encrypt: " << message << std::endl;
|
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++)
|
for (unsigned short indexOfString = 0; indexOfString < message.size(); indexOfString++)
|
||||||
{
|
{
|
||||||
ioEvent << gk->encryptedCharacters[message.at(indexOfString)];
|
ioEvent << gk->encryptedCharacters[message.at(indexOfString)];
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ void GenerateKeys::populateDecryptedValues()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
decryptedCharacters[32] = (char) 32;
|
decryptedCharacters[32] = (char) 32;
|
||||||
|
decryptedCharacters[10] = (char) 10;
|
||||||
//std::cout << std::endl;
|
//std::cout << std::endl;
|
||||||
//decryptedCharacters[whiteSpaceCharacter] = ' ';
|
//decryptedCharacters[whiteSpaceCharacter] = ' ';
|
||||||
//std::cout << "Whitespace character" << decryptedCharacters[whiteSpaceCharacter] << "d" << std::endl;
|
//std::cout << "Whitespace character" << decryptedCharacters[whiteSpaceCharacter] << "d" << std::endl;
|
||||||
@@ -34,6 +35,7 @@ void GenerateKeys::populateEncryptedValues()
|
|||||||
//std::cout << encryptedCharacters[decryptedCharacters[key]] << " ";
|
//std::cout << encryptedCharacters[decryptedCharacters[key]] << " ";
|
||||||
}
|
}
|
||||||
encryptedCharacters[(char) 32] = 32;
|
encryptedCharacters[(char) 32] = 32;
|
||||||
|
encryptedCharacters[(char) 10] = 10;
|
||||||
//encryptedCharacters[decryptedCharacters[startingCharacter]] = startingCharacter;
|
//encryptedCharacters[decryptedCharacters[startingCharacter]] = startingCharacter;
|
||||||
//std::cout << std::endl;
|
//std::cout << std::endl;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user