Changed from ASCII cryption to key Cryption
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
Cryption::Cryption()
|
Cryption::Cryption()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
Cryption::Cryption(const std::string& message)
|
Cryption::Cryption(const std::string& message)
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-5
@@ -9,16 +9,14 @@ class Cryption
|
|||||||
public:
|
public:
|
||||||
Cryption();
|
Cryption();
|
||||||
Cryption(const std::string&);
|
Cryption(const std::string&);
|
||||||
|
//void setMessage(const std::string&);
|
||||||
void setMessage(const std::string&);
|
|
||||||
|
|
||||||
std::string getMessage() const;
|
std::string getMessage() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void setMessage(const std::string&);
|
||||||
|
|
||||||
std::string message;
|
std::string message;
|
||||||
std::fstream ioEvent;
|
std::fstream ioEvent;
|
||||||
|
|
||||||
private:
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+23
-32
@@ -1,4 +1,5 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include<sstream>
|
||||||
#include <ios>
|
#include <ios>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@@ -7,7 +8,6 @@
|
|||||||
|
|
||||||
Decryption::Decryption()
|
Decryption::Decryption()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
Decryption::Decryption(const std::string& message)
|
Decryption::Decryption(const std::string& message)
|
||||||
{
|
{
|
||||||
@@ -21,55 +21,46 @@ void Decryption::setDecryptedMessage(const std::string& message)
|
|||||||
}
|
}
|
||||||
void Decryption::decryptMessage()
|
void Decryption::decryptMessage()
|
||||||
{
|
{
|
||||||
GenerateKeys gk;
|
GenerateKeys gk{};
|
||||||
|
|
||||||
ioEvent.open("encryptedFile.txt", std::ios::in);
|
ioEvent.open("encryptedFile.txt", std::ios::in);
|
||||||
|
|
||||||
std::string messageToBeDecrypted, decryptedMessage;
|
std::string messageToBeDecrypted{}, decryptedMessage{};
|
||||||
|
|
||||||
while(!ioEvent.eof())
|
while(ioEvent >> messageToBeDecrypted)
|
||||||
{
|
|
||||||
ioEvent >> messageToBeDecrypted;
|
|
||||||
}
|
|
||||||
|
|
||||||
ioEvent.close();
|
ioEvent.close();
|
||||||
|
|
||||||
unsigned short encryptedTwoKey = 2;
|
for (auto indexOfChar = 0; indexOfChar<messageToBeDecrypted.size(); indexOfChar+=5)
|
||||||
unsigned short beginningOfAlphabetLowerCase = 97;
|
|
||||||
unsigned short endingOfAplphabetLowerCase = 122;
|
|
||||||
unsigned short whiteSpaceASCIICode = 32;
|
|
||||||
for (unsigned short index = 0; index < messageToBeDecrypted.size(); index++)
|
|
||||||
{
|
{
|
||||||
if ((index + encryptedTwoKey) < messageToBeDecrypted.size())
|
char cryptedKey[5]{};
|
||||||
|
for (auto index = 0; index!=5; ++index)
|
||||||
{
|
{
|
||||||
char otherElements[] = {messageToBeDecrypted.at(index), messageToBeDecrypted.at(index + 1), messageToBeDecrypted.at(index + 2)};
|
cryptedKey[index] = (messageToBeDecrypted.at(indexOfChar + index));
|
||||||
unsigned short number = atoi(otherElements);
|
|
||||||
|
|
||||||
if ((number > endingOfAplphabetLowerCase || number < beginningOfAlphabetLowerCase) && (number != whiteSpaceASCIICode))
|
|
||||||
{
|
|
||||||
otherElements[0] = {messageToBeDecrypted.at(index)};
|
|
||||||
otherElements[1] = {messageToBeDecrypted.at(index + 1)};
|
|
||||||
otherElements[2] = {' '};
|
|
||||||
number = atoi(otherElements);
|
|
||||||
decryptedMessage += gk.decryptedCharacters[number];
|
|
||||||
index += 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
decryptedMessage += gk.decryptedCharacters[number];
|
|
||||||
index += 2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
decryptedMessage += gk.decryptedCharacters[cstringToString(cryptedKey, 5)];
|
||||||
}
|
}
|
||||||
|
//std::cout << "Decrypted Message: " << decryptedMessage << std::endl;
|
||||||
setDecryptedMessage(decryptedMessage);
|
setDecryptedMessage(decryptedMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string Decryption::getDecryptedMessage() const
|
std::string Decryption::getDecryptedMessage() const
|
||||||
{
|
{
|
||||||
|
|
||||||
return decryptedMessage;
|
return decryptedMessage;
|
||||||
}
|
}
|
||||||
|
std::string Decryption::cstringToString(char tmp[], const int& SIZE)
|
||||||
|
{
|
||||||
|
std::string tmpString{};
|
||||||
|
std::stringstream cToS{};
|
||||||
|
for (auto index = 0; index!=5; ++index)
|
||||||
|
{
|
||||||
|
cToS << tmp[index];
|
||||||
|
}
|
||||||
|
cToS >> tmpString;
|
||||||
|
return tmpString;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned short getTwoNumberedKey(unsigned short& number)
|
unsigned short getTwoNumberedKey(unsigned short& number)
|
||||||
@@ -80,6 +71,6 @@ unsigned short getTwoNumberedKey(unsigned short& number)
|
|||||||
char one[] {wholeNumber.at(2)};
|
char one[] {wholeNumber.at(2)};
|
||||||
|
|
||||||
|
|
||||||
unsigned short hundread, ten, one;
|
unsigned short hundread, tenN, oneN;
|
||||||
hundread = number.at()
|
hundread = number;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -19,7 +19,8 @@ public:
|
|||||||
std::string getDecryptedMessage() const;
|
std::string getDecryptedMessage() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string decryptedMessage;
|
std::string cstringToString(char[], const int&);
|
||||||
|
std::string decryptedMessage{};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+6
-18
@@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
Encryption::Encryption()
|
Encryption::Encryption()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
Encryption::Encryption(const std::string& message)
|
Encryption::Encryption(const std::string& message)
|
||||||
{
|
{
|
||||||
@@ -22,34 +21,23 @@ void Encryption::setEncryptedMessage(const std::string& encryptedMessage)
|
|||||||
void Encryption::encryptMessage()
|
void Encryption::encryptMessage()
|
||||||
{
|
{
|
||||||
int numberOfNewLines{0};
|
int numberOfNewLines{0};
|
||||||
GenerateKeys* gk = new GenerateKeys;
|
GenerateKeys gk{};
|
||||||
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 (auto index = 0; index != message.size(); ++index)
|
||||||
for (unsigned int index = 0; index != message.size(); ++index)
|
|
||||||
{
|
{
|
||||||
char stringIndex = message.at(index);
|
char stringIndex = message.at(index);
|
||||||
//if (message.at(index) == "\n")
|
|
||||||
//if (message.at(index).compare("\n") == 0)
|
|
||||||
if (stringIndex == '\n')
|
if (stringIndex == '\n')
|
||||||
{
|
|
||||||
++numberOfNewLines;
|
++numberOfNewLines;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
std::cout << "The message has " << numberOfNewLines << " new lines" << std::endl;
|
for (auto 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)];
|
||||||
//std::cout << gk->encryptedCharacters[message.at(indexOfString)] << std::endl;
|
encryptedMessage += (gk.encryptedCharacters[message.at(indexOfString)]);
|
||||||
encryptedMessage += std::to_string(gk->encryptedCharacters[message.at(indexOfString)]);
|
|
||||||
//std::cout << encryptedMessage << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setEncryptedMessage(encryptedMessage);
|
setEncryptedMessage(encryptedMessage);
|
||||||
ioEvent.close();
|
ioEvent.close();
|
||||||
|
|
||||||
delete gk;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -9,7 +9,6 @@
|
|||||||
class Encryption : public Cryption
|
class Encryption : public Cryption
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Encryption();
|
Encryption();
|
||||||
Encryption(const std::string&);
|
Encryption(const std::string&);
|
||||||
|
|
||||||
@@ -19,7 +18,7 @@ public:
|
|||||||
std::string getEncryptedMessage() const;
|
std::string getEncryptedMessage() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string encryptedMessage;
|
std::string encryptedMessage{};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+125
-21
@@ -1,41 +1,145 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include<sstream>
|
||||||
|
#include<fstream>
|
||||||
|
#include<ios>
|
||||||
|
|
||||||
#include "GenerateKeys.h"
|
#include "GenerateKeys.h"
|
||||||
|
|
||||||
GenerateKeys::GenerateKeys()
|
GenerateKeys::GenerateKeys()
|
||||||
{
|
{
|
||||||
|
populateSymbols();
|
||||||
|
populateNumbers();
|
||||||
|
populateLetters();
|
||||||
|
|
||||||
|
for (auto index = 0; index!=symbols.size(); ++index)
|
||||||
|
allCharacters.push_back(symbols[index]);
|
||||||
|
for (auto index = 0; index!=numbers.size(); ++index)
|
||||||
|
allCharacters.push_back(numbers[index]);
|
||||||
|
for (auto index = 0; index!=letters.size(); ++index)
|
||||||
|
allCharacters.push_back(letters[index]);
|
||||||
|
|
||||||
populateDecryptedValues();
|
populateDecryptedValues();
|
||||||
populateEncryptedValues();
|
populateEncryptedValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenerateKeys::populateDecryptedValues()
|
void GenerateKeys::populateDecryptedValues()
|
||||||
{
|
{
|
||||||
for (unsigned short number = 0; number < 300; number++)
|
std::fstream readKeys{};
|
||||||
|
readKeys.open("default_keys.txt", std::ios::in);
|
||||||
|
std::string tmpKey{};
|
||||||
|
for (auto index = 0; index!=allCharacters.size(); ++index)
|
||||||
{
|
{
|
||||||
char character;
|
readKeys >> tmpKey;
|
||||||
character = static_cast<char>(number);
|
decryptedCharacters[tmpKey] = static_cast<char>(allCharacters[index]);
|
||||||
|
tmpKey = "";
|
||||||
if (number >= startingCharacter && number <= endingCharacter)
|
|
||||||
{
|
|
||||||
decryptedCharacters[number] = character;
|
|
||||||
//std::cout << decryptedCharacters[number] << " ";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
decryptedCharacters[32] = (char) 32;
|
readKeys.close();
|
||||||
decryptedCharacters[10] = (char) 10;
|
decryptedCharacters["#2a9u"] = (char) 32;
|
||||||
//std::cout << std::endl;
|
decryptedCharacters["6*dw4"] = (char) 10;
|
||||||
//decryptedCharacters[whiteSpaceCharacter] = ' ';
|
|
||||||
//std::cout << "Whitespace character" << decryptedCharacters[whiteSpaceCharacter] << "d" << std::endl;
|
|
||||||
}
|
}
|
||||||
void GenerateKeys::populateEncryptedValues()
|
void GenerateKeys::populateEncryptedValues()
|
||||||
{
|
{
|
||||||
for (unsigned short key = startingCharacter; key <= endingCharacter; key++)
|
std::fstream readKeys{};
|
||||||
|
readKeys.open("default_keys.txt", std::ios::in);
|
||||||
|
std::string tmpKey{};
|
||||||
|
for (auto index = 0; index!=allCharacters.size(); ++index)
|
||||||
{
|
{
|
||||||
encryptedCharacters[decryptedCharacters[key]] = key;
|
readKeys >> tmpKey;
|
||||||
//std::cout << encryptedCharacters[decryptedCharacters[key]] << " ";
|
encryptedCharacters[decryptedCharacters[tmpKey]] = tmpKey;
|
||||||
|
tmpKey = "";
|
||||||
}
|
}
|
||||||
encryptedCharacters[(char) 32] = 32;
|
readKeys.close();
|
||||||
encryptedCharacters[(char) 10] = 10;
|
encryptedCharacters[(char) 32] = "#2a9u";
|
||||||
//encryptedCharacters[decryptedCharacters[startingCharacter]] = startingCharacter;
|
encryptedCharacters[(char) 10] = "6*dw4";
|
||||||
//std::cout << std::endl;
|
}
|
||||||
|
|
||||||
|
void GenerateKeys::populateSymbols()
|
||||||
|
{
|
||||||
|
symbols.push_back(33);
|
||||||
|
addRange(symbols, 35, 38);
|
||||||
|
addRange(symbols, 40, 46);
|
||||||
|
addRange(symbols, 58, 64);
|
||||||
|
addRange(symbols, 93, 96);
|
||||||
|
addRange(symbols, 123, 126);
|
||||||
|
}
|
||||||
|
void GenerateKeys::populateNumbers()
|
||||||
|
{
|
||||||
|
addRange(numbers, 48, 57);
|
||||||
|
}
|
||||||
|
void GenerateKeys::populateLetters()
|
||||||
|
{
|
||||||
|
addRange(letters, 97, 122);
|
||||||
|
}
|
||||||
|
void GenerateKeys::addRange(std::vector<int>& ch, int from, const int to)
|
||||||
|
{
|
||||||
|
auto range = to - from;
|
||||||
|
for (auto index = 0; index<=range; ++index)
|
||||||
|
{
|
||||||
|
ch.push_back(from);
|
||||||
|
++from;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void GenerateKeys::generateKey(std::string& key, const int& SIZE)
|
||||||
|
{
|
||||||
|
char ky[SIZE]{};
|
||||||
|
for (auto index = 0; index!=SIZE; ++index)
|
||||||
|
{
|
||||||
|
if (index < 2)
|
||||||
|
ky[index] = getChar(letters);
|
||||||
|
else if (index < 3 && index > 1)
|
||||||
|
ky[index] = getChar(symbols);
|
||||||
|
else
|
||||||
|
ky[index] = getChar(numbers);
|
||||||
|
}
|
||||||
|
std::stringstream charToString;
|
||||||
|
for (auto index = 0; index!=SIZE; ++index)
|
||||||
|
charToString << ky[index];
|
||||||
|
while (charToString>>key)
|
||||||
|
charToString >> key;
|
||||||
|
}
|
||||||
|
void GenerateKeys::keyMove()
|
||||||
|
{
|
||||||
|
std::string tmpKey{};
|
||||||
|
for (auto index = 0; index!=totalCharacters; ++index)
|
||||||
|
{
|
||||||
|
generateKey(tmpKey, keySize);
|
||||||
|
keys.push_back(tmpKey);
|
||||||
|
tmpKey = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void GenerateKeys::print(const std::vector<int>& ch)
|
||||||
|
{
|
||||||
|
for (auto index = 0; index!=ch.size(); ++index)
|
||||||
|
std::cout << ch[index] << " ";
|
||||||
|
std::cout << std::endl;
|
||||||
|
}
|
||||||
|
void GenerateKeys::checkRepetition()
|
||||||
|
{
|
||||||
|
for (auto index = 0; index!=totalCharacters; ++index)
|
||||||
|
{
|
||||||
|
std::string chosenOne{keys[index]};
|
||||||
|
auto repetition{0};
|
||||||
|
for (auto innerIndex = 0; innerIndex!=totalCharacters; ++innerIndex)
|
||||||
|
{
|
||||||
|
if (chosenOne == keys[innerIndex])
|
||||||
|
++repetition;
|
||||||
|
}
|
||||||
|
if (repetition > 1)
|
||||||
|
std::cout << "Too much repetitive stuff" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void GenerateKeys::keyDump()
|
||||||
|
{
|
||||||
|
std::fstream dump{};
|
||||||
|
dump.open("default_keys.txt", std::ios::out);
|
||||||
|
for (auto index = 0; index!=keys.size(); ++index)
|
||||||
|
dump << keys[index] << '\n';
|
||||||
|
dump.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char GenerateKeys::getChar(std::vector<int>& ch)
|
||||||
|
{
|
||||||
|
auto hc = ch[rand() % ch.size()];
|
||||||
|
return hc;
|
||||||
}
|
}
|
||||||
|
|||||||
+30
-6
@@ -1,7 +1,9 @@
|
|||||||
#ifndef GENERATEKEYS_H
|
#ifndef GENERATEKEYS_H
|
||||||
#define GENERATEKEYS_H
|
#define GENERATEKEYS_H
|
||||||
|
|
||||||
#include <map>
|
#include<string>
|
||||||
|
#include<vector>
|
||||||
|
#include<map>
|
||||||
|
|
||||||
class GenerateKeys
|
class GenerateKeys
|
||||||
{
|
{
|
||||||
@@ -12,17 +14,39 @@ public:
|
|||||||
|
|
||||||
void populateDecryptedValues();
|
void populateDecryptedValues();
|
||||||
void populateEncryptedValues();
|
void populateEncryptedValues();
|
||||||
|
void keyMove();
|
||||||
|
void keyDump();
|
||||||
|
|
||||||
friend class Encryption;
|
friend class Encryption;
|
||||||
friend class Decryption;
|
friend class Decryption;
|
||||||
friend class KeyManagementWindow;
|
friend class KeyManagementWindow;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<unsignedShort, char> decryptedCharacters;
|
|
||||||
std::map<char, unsignedShort> encryptedCharacters;
|
void populateSymbols();
|
||||||
unsigned short startingCharacter = 97;
|
void populateNumbers();
|
||||||
unsigned short endingCharacter = 122;
|
void populateLetters();
|
||||||
unsigned short whiteSpaceCharacter = 32;
|
void addRange(std::vector<int>&, int, const int);
|
||||||
|
|
||||||
|
void generateKey(std::string&, const int&);
|
||||||
|
void checkRepetition();
|
||||||
|
void print(const std::vector<int>&);
|
||||||
|
|
||||||
|
char getChar(std::vector<int>&);
|
||||||
|
|
||||||
|
|
||||||
|
std::vector<std::string> keys{};
|
||||||
|
std::vector<int> symbols{};
|
||||||
|
std::vector<int> numbers{};
|
||||||
|
std::vector<int> letters{};
|
||||||
|
std::vector<int> allCharacters{};
|
||||||
|
std::map<char, std::string> encryptedCharacters{};
|
||||||
|
std::map<std::string, char> decryptedCharacters{};
|
||||||
|
|
||||||
|
//KeySize show equal the value in key
|
||||||
|
const int keySize{5};
|
||||||
|
const int totalCharacters{63};
|
||||||
|
char key[5]{};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+10
-27
@@ -5,6 +5,7 @@
|
|||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include<sstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@@ -41,10 +42,10 @@ void KeyManagementWindow::setContentsOfComboBox()
|
|||||||
{
|
{
|
||||||
GenerateKeys gk;
|
GenerateKeys gk;
|
||||||
|
|
||||||
for (unsigned short keyIndex = gk.startingCharacter; keyIndex <= gk.endingCharacter; keyIndex++)
|
std::cout << "got here" << std::endl;
|
||||||
|
for (auto index = 0; index!=gk.allCharacters.size(); ++index)
|
||||||
{
|
{
|
||||||
std::string ch = "";
|
std::string ch{static_cast<char>(gk.allCharacters[index])};
|
||||||
ch += gk.decryptedCharacters[keyIndex];
|
|
||||||
QString bl = QString::fromStdString(ch);
|
QString bl = QString::fromStdString(ch);
|
||||||
comboBoxOfKeys->addItem(bl);
|
comboBoxOfKeys->addItem(bl);
|
||||||
}
|
}
|
||||||
@@ -52,34 +53,16 @@ void KeyManagementWindow::setContentsOfComboBox()
|
|||||||
void KeyManagementWindow::test()
|
void KeyManagementWindow::test()
|
||||||
{
|
{
|
||||||
GenerateKeys gk;
|
GenerateKeys gk;
|
||||||
//std::cout << "bang bang!" << std::endl;
|
|
||||||
QString bo = comboBoxOfKeys->currentText();
|
QString bo = comboBoxOfKeys->currentText();
|
||||||
std::string k = bo.toStdString();
|
std::string k = bo.toStdString();
|
||||||
char f;
|
char f;
|
||||||
|
|
||||||
std::fstream in;
|
std::stringstream lazy{};
|
||||||
in.open("strToCh.txt", std::ios::out);
|
lazy << k;
|
||||||
|
lazy >> f;
|
||||||
|
//std::cout << "character: " << f << std::endl;
|
||||||
|
|
||||||
in << k;
|
std::string value{gk.encryptedCharacters[f]};
|
||||||
in.close();
|
QString v = QString::fromStdString(value);
|
||||||
|
|
||||||
in.open("strToCh.txt", std::ios::in);
|
|
||||||
|
|
||||||
in >> f;
|
|
||||||
in.close();
|
|
||||||
|
|
||||||
in.open("strToCh.txt", std::ios::out);
|
|
||||||
in << gk.encryptedCharacters[f];
|
|
||||||
in.close();
|
|
||||||
|
|
||||||
unsigned short yek;
|
|
||||||
in.open("strToCh.txt", std::ios::in);
|
|
||||||
in >> yek;
|
|
||||||
in.close();
|
|
||||||
|
|
||||||
std::string key = "";
|
|
||||||
key += std::to_string(yek);
|
|
||||||
//std::cout << gk.encryptedCharacters[f] << std::endl;
|
|
||||||
QString v = QString::fromStdString(key);
|
|
||||||
valueOfKey->setText(v);
|
valueOfKey->setText(v);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-19
@@ -10,9 +10,6 @@
|
|||||||
|
|
||||||
MessagingControls::MessagingControls()
|
MessagingControls::MessagingControls()
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Initialize controls
|
|
||||||
*/
|
|
||||||
textForCryption = new QTextEdit;
|
textForCryption = new QTextEdit;
|
||||||
cryptionChoice = true;
|
cryptionChoice = true;
|
||||||
|
|
||||||
@@ -20,9 +17,6 @@ MessagingControls::MessagingControls()
|
|||||||
}
|
}
|
||||||
MessagingControls::~MessagingControls()
|
MessagingControls::~MessagingControls()
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Delete pointer types
|
|
||||||
*/
|
|
||||||
delete lblOfEncryptedBox;
|
delete lblOfEncryptedBox;
|
||||||
delete cryptionButon;
|
delete cryptionButon;
|
||||||
delete textForCryption;
|
delete textForCryption;
|
||||||
@@ -32,11 +26,9 @@ MessagingControls::~MessagingControls()
|
|||||||
|
|
||||||
void MessagingControls::setupMainWindow()
|
void MessagingControls::setupMainWindow()
|
||||||
{
|
{
|
||||||
|
|
||||||
cryptionButon = new QPushButton(tr("XO"));
|
cryptionButon = new QPushButton(tr("XO"));
|
||||||
cryptionSwitch = new QPushButton(tr("encrypt chosen"));
|
cryptionSwitch = new QPushButton(tr("encrypt chosen"));
|
||||||
|
|
||||||
|
|
||||||
buttonLayout = new QVBoxLayout;
|
buttonLayout = new QVBoxLayout;
|
||||||
buttonWidget = new QWidget;
|
buttonWidget = new QWidget;
|
||||||
buttonDockWidget = new QDockWidget;
|
buttonDockWidget = new QDockWidget;
|
||||||
@@ -98,8 +90,7 @@ void MessagingControls::determineCryption()
|
|||||||
{
|
{
|
||||||
if (cryptionChoice)
|
if (cryptionChoice)
|
||||||
{
|
{
|
||||||
Encryption ec;
|
Encryption ec{grabCryptionText()};
|
||||||
ec.setMessage(grabCryptionText());
|
|
||||||
ec.encryptMessage();
|
ec.encryptMessage();
|
||||||
|
|
||||||
textForCryption->clear();
|
textForCryption->clear();
|
||||||
@@ -107,14 +98,10 @@ void MessagingControls::determineCryption()
|
|||||||
|
|
||||||
cryptionSwitch->setText("decrypt chosen");
|
cryptionSwitch->setText("decrypt chosen");
|
||||||
cryptionChoice = false;
|
cryptionChoice = false;
|
||||||
/**
|
|
||||||
* Encrypt Message
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Decryption dc;
|
Decryption dc{grabCryptionText()};
|
||||||
dc.setMessage(grabCryptionText());
|
|
||||||
dc.decryptMessage();
|
dc.decryptMessage();
|
||||||
|
|
||||||
textForCryption->clear();
|
textForCryption->clear();
|
||||||
@@ -122,15 +109,11 @@ void MessagingControls::determineCryption()
|
|||||||
|
|
||||||
cryptionSwitch->setText("encrypt chosen");
|
cryptionSwitch->setText("encrypt chosen");
|
||||||
cryptionChoice = true;
|
cryptionChoice = true;
|
||||||
/**
|
|
||||||
* Decrypt Message
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void MessagingControls::keyManagementWindow()
|
void MessagingControls::keyManagementWindow()
|
||||||
{
|
{
|
||||||
KeyManagementWindow* kh = new KeyManagementWindow;
|
KeyManagementWindow* kh = new KeyManagementWindow;
|
||||||
|
|
||||||
kh->show();
|
kh->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
sn{31
|
||||||
|
ac`13
|
||||||
|
iu?82
|
||||||
|
aw*45
|
||||||
|
sw$84
|
||||||
|
gx:27
|
||||||
|
nt]22
|
||||||
|
ka:00
|
||||||
|
bn;69
|
||||||
|
cq*82
|
||||||
|
xa=77
|
||||||
|
yn`54
|
||||||
|
qm.96
|
||||||
|
tp$39
|
||||||
|
ok#60
|
||||||
|
mm<43
|
||||||
|
xj^90
|
||||||
|
oa=57
|
||||||
|
yx&98
|
||||||
|
be|11
|
||||||
|
mi*76
|
||||||
|
yj+43
|
||||||
|
en]97
|
||||||
|
yq?07
|
||||||
|
qg`77
|
||||||
|
yg&37
|
||||||
|
kf|26
|
||||||
|
ai-54
|
||||||
|
il,80
|
||||||
|
bp;07
|
||||||
|
di>95
|
||||||
|
zx*10
|
||||||
|
sj.81
|
||||||
|
yc`49
|
||||||
|
aw,25
|
||||||
|
in&73
|
||||||
|
du$50
|
||||||
|
cl~92
|
||||||
|
kp<89
|
||||||
|
rg^60
|
||||||
|
eu`66
|
||||||
|
el@80
|
||||||
|
ap]55
|
||||||
|
qr$02
|
||||||
|
aw.98
|
||||||
|
zq;91
|
||||||
|
fb_62
|
||||||
|
oc(50
|
||||||
|
rm)77
|
||||||
|
eg]20
|
||||||
|
lu~74
|
||||||
|
uv+04
|
||||||
|
vj_75
|
||||||
|
vt!80
|
||||||
|
xf+13
|
||||||
|
uf<32
|
||||||
|
xc;16
|
||||||
|
qj=91
|
||||||
|
ly!49
|
||||||
|
ic=46
|
||||||
|
dp,74
|
||||||
|
rp?04
|
||||||
|
ar;46
|
||||||
Reference in New Issue
Block a user