Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 353a1dfef1 | |||
| c1d17799cd | |||
| b83287b768 | |||
| 4b7c0ea173 | |||
| 2074f26c4e | |||
| 4d5b19cabe | |||
| 41c53fe8e9 | |||
| 062b9338f0 | |||
| 157b18ee8d | |||
| de5b56e84f | |||
| 33c23cfc10 | |||
| 6c1f92ea30 | |||
| d82b286ec9 | |||
| e38f10e759 | |||
| 222f0c607b | |||
| fbee689234 | |||
| c82d81fdc1 | |||
| f3800a8d7a | |||
| 063b89cd56 | |||
| 3f5d67e4cf | |||
| 9894385576 | |||
| 2d6b7d27e8 | |||
| 610554d655 | |||
| adc92aae29 | |||
| 80d6d20b16 | |||
| 5fe6a261a0 | |||
| 32da209bc0 |
@@ -1,24 +0,0 @@
|
|||||||
#ifndef CHARACTERS_H_
|
|
||||||
#define CHARACTERS_H_
|
|
||||||
|
|
||||||
#include<array>
|
|
||||||
#include<vector>
|
|
||||||
using std::array;
|
|
||||||
using std::vector;
|
|
||||||
using std::size_t;
|
|
||||||
|
|
||||||
const size_t letterCount = 52;
|
|
||||||
const size_t numberCount = 10;
|
|
||||||
const size_t symbolCount = 34;
|
|
||||||
const size_t characterCount = letterCount + numberCount + symbolCount;
|
|
||||||
|
|
||||||
template<typename CT>
|
|
||||||
class Characters
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
std::array<CT,letterCount> letters;
|
|
||||||
std::array<CT,numberCount> numbers;
|
|
||||||
std::array<CT,symbolCount> symbols;
|
|
||||||
std::vector<CT> allCharacters;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
#ifndef COMMONWINDOW_H_
|
#ifndef COMMONWINDOW_H_
|
||||||
#define COMMONWINDOW_H_
|
#define COMMONWINDOW_H_
|
||||||
|
|
||||||
#include<QDialog>
|
|
||||||
#include<QHBoxLayout>
|
#include<QHBoxLayout>
|
||||||
#include<QVBoxLayout>
|
#include<QVBoxLayout>
|
||||||
#include<QComboBox>
|
#include<QComboBox>
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
#include"Conversions.h"
|
||||||
|
|
||||||
|
using std::string;
|
||||||
|
using std::stringstream;
|
||||||
|
|
||||||
|
string Conversions::cstringToString(const char tmp[], const int size)
|
||||||
|
{
|
||||||
|
string tmpString{};
|
||||||
|
stringstream cToS{};
|
||||||
|
for (auto index=0; index!=size; ++index)
|
||||||
|
cToS<<tmp[index];
|
||||||
|
cToS >> tmpString;
|
||||||
|
return tmpString;
|
||||||
|
}
|
||||||
|
char Conversions::stringToChar(const string& tmp)
|
||||||
|
{
|
||||||
|
char tmpChar{};
|
||||||
|
stringstream sToC{};
|
||||||
|
for (auto tmpElements:tmp)
|
||||||
|
sToC << tmpElements;
|
||||||
|
sToC>>tmpChar;
|
||||||
|
return tmpChar;
|
||||||
|
}
|
||||||
+13
-14
@@ -4,37 +4,36 @@
|
|||||||
#include<string>
|
#include<string>
|
||||||
#include<sstream>
|
#include<sstream>
|
||||||
|
|
||||||
using std::string;
|
|
||||||
using std::stringstream;
|
|
||||||
|
|
||||||
class Conversions
|
class Conversions
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Conversions() = default;
|
Conversions() = default;
|
||||||
~Conversions()=default;
|
~Conversions()=default;
|
||||||
|
|
||||||
template<typename C=char,typename S=string>
|
template<typename C=char,typename S=std::string>
|
||||||
S cstringToString(const C* tmp, const int size)
|
S cstringToString(const C[], const int);
|
||||||
|
template<typename C=char,typename S=std::string>
|
||||||
|
C stringToChar(const S&);
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
template<typename C=char,typename S=std::string>
|
||||||
|
S Conversions::cstringToString(const C tmp[], const int size)
|
||||||
{
|
{
|
||||||
stringstream cToS{};
|
std::stringstream cToS{};
|
||||||
for (auto index=0; index!=size; ++index)
|
for (auto index=0; index!=size; ++index)
|
||||||
cToS<<tmp[index];
|
cToS<<tmp[index];
|
||||||
S tmpString{};
|
std::string tmpString{};
|
||||||
cToS>>tmpString;
|
cToS>>tmpString;
|
||||||
return tmpString;
|
return tmpString;
|
||||||
|
|
||||||
}
|
}
|
||||||
template<typename C=char,typename S=string>
|
template<typename C=char,typename S=std::string>
|
||||||
C stringToChar(const S& tmp)
|
C Conversions::stringToChar(const S& tmp)
|
||||||
{
|
{
|
||||||
|
std::stringstream sToC{};
|
||||||
stringstream sToC{};
|
|
||||||
for (auto tmpElements:tmp)
|
for (auto tmpElements:tmp)
|
||||||
sToC<<tmpElements;
|
sToC<<tmpElements;
|
||||||
char tmpChar{};
|
char tmpChar{};
|
||||||
sToC>>tmpChar;
|
sToC>>tmpChar;
|
||||||
return tmpChar;
|
return tmpChar;
|
||||||
}
|
}
|
||||||
private:
|
|
||||||
};
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+12
-1
@@ -1,4 +1,15 @@
|
|||||||
#include"Cryption.h"
|
#include"Cryption.h"
|
||||||
|
|
||||||
Cryption::Cryption(const string& message)
|
Cryption::Cryption(const std::string& message)
|
||||||
{ this->message = message; }
|
{ this->message = message; }
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
void Cryption::setMessage(const std::string& message)
|
||||||
|
{ this->message = message; }
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
std::string Cryption::getMessage() const
|
||||||
|
{ return message; }
|
||||||
|
*/
|
||||||
|
|||||||
+4
-6
@@ -3,19 +3,17 @@
|
|||||||
|
|
||||||
#include<string>
|
#include<string>
|
||||||
|
|
||||||
using std::string;
|
|
||||||
|
|
||||||
class Cryption
|
class Cryption
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Cryption() = default;
|
Cryption() = default;
|
||||||
~Cryption() = default;
|
~Cryption() = default;
|
||||||
Cryption(const string&);
|
Cryption(const std::string&);
|
||||||
|
|
||||||
virtual void setMessage(const string&) = 0;
|
virtual void setMessage(const std::string&) = 0;
|
||||||
virtual string getMessage() const = 0;
|
virtual std::string getMessage() const = 0;
|
||||||
|
|
||||||
string message;
|
std::string message;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+15
-22
@@ -1,36 +1,29 @@
|
|||||||
|
#include<iostream>
|
||||||
#include<fstream>
|
#include<fstream>
|
||||||
|
#include<sstream>
|
||||||
#include<ios>
|
#include<ios>
|
||||||
#include<vector>
|
#include<vector>
|
||||||
#include"Conversions.h"
|
#include"Conversions.h"
|
||||||
#include"Decryption.h"
|
#include"Decryption.h"
|
||||||
#include"KeyRetrieval.h"
|
#include"KeyRetrieval.h"
|
||||||
|
|
||||||
Decryption::Decryption(const string& message)
|
Decryption::Decryption(const std::string& message)
|
||||||
{
|
{
|
||||||
this->message = message;
|
this->message = message;
|
||||||
decryptMessage();
|
setupMap();
|
||||||
}
|
|
||||||
Decryption::Decryption(const Password<>& py, const Key<>& ky)
|
|
||||||
{
|
|
||||||
setupMap(ky);
|
|
||||||
passwordPath.assign(py.passwordPath());
|
|
||||||
decryptMessage();
|
decryptMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Decryption::setDecryptedMessage(const string& message) { this->decryptedMessage = message; }
|
void Decryption::setDecryptedMessage(const std::string& message) { this->decryptedMessage = message; }
|
||||||
void Decryption::setMessage(const string& message) { this->message = message; }
|
void Decryption::setMessage(const std::string& message) { this->message = message; }
|
||||||
|
|
||||||
void Decryption::retrieveMetaData()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
void Decryption::decryptMessage()
|
void Decryption::decryptMessage()
|
||||||
{
|
{
|
||||||
fstream ioEvent{};
|
std::fstream ioEvent{};
|
||||||
ioEvent.open(passwordPath.c_str(), std::ios::in);
|
ioEvent.open("encryptedFile.txt", std::ios::in);
|
||||||
|
|
||||||
string messageToBeDecrypted{}, decryptedMessage{};
|
std::string messageToBeDecrypted{}, decryptedMessage{};
|
||||||
|
|
||||||
while(ioEvent >> messageToBeDecrypted);
|
while(ioEvent >> messageToBeDecrypted);
|
||||||
|
|
||||||
@@ -48,14 +41,14 @@ void Decryption::decryptMessage()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string Decryption::getDecryptedMessage() const { return decryptedMessage; }
|
std::string Decryption::getDecryptedMessage() const { return decryptedMessage; }
|
||||||
string Decryption::getMessage() const { return message; }
|
std::string Decryption::getMessage() const { return message; }
|
||||||
|
|
||||||
void Decryption::setupMap(const Key<>& ky)
|
void Decryption::setupMap()
|
||||||
{
|
{
|
||||||
KeyRetrieval kr{ky};
|
KeyRetrieval kr{};
|
||||||
vector<string> k{kr.keyStructure()};
|
std::vector<std::string> k{kr.keyStructure()};
|
||||||
vector<int> c{kr.codeCharacterStructure()};
|
std::vector<int> c{kr.codeCharacterStructure()};
|
||||||
|
|
||||||
for (auto index = 0u; index!=c.size(); ++index)
|
for (auto index = 0u; index!=c.size(); ++index)
|
||||||
decryptedCharacters[k[index]] = c[index];
|
decryptedCharacters[k[index]] = c[index];
|
||||||
|
|||||||
+9
-14
@@ -1,32 +1,27 @@
|
|||||||
#ifndef DECRYPTION_H
|
#ifndef DECRYPTION_H
|
||||||
#define DECRYPTION_H
|
#define DECRYPTION_H
|
||||||
|
|
||||||
|
#include<string>
|
||||||
#include<map>
|
#include<map>
|
||||||
#include"Cryption.h"
|
#include"Cryption.h"
|
||||||
#include"Encryption.h"
|
|
||||||
|
|
||||||
using std::map;
|
|
||||||
|
|
||||||
class Decryption : public Cryption
|
class Decryption : public Cryption
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Decryption() = default;
|
Decryption() = default;
|
||||||
~Decryption() = default;
|
~Decryption() = default;
|
||||||
Decryption(const string&);
|
Decryption(const std::string&);
|
||||||
explicit Decryption(const Password<>&, const Key<>&);
|
|
||||||
|
|
||||||
void setDecryptedMessage(const string&);
|
void setDecryptedMessage(const std::string&);
|
||||||
void setMessage(const string&) override;
|
void setMessage(const std::string&) override;
|
||||||
void retrieveMetaData();
|
|
||||||
void decryptMessage();
|
void decryptMessage();
|
||||||
|
|
||||||
string getDecryptedMessage() const;
|
std::string getDecryptedMessage() const;
|
||||||
string getMessage() const override;
|
std::string getMessage() const override;
|
||||||
private:
|
private:
|
||||||
void setupMap(const Key<>&);
|
void setupMap();
|
||||||
string decryptedMessage;
|
std::string decryptedMessage;
|
||||||
string passwordPath;
|
std::map<std::string, char> decryptedCharacters;
|
||||||
map<string, char> decryptedCharacters;
|
|
||||||
const int keyLength{5};
|
const int keyLength{5};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,87 +0,0 @@
|
|||||||
#ifndef DEMO_H_
|
|
||||||
#define DEMO_H_
|
|
||||||
|
|
||||||
#include<fstream>
|
|
||||||
#include<ios>
|
|
||||||
#include<tuple>
|
|
||||||
#include<array>
|
|
||||||
#include"FolderStructure.h"
|
|
||||||
#include"FileNameRetrieval.h"
|
|
||||||
|
|
||||||
using std::tuple;
|
|
||||||
using std::ios;
|
|
||||||
using std::fstream;
|
|
||||||
using std::cout;
|
|
||||||
using std::endl;
|
|
||||||
using std::get;
|
|
||||||
using std::array;
|
|
||||||
|
|
||||||
template<typename S = string>
|
|
||||||
class Demo
|
|
||||||
{
|
|
||||||
vector<S> passwordFilenames;
|
|
||||||
vector<tuple<int,int,int>> dates;
|
|
||||||
vector<array<int, 3>> grass;
|
|
||||||
|
|
||||||
public:
|
|
||||||
Demo();
|
|
||||||
~Demo();
|
|
||||||
|
|
||||||
void fuckingDoShit();
|
|
||||||
void doFuckingOtherShit();
|
|
||||||
|
|
||||||
vector<S> retrievePasswordFilenames() const;
|
|
||||||
vector<array<int,3>> retrieveGrass() const;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename S>
|
|
||||||
Demo<S>::Demo()
|
|
||||||
{
|
|
||||||
fuckingDoShit();
|
|
||||||
|
|
||||||
}
|
|
||||||
template<typename S>
|
|
||||||
Demo<S>::~Demo()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename S>
|
|
||||||
void Demo<S>::fuckingDoShit()
|
|
||||||
{
|
|
||||||
FileNameRetrieval fnr{};
|
|
||||||
fnr.retrievePasswordNames();
|
|
||||||
vector<string> stupidBitch{fnr.passwordNameContainer()};
|
|
||||||
|
|
||||||
for (auto sb : stupidBitch)
|
|
||||||
{
|
|
||||||
passwordFilenames.push_back(sb);
|
|
||||||
}
|
|
||||||
doFuckingOtherShit();
|
|
||||||
}
|
|
||||||
template<typename S>
|
|
||||||
void Demo<S>::doFuckingOtherShit()
|
|
||||||
{
|
|
||||||
fstream metaShit;
|
|
||||||
|
|
||||||
for (auto shit : passwordFilenames)
|
|
||||||
{
|
|
||||||
metaShit.open(FolderStructure::passwordDirectory+shit.c_str(), std::ios::in);
|
|
||||||
auto year = 0, month = 0, dayOfMonth = 0;
|
|
||||||
metaShit >> year;
|
|
||||||
metaShit >> month;
|
|
||||||
metaShit >> dayOfMonth;
|
|
||||||
|
|
||||||
grass.push_back(array<int,3>{year, month, dayOfMonth});
|
|
||||||
|
|
||||||
metaShit.close();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename S>
|
|
||||||
vector<S> Demo<S>::retrievePasswordFilenames() const { return passwordFilenames; }
|
|
||||||
template<typename S>
|
|
||||||
vector<array<int,3>> Demo<S>::retrieveGrass() const { return grass; }
|
|
||||||
|
|
||||||
#endif
|
|
||||||
+28
-31
@@ -1,32 +1,37 @@
|
|||||||
|
#include<ios>
|
||||||
|
#include<iostream>
|
||||||
#include<fstream>
|
#include<fstream>
|
||||||
|
#include<string>
|
||||||
#include"Encryption.h"
|
#include"Encryption.h"
|
||||||
|
#include"GenerateKeys.h"
|
||||||
#include"GeneratePasswordFileName.h"
|
#include"GeneratePasswordFileName.h"
|
||||||
#include"KeyRetrieval.h"
|
#include"KeyRetrieval.h"
|
||||||
#include"FileNameRetrieval.h"
|
#include"FileNameRetrieval.h"
|
||||||
#include"FolderStructure.h"
|
#include"FolderStructure.h"
|
||||||
|
|
||||||
Encryption::Encryption(const string& message, const string& keyPath)
|
/**
|
||||||
|
Encryption::Encryption(const std::string& message)
|
||||||
|
{
|
||||||
|
this->message = message;
|
||||||
|
setupMap();
|
||||||
|
|
||||||
|
encryptMessage();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
Encryption::Encryption(const std::string& message, const std::string& keyPath)
|
||||||
{
|
{
|
||||||
this->message = message;
|
this->message = message;
|
||||||
setupMap(keyPath);
|
setupMap(keyPath);
|
||||||
configurePasswordFileName();
|
configurePasswordFileName();
|
||||||
}
|
encryptMessage();
|
||||||
Encryption::Encryption(const Password<>& pass, const Key<>& ky)
|
|
||||||
{
|
|
||||||
message.assign(pass.retrieveDecryptedMessage());
|
|
||||||
setupMap(ky.path());
|
|
||||||
encryptMessage(pass);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Encryption::setEncryptedMessage(const string& encryptedMessage) { this->encryptedMessage = encryptedMessage; }
|
void Encryption::setEncryptedMessage(const std::string& encryptedMessage) { this->encryptedMessage = encryptedMessage; }
|
||||||
void Encryption::setMessage(const string& message) { this->message = message; }
|
void Encryption::setMessage(const std::string& message) { this->message = message; }
|
||||||
void Encryption::encryptMessage(const Password<>& pass)
|
void Encryption::encryptMessage()
|
||||||
{
|
{
|
||||||
fstream ioEvent{};
|
std::fstream ioEvent{};
|
||||||
ioEvent.open(pass.passwordPath(), std::ios::out);
|
ioEvent.open(passwordFileName, std::ios::out);
|
||||||
auto p = pass.passwordPath();
|
|
||||||
|
|
||||||
addMetadata(pass, ioEvent);
|
|
||||||
|
|
||||||
for (auto indexOfString = 0u; indexOfString!=message.size(); ++indexOfString)
|
for (auto indexOfString = 0u; indexOfString!=message.size(); ++indexOfString)
|
||||||
{
|
{
|
||||||
@@ -36,21 +41,13 @@ void Encryption::encryptMessage(const Password<>& pass)
|
|||||||
this->encryptedMessage = encryptedMessage;
|
this->encryptedMessage = encryptedMessage;
|
||||||
ioEvent.close();
|
ioEvent.close();
|
||||||
}
|
}
|
||||||
void Encryption::addMetadata(const Password<>& pass, fstream& ioEvent)
|
|
||||||
{
|
|
||||||
auto yearLocal = pass.year;
|
|
||||||
auto monthLocal = pass.month;
|
|
||||||
auto dayOfMonthLocal = pass.dayOfMonth;
|
|
||||||
|
|
||||||
ioEvent << yearLocal << '\n' << monthLocal << '\n' << dayOfMonthLocal << '\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Encryption::setupMap(const string& keyPath)
|
void Encryption::setupMap(const std::string& keyPath)
|
||||||
{
|
{
|
||||||
KeyRetrieval kr{keyPath};
|
KeyRetrieval kr{keyPath};
|
||||||
vector<string> k{kr.keyStructure()};
|
std::vector<std::string> k{kr.keyStructure()};
|
||||||
vector<int> c{kr.codeCharacterStructure()};
|
std::vector<int> c{kr.codeCharacterStructure()};
|
||||||
|
|
||||||
for (auto index = 0u; index!=k.size(); ++index)
|
for (auto index = 0u; index!=k.size(); ++index)
|
||||||
encryptedCharacters[c[index]] = k[index];
|
encryptedCharacters[c[index]] = k[index];
|
||||||
@@ -62,7 +59,7 @@ void Encryption::configurePasswordFileName()
|
|||||||
GeneratePasswordFileName gp{};
|
GeneratePasswordFileName gp{};
|
||||||
passwordFileName.assign(gp.passwordFileNameString());
|
passwordFileName.assign(gp.passwordFileNameString());
|
||||||
}
|
}
|
||||||
string tmpString{passwordFileName};
|
std::string tmpString{passwordFileName};
|
||||||
passwordFileName.assign(FolderStructure::passwordDirectory);
|
passwordFileName.assign(FolderStructure::passwordDirectory);
|
||||||
passwordFileName.append(tmpString);
|
passwordFileName.append(tmpString);
|
||||||
}
|
}
|
||||||
@@ -71,7 +68,7 @@ bool Encryption::repetitive()
|
|||||||
passwordFileName.append(".txt");
|
passwordFileName.append(".txt");
|
||||||
FileNameRetrieval fnr;
|
FileNameRetrieval fnr;
|
||||||
fnr.retrievePasswordNames();
|
fnr.retrievePasswordNames();
|
||||||
vector<string> createdPasswordNames{fnr.passwordNameContainer()};
|
std::vector<std::string> createdPasswordNames{fnr.passwordNameContainer()};
|
||||||
auto count = 0;
|
auto count = 0;
|
||||||
for (auto cPNBegin = createdPasswordNames.begin(); cPNBegin!=createdPasswordNames.end(); ++cPNBegin)
|
for (auto cPNBegin = createdPasswordNames.begin(); cPNBegin!=createdPasswordNames.end(); ++cPNBegin)
|
||||||
{
|
{
|
||||||
@@ -80,6 +77,6 @@ bool Encryption::repetitive()
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
string Encryption::getEncryptedMessage() const { return encryptedMessage; }
|
std::string Encryption::getEncryptedMessage() const { return encryptedMessage; }
|
||||||
string Encryption::getMessage() const { return message; }
|
std::string Encryption::getMessage() const { return message; }
|
||||||
map<char, string> Encryption::encryptedCharactersStructure() { return encryptedCharacters; }
|
std::map<char, std::string> Encryption::encryptedCharactersStructure() { return encryptedCharacters; }
|
||||||
|
|||||||
+13
-18
@@ -1,36 +1,31 @@
|
|||||||
#ifndef ENCRYPTION_H
|
#ifndef ENCRYPTION_H
|
||||||
#define ENCRYPTION_H
|
#define ENCRYPTION_H
|
||||||
|
|
||||||
|
#include<string>
|
||||||
#include<map>
|
#include<map>
|
||||||
#include"Cryption.h"
|
#include"Cryption.h"
|
||||||
#include"Key.h"
|
|
||||||
#include"Password.h"
|
|
||||||
|
|
||||||
using std::map;
|
|
||||||
using std::fstream;
|
|
||||||
|
|
||||||
class Encryption : public Cryption
|
class Encryption : public Cryption
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Encryption() = default;
|
Encryption() = default;
|
||||||
~Encryption() = default;
|
~Encryption() = default;
|
||||||
explicit Encryption(const string&, const string&);
|
//Encryption(const std::string&);
|
||||||
explicit Encryption(const Password<>&, const Key<>&);
|
explicit Encryption(const std::string&, const std::string&);
|
||||||
|
|
||||||
void setEncryptedMessage(const string&);
|
void setEncryptedMessage(const std::string&);
|
||||||
void setMessage(const string&) override;
|
void setMessage(const std::string&) override;
|
||||||
void encryptMessage(const Password<>&);
|
void encryptMessage();
|
||||||
void addMetadata(const Password<>&, fstream&);
|
|
||||||
|
|
||||||
string getEncryptedMessage() const;
|
std::string getEncryptedMessage() const;
|
||||||
string getMessage() const override;
|
std::string getMessage() const override;
|
||||||
map<char, string> encryptedCharactersStructure();
|
std::map<char, std::string> encryptedCharactersStructure();
|
||||||
private:
|
private:
|
||||||
void setupMap(const string&);
|
void setupMap(const std::string&);
|
||||||
void configurePasswordFileName();
|
void configurePasswordFileName();
|
||||||
bool repetitive();
|
bool repetitive();
|
||||||
string encryptedMessage;
|
std::string encryptedMessage;
|
||||||
string passwordFileName;
|
std::string passwordFileName;
|
||||||
map<char, string> encryptedCharacters;
|
std::map<char, std::string> encryptedCharacters;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
FileNameRetrieval::FileNameRetrieval() { }
|
FileNameRetrieval::FileNameRetrieval() { }
|
||||||
|
|
||||||
vector<string> FileNameRetrieval::fileNameContainer() const { return fileNames; }
|
std::vector<std::string> FileNameRetrieval::fileNameContainer() const { return fileNames; }
|
||||||
vector<string> FileNameRetrieval::passwordNameContainer() const { return passwordNames; }
|
std::vector<std::string> FileNameRetrieval::passwordNameContainer() const { return passwordNames; }
|
||||||
void FileNameRetrieval::retrieveFileNames()
|
void FileNameRetrieval::retrieveFileNames()
|
||||||
{
|
{
|
||||||
boost::filesystem::path directory(FolderStructure::keyDirectory);
|
boost::filesystem::path directory(FolderStructure::keyDirectory);
|
||||||
@@ -23,8 +23,5 @@ void FileNameRetrieval::retrievePasswordNames()
|
|||||||
|
|
||||||
for (; beg!=end; ++beg)
|
for (; beg!=end; ++beg)
|
||||||
if (beg->path().extension()==".txt")
|
if (beg->path().extension()==".txt")
|
||||||
{
|
passwordNames.push_back(beg->path().filename().string());
|
||||||
std::string passwordFilename = beg->path().filename().string();
|
|
||||||
passwordNames.push_back(passwordFilename);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-7
@@ -4,9 +4,6 @@
|
|||||||
#include<vector>
|
#include<vector>
|
||||||
#include<string>
|
#include<string>
|
||||||
|
|
||||||
using std::string;
|
|
||||||
using std::vector;
|
|
||||||
|
|
||||||
class FileNameRetrieval
|
class FileNameRetrieval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -14,10 +11,10 @@ public:
|
|||||||
|
|
||||||
void retrieveFileNames();
|
void retrieveFileNames();
|
||||||
void retrievePasswordNames();
|
void retrievePasswordNames();
|
||||||
vector<string> fileNameContainer() const;
|
std::vector<std::string> fileNameContainer() const;
|
||||||
vector<string> passwordNameContainer() const;
|
std::vector<std::string> passwordNameContainer() const;
|
||||||
private:
|
private:
|
||||||
vector<string> fileNames;
|
std::vector<std::string> fileNames;
|
||||||
vector<string> passwordNames;
|
std::vector<std::string> passwordNames;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+4
-4
@@ -1,9 +1,9 @@
|
|||||||
#include"FolderStructure.h"
|
#include"FolderStructure.h"
|
||||||
|
|
||||||
string FolderStructure::rootDirectory{};
|
std::string FolderStructure::rootDirectory{};
|
||||||
string FolderStructure::keyDirectory{};
|
std::string FolderStructure::keyDirectory{};
|
||||||
string FolderStructure::passwordDirectory{};
|
std::string FolderStructure::passwordDirectory{};
|
||||||
string FolderStructure::settingDirectory{};
|
std::string FolderStructure::settingDirectory{};
|
||||||
|
|
||||||
void FolderStructure::setupPaths(const char* rootPath)
|
void FolderStructure::setupPaths(const char* rootPath)
|
||||||
{
|
{
|
||||||
|
|||||||
+4
-6
@@ -3,14 +3,12 @@
|
|||||||
|
|
||||||
#include<string>
|
#include<string>
|
||||||
|
|
||||||
using std::string;
|
|
||||||
|
|
||||||
struct FolderStructure
|
struct FolderStructure
|
||||||
{
|
{
|
||||||
static string rootDirectory;
|
static std::string rootDirectory;
|
||||||
static string keyDirectory;
|
static std::string keyDirectory;
|
||||||
static string passwordDirectory;
|
static std::string passwordDirectory;
|
||||||
static string settingDirectory;
|
static std::string settingDirectory;
|
||||||
|
|
||||||
void setupPaths(const char*);
|
void setupPaths(const char*);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,72 +0,0 @@
|
|||||||
#ifndef GENERATEDATE_H_
|
|
||||||
#define GENERATEDATE_H_
|
|
||||||
|
|
||||||
#include<ctime>
|
|
||||||
#include<cstdlib>
|
|
||||||
#include<string>
|
|
||||||
|
|
||||||
using std::string;
|
|
||||||
|
|
||||||
template<typename S = string, typename I = int>
|
|
||||||
class GenerateDate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
GenerateDate();
|
|
||||||
~GenerateDate() = default;
|
|
||||||
|
|
||||||
void initializeData();
|
|
||||||
void generation();
|
|
||||||
|
|
||||||
S retrieveDateString() const { return dateString; }
|
|
||||||
private:
|
|
||||||
S dateString;
|
|
||||||
I year, month, day;
|
|
||||||
time_t unixEpoch;
|
|
||||||
tm* currentTime;
|
|
||||||
};
|
|
||||||
template<typename S, typename I>
|
|
||||||
GenerateDate<S,I>::GenerateDate()
|
|
||||||
{
|
|
||||||
initializeData();
|
|
||||||
generation();
|
|
||||||
}
|
|
||||||
template<typename S, typename I>
|
|
||||||
void GenerateDate<S,I>::initializeData()
|
|
||||||
{
|
|
||||||
unixEpoch = time(0);
|
|
||||||
currentTime = localtime(&unixEpoch);
|
|
||||||
|
|
||||||
year = 1900 + currentTime->tm_year;
|
|
||||||
month = 1 + currentTime->tm_mon;
|
|
||||||
day = currentTime->tm_mday;
|
|
||||||
|
|
||||||
}
|
|
||||||
template<typename S, typename I>
|
|
||||||
void GenerateDate<S,I>::generation()
|
|
||||||
{
|
|
||||||
if (month<10 && day<10)
|
|
||||||
{
|
|
||||||
dateString.assign(std::to_string(year));
|
|
||||||
dateString.append("0"+std::to_string(month));
|
|
||||||
dateString.append("0"+std::to_string(day));
|
|
||||||
}
|
|
||||||
else if (month<10 && day>=10)
|
|
||||||
{
|
|
||||||
dateString.assign(std::to_string(year));
|
|
||||||
dateString.append("0"+std::to_string(month));
|
|
||||||
dateString.append(std::to_string(day));
|
|
||||||
}
|
|
||||||
else if (month>=10 && day<10)
|
|
||||||
{
|
|
||||||
dateString.assign(std::to_string(year));
|
|
||||||
dateString.append(std::to_string(month));
|
|
||||||
dateString.append("0"+std::to_string(day));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dateString.assign(std::to_string(year));
|
|
||||||
dateString.append(std::to_string(month));
|
|
||||||
dateString.append(std::to_string(day));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -0,0 +1,201 @@
|
|||||||
|
#include<iostream>
|
||||||
|
#include<cstdlib>
|
||||||
|
#include<ctime>
|
||||||
|
#include<sstream>
|
||||||
|
#include<fstream>
|
||||||
|
#include<ios>
|
||||||
|
#include<ctime>
|
||||||
|
#include"GenerateKeys.h"
|
||||||
|
#include"FolderStructure.h"
|
||||||
|
|
||||||
|
GenerateKeys::GenerateKeys()
|
||||||
|
{
|
||||||
|
srand(time(0));
|
||||||
|
populateSymbols();
|
||||||
|
populateNumbers();
|
||||||
|
populateLetters();
|
||||||
|
|
||||||
|
addToCentralContainer(symbols);
|
||||||
|
addToCentralContainer(numbers);
|
||||||
|
addToCentralContainer(letters);
|
||||||
|
|
||||||
|
generatedFileName();
|
||||||
|
|
||||||
|
//populateDecryptedValues();
|
||||||
|
//populateEncryptedValues();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GenerateKeys::populateDecryptedValues()
|
||||||
|
{
|
||||||
|
std::fstream readKeys{};
|
||||||
|
readKeys.open(defaultKeyFileName, std::ios::in);
|
||||||
|
std::string tmpKey{};
|
||||||
|
for (auto index = 0u; index!=allCharacters.size(); ++index)
|
||||||
|
{
|
||||||
|
readKeys >> tmpKey;
|
||||||
|
decryptedCharacters[tmpKey] = static_cast<char>(allCharacters[index]);
|
||||||
|
tmpKey.assign("");
|
||||||
|
}
|
||||||
|
readKeys.close();
|
||||||
|
}
|
||||||
|
void GenerateKeys::populateEncryptedValues()
|
||||||
|
{
|
||||||
|
std::fstream readKeys{};
|
||||||
|
readKeys.open(defaultKeyFileName, std::ios::in);
|
||||||
|
std::string tmpKey{};
|
||||||
|
for (auto index = 0u; index!=allCharacters.size(); ++index)
|
||||||
|
{
|
||||||
|
readKeys >> tmpKey;
|
||||||
|
encryptedCharacters[decryptedCharacters[tmpKey]] = tmpKey;
|
||||||
|
tmpKey.assign("");
|
||||||
|
}
|
||||||
|
readKeys.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GenerateKeys::generatedFileName()
|
||||||
|
{
|
||||||
|
time_t epochTime = time(0);
|
||||||
|
tm* currentTime = localtime(&epochTime);
|
||||||
|
|
||||||
|
auto year = 1900+currentTime->tm_year;
|
||||||
|
auto month = 1+currentTime->tm_mon;
|
||||||
|
auto dayOfmonth = currentTime->tm_mday;
|
||||||
|
|
||||||
|
if (month<10 && dayOfmonth<10)
|
||||||
|
{
|
||||||
|
defaultKeyFileName.assign(std::to_string(year));
|
||||||
|
defaultKeyFileName.append("0"+std::to_string(month));
|
||||||
|
defaultKeyFileName.append("0"+std::to_string(dayOfmonth));
|
||||||
|
}
|
||||||
|
else if (month<10 && dayOfmonth>=10)
|
||||||
|
{
|
||||||
|
defaultKeyFileName.assign(std::to_string(year));
|
||||||
|
defaultKeyFileName.append("0"+std::to_string(month));
|
||||||
|
defaultKeyFileName.append(std::to_string(dayOfmonth));
|
||||||
|
}
|
||||||
|
else if (month>=10 && dayOfmonth<10)
|
||||||
|
{
|
||||||
|
defaultKeyFileName.assign(std::to_string(year));
|
||||||
|
defaultKeyFileName.append(std::to_string(month));
|
||||||
|
defaultKeyFileName.append("0"+std::to_string(dayOfmonth));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
defaultKeyFileName.assign(std::to_string(year));
|
||||||
|
defaultKeyFileName.append(std::to_string(month));
|
||||||
|
defaultKeyFileName.append(std::to_string(dayOfmonth));
|
||||||
|
}
|
||||||
|
for (auto index=0; index!=8; ++index)
|
||||||
|
{
|
||||||
|
if (index==0) defaultKeyFileName.append("_");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto randomInteger = rand()%10;
|
||||||
|
defaultKeyFileName.append(std::to_string(randomInteger));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
defaultKeyFileName.append(".txt");
|
||||||
|
std::cout<<defaultKeyFileName<<std::endl;
|
||||||
|
}
|
||||||
|
void GenerateKeys::populateSymbols()
|
||||||
|
{
|
||||||
|
addRange(symbols, 10, 10);
|
||||||
|
addRange(symbols, 32, 47);
|
||||||
|
addRange(symbols, 58, 64);
|
||||||
|
addRange(symbols, 91, 96);
|
||||||
|
addRange(symbols, 123, 126);
|
||||||
|
}
|
||||||
|
void GenerateKeys::populateNumbers()
|
||||||
|
{
|
||||||
|
addRange(numbers, 48, 57);
|
||||||
|
}
|
||||||
|
void GenerateKeys::populateLetters()
|
||||||
|
{
|
||||||
|
addRange(letters, 65, 90);
|
||||||
|
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, ++from)
|
||||||
|
ch.push_back(from);
|
||||||
|
}
|
||||||
|
void GenerateKeys::addToCentralContainer(std::vector<int>& con)
|
||||||
|
{
|
||||||
|
for (auto index = 0u; index!=con.size(); ++index)
|
||||||
|
allCharacters.push_back(con[index]);
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
void GenerateKeys::keyMove()
|
||||||
|
{
|
||||||
|
for (auto index = 0u; index!=allCharacters.size(); ++index)
|
||||||
|
{
|
||||||
|
std::string tmpKey{};
|
||||||
|
generateKey(tmpKey, keySize);
|
||||||
|
keys.push_back(tmpKey);
|
||||||
|
}
|
||||||
|
if (isThereRepetition())
|
||||||
|
{
|
||||||
|
keys.clear();
|
||||||
|
keyMove();
|
||||||
|
}
|
||||||
|
std::cout << "No repetitions in keys" << std::endl;
|
||||||
|
}
|
||||||
|
void GenerateKeys::print(const std::vector<int>& ch)
|
||||||
|
{
|
||||||
|
for (auto index = 0u; index!=ch.size(); ++index)
|
||||||
|
std::cout << ch[index] << " ";
|
||||||
|
std::cout << std::endl;
|
||||||
|
}
|
||||||
|
bool GenerateKeys::isThereRepetition()
|
||||||
|
{
|
||||||
|
for (auto index = 0u; index!=allCharacters.size(); ++index)
|
||||||
|
{
|
||||||
|
std::string chosenOne{keys[index]};
|
||||||
|
auto repetition{0};
|
||||||
|
for (auto innerIndex = 0u; innerIndex!=allCharacters.size(); ++innerIndex)
|
||||||
|
if (chosenOne == keys[innerIndex])
|
||||||
|
++repetition;
|
||||||
|
if (repetition > 1)
|
||||||
|
{
|
||||||
|
std::cout << "Too much repetitive stuff" << std::endl;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
void GenerateKeys::keyDump()
|
||||||
|
{
|
||||||
|
std::fstream dump{};
|
||||||
|
dump.open(FolderStructure::keyDirectory+defaultKeyFileName, std::ios::out);
|
||||||
|
for (auto index = 0u; index!=keys.size(); ++index)
|
||||||
|
dump << keys[index] << '\n';
|
||||||
|
dump.close();
|
||||||
|
std::cout<<"dumped in: "<<FolderStructure::keyDirectory<<std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char GenerateKeys::getChar(std::vector<int>& ch)
|
||||||
|
{
|
||||||
|
char hc = ch[rand() % ch.size()];
|
||||||
|
while (hc==32 || hc==10)
|
||||||
|
hc = getChar(ch);
|
||||||
|
|
||||||
|
return hc;
|
||||||
|
}
|
||||||
+23
-195
@@ -1,36 +1,20 @@
|
|||||||
#ifndef GENERATEKEYS_H
|
#ifndef GENERATEKEYS_H
|
||||||
#define GENERATEKEYS_H
|
#define GENERATEKEYS_H
|
||||||
|
|
||||||
|
#include<string>
|
||||||
|
#include<vector>
|
||||||
#include<map>
|
#include<map>
|
||||||
#include<forward_list>
|
|
||||||
#include<iostream>
|
|
||||||
#include<cstdlib>
|
|
||||||
#include<sstream>
|
|
||||||
#include<fstream>
|
|
||||||
#include<ios>
|
|
||||||
#include"Characters.h"
|
|
||||||
#include"GenerateDate.h"
|
|
||||||
#include"FolderStructure.h"
|
|
||||||
#include"Key.h"
|
|
||||||
|
|
||||||
using std::vector;
|
class GenerateKeys
|
||||||
using std::string;
|
|
||||||
using std::forward_list;
|
|
||||||
using std::array;
|
|
||||||
using std::stringstream;
|
|
||||||
using std::size_t;
|
|
||||||
using std::to_string;
|
|
||||||
using std::fstream;
|
|
||||||
|
|
||||||
class GenerateKeys : public Characters<char>
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
GenerateKeys();
|
GenerateKeys();
|
||||||
~GenerateKeys() = default;
|
~GenerateKeys() = default;
|
||||||
|
|
||||||
void keyMove(Key<>&);
|
void populateDecryptedValues();
|
||||||
void keyDump(Key<>&);
|
void populateEncryptedValues();
|
||||||
|
void keyMove();
|
||||||
|
void keyDump();
|
||||||
|
|
||||||
friend class Encryption;
|
friend class Encryption;
|
||||||
friend class Decryption;
|
friend class Decryption;
|
||||||
@@ -40,182 +24,26 @@ private:
|
|||||||
void populateSymbols();
|
void populateSymbols();
|
||||||
void populateNumbers();
|
void populateNumbers();
|
||||||
void populateLetters();
|
void populateLetters();
|
||||||
template<typename C, typename L>
|
void addRange(std::vector<int>&, int, const int);
|
||||||
void addToDesignatedContainer(C&, const L&);
|
void addToCentralContainer(std::vector<int>&);
|
||||||
template<typename C, typename DT>
|
|
||||||
void addRange(C&, DT, const DT);
|
|
||||||
template<typename C>
|
|
||||||
void addToCentralContainer(C&);
|
|
||||||
|
|
||||||
template<typename S, typename DT>
|
void generateKey(std::string&, const int&);
|
||||||
void generateKey(S&, const DT);
|
bool isThereRepetition();
|
||||||
bool isThereRepetition(const Key<>&);
|
void print(const std::vector<int>&);
|
||||||
template<typename C>
|
|
||||||
void print(const C&);
|
|
||||||
|
|
||||||
template<typename C>
|
char getChar(std::vector<int>&);
|
||||||
char getChar(const C&);
|
|
||||||
|
|
||||||
string defaultKeyFileName;
|
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{};
|
||||||
|
|
||||||
|
std::string defaultKeyFileName{"default_keys.txt"};
|
||||||
//KeySize show equal the value in key
|
//KeySize show equal the value in key
|
||||||
const int keySize{5};
|
const int keySize{5};
|
||||||
|
char key[5]{};
|
||||||
};
|
};
|
||||||
|
|
||||||
GenerateKeys::GenerateKeys()
|
|
||||||
{
|
|
||||||
srand(time(0));
|
|
||||||
populateSymbols();
|
|
||||||
populateNumbers();
|
|
||||||
populateLetters();
|
|
||||||
|
|
||||||
addToCentralContainer(symbols);
|
|
||||||
addToCentralContainer(numbers);
|
|
||||||
addToCentralContainer(letters);
|
|
||||||
|
|
||||||
generatedFileName();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GenerateKeys::generatedFileName()
|
|
||||||
{
|
|
||||||
GenerateDate<string, int> gd;
|
|
||||||
defaultKeyFileName.assign(gd.retrieveDateString());
|
|
||||||
for (auto index=0; index!=8; ++index)
|
|
||||||
{
|
|
||||||
if (index==0) defaultKeyFileName.append("_");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
auto randomInteger = rand()%10;
|
|
||||||
defaultKeyFileName.append(to_string(randomInteger));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
defaultKeyFileName.append(".txt");
|
|
||||||
}
|
|
||||||
void GenerateKeys::populateSymbols()
|
|
||||||
{
|
|
||||||
forward_list<int> symbolCodes;
|
|
||||||
addRange(symbolCodes, 10, 10);
|
|
||||||
addRange(symbolCodes, 32, 47);
|
|
||||||
addRange(symbolCodes, 58, 64);
|
|
||||||
addRange(symbolCodes, 91, 96);
|
|
||||||
addRange(symbolCodes, 123, 126);
|
|
||||||
symbolCodes.sort();
|
|
||||||
addToDesignatedContainer(symbols, symbolCodes);
|
|
||||||
}
|
|
||||||
void GenerateKeys::populateNumbers()
|
|
||||||
{
|
|
||||||
forward_list<int> numberCodes;
|
|
||||||
addRange(numberCodes, 48, 57);
|
|
||||||
numberCodes.sort();
|
|
||||||
addToDesignatedContainer(numbers, numberCodes);
|
|
||||||
}
|
|
||||||
void GenerateKeys::populateLetters()
|
|
||||||
{
|
|
||||||
forward_list<int> letterCodes;
|
|
||||||
addRange(letterCodes, 65, 90);
|
|
||||||
addRange(letterCodes, 97, 122);
|
|
||||||
letterCodes.sort();
|
|
||||||
addToDesignatedContainer(letters, letterCodes);
|
|
||||||
}
|
|
||||||
template<typename C, typename L>
|
|
||||||
void GenerateKeys::addToDesignatedContainer(C& cont, const L& listOfValues)
|
|
||||||
{
|
|
||||||
auto listIter = listOfValues.begin();
|
|
||||||
for (auto index = 0; index!=cont.size() && listIter!=listOfValues.end(); ++index)
|
|
||||||
{
|
|
||||||
cont[index] = *listIter++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
template<typename C, typename DT>
|
|
||||||
void GenerateKeys::addRange(C& ch, DT from, const DT to)
|
|
||||||
{
|
|
||||||
auto range = to - from;
|
|
||||||
for (auto index = 0; index<=range; ++index, ++from)
|
|
||||||
ch.push_front(from);
|
|
||||||
}
|
|
||||||
template<typename C>
|
|
||||||
void GenerateKeys::addToCentralContainer(C& con)
|
|
||||||
{
|
|
||||||
for (auto index = 0u; index!=con.size(); ++index)
|
|
||||||
allCharacters.push_back(*&con[index]);
|
|
||||||
}
|
|
||||||
template<typename S, typename DT>
|
|
||||||
void GenerateKeys::generateKey(S& key, const DT size)
|
|
||||||
{
|
|
||||||
S ky;
|
|
||||||
ky.resize(size);
|
|
||||||
auto begKy = ky.begin();
|
|
||||||
for (auto index = 0; index!=size; ++index, ++begKy)
|
|
||||||
{
|
|
||||||
if (index < 2)
|
|
||||||
*begKy = getChar(letters);
|
|
||||||
else if (index < 3 && index > 1)
|
|
||||||
*begKy = getChar(symbols);
|
|
||||||
else
|
|
||||||
*begKy = getChar(numbers);
|
|
||||||
}
|
|
||||||
key.assign(ky);
|
|
||||||
}
|
|
||||||
template<typename C>
|
|
||||||
void GenerateKeys::print(const C& ch)
|
|
||||||
{
|
|
||||||
for (auto beg = ch.begin(); beg!=ch.end(); ++beg)
|
|
||||||
std::cout << *beg << " ";
|
|
||||||
std::cout << std::endl;
|
|
||||||
}
|
|
||||||
void GenerateKeys::keyMove(Key<>& theKey)
|
|
||||||
{
|
|
||||||
vector<string> iGotTheKeysDurf;
|
|
||||||
for (auto index = 0u; index!=allCharacters.size(); ++index)
|
|
||||||
{
|
|
||||||
string tmpKey{};
|
|
||||||
generateKey(tmpKey, keySize);
|
|
||||||
iGotTheKeysDurf.push_back(tmpKey);
|
|
||||||
}
|
|
||||||
theKey.keysInit(iGotTheKeysDurf);
|
|
||||||
if (isThereRepetition(theKey))
|
|
||||||
{
|
|
||||||
iGotTheKeysDurf.clear();
|
|
||||||
keyMove(theKey);
|
|
||||||
}
|
|
||||||
std::cout << "No repetitions in keys" << std::endl;
|
|
||||||
}
|
|
||||||
void GenerateKeys::keyDump(Key<>& theKey)
|
|
||||||
{
|
|
||||||
fstream dump{};
|
|
||||||
auto path = theKey.path();
|
|
||||||
auto iGotTheKeysDurf = theKey.retrieveKeys();
|
|
||||||
dump.open(path, std::ios::out);
|
|
||||||
for (auto index = 0u; index!=iGotTheKeysDurf.size(); ++index)
|
|
||||||
dump << iGotTheKeysDurf[index] << '\n';
|
|
||||||
dump.close();
|
|
||||||
}
|
|
||||||
template<typename C>
|
|
||||||
char GenerateKeys::getChar(const C& ch)
|
|
||||||
{
|
|
||||||
char whitespace = 32;
|
|
||||||
char newLine = 10;
|
|
||||||
char hc = ch[rand() % ch.size()];
|
|
||||||
while (hc==whitespace || hc==newLine)
|
|
||||||
hc = getChar(ch);
|
|
||||||
|
|
||||||
return hc;
|
|
||||||
}
|
|
||||||
bool GenerateKeys::isThereRepetition(const Key<>& theKey)
|
|
||||||
{
|
|
||||||
vector<string> iGotTheKeysDurf = theKey.retrieveKeys();
|
|
||||||
for (auto index = 0u; index!=allCharacters.size(); ++index)
|
|
||||||
{
|
|
||||||
string chosenOne{iGotTheKeysDurf[index]};
|
|
||||||
auto repetition = 0;
|
|
||||||
for (auto innerIndex = 0u; innerIndex!=allCharacters.size(); ++innerIndex)
|
|
||||||
if (chosenOne == iGotTheKeysDurf[innerIndex])
|
|
||||||
++repetition;
|
|
||||||
if (repetition > 1)
|
|
||||||
{
|
|
||||||
std::cout << "Too much repetitive stuff" << std::endl;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -5,11 +5,42 @@
|
|||||||
|
|
||||||
GeneratePasswordFileName::GeneratePasswordFileName()
|
GeneratePasswordFileName::GeneratePasswordFileName()
|
||||||
{
|
{
|
||||||
|
srand(time(0));
|
||||||
generatedFileName();
|
generatedFileName();
|
||||||
}
|
}
|
||||||
void GeneratePasswordFileName::generatedFileName()
|
void GeneratePasswordFileName::generatedFileName()
|
||||||
{
|
{
|
||||||
filename.assign(dateString());
|
time_t epochTime = time(0);
|
||||||
|
tm* currentTime = localtime(&epochTime);
|
||||||
|
|
||||||
|
auto year = 1900 + currentTime->tm_year;
|
||||||
|
auto month = 1 + currentTime->tm_mon;
|
||||||
|
auto dayOfMonth = currentTime->tm_mday;
|
||||||
|
|
||||||
|
if (month<10 && dayOfMonth<10)
|
||||||
|
{
|
||||||
|
filename.assign(std::to_string(year));
|
||||||
|
filename.append("0"+std::to_string(month));
|
||||||
|
filename.append("0"+std::to_string(dayOfMonth));
|
||||||
|
}
|
||||||
|
else if (month<10 && dayOfMonth>=10)
|
||||||
|
{
|
||||||
|
filename.assign(std::to_string(year));
|
||||||
|
filename.append("0"+std::to_string(month));
|
||||||
|
filename.append(std::to_string(dayOfMonth));
|
||||||
|
}
|
||||||
|
else if (month>=10 && dayOfMonth<10)
|
||||||
|
{
|
||||||
|
filename.assign(std::to_string(year));
|
||||||
|
filename.append(std::to_string(month));
|
||||||
|
filename.append("0"+std::to_string(dayOfMonth));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
filename.assign(std::to_string(year));
|
||||||
|
filename.append(std::to_string(month));
|
||||||
|
filename.append(std::to_string(dayOfMonth));
|
||||||
|
}
|
||||||
for (auto index = 0; index!=8; ++index)
|
for (auto index = 0; index!=8; ++index)
|
||||||
{
|
{
|
||||||
if (index==0) filename.append("_");
|
if (index==0) filename.append("_");
|
||||||
@@ -21,7 +52,4 @@ void GeneratePasswordFileName::generatedFileName()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string GeneratePasswordFileName::passwordFileNameString() const { return filename; }
|
std::string GeneratePasswordFileName::passwordFileNameString() const { return filename; }
|
||||||
int GeneratePasswordFileName::retrieveYear() const { return year; }
|
|
||||||
int GeneratePasswordFileName::retrieveMonth() const { return month; }
|
|
||||||
int GeneratePasswordFileName::retrieveDayOfMonth() const { return dayOfMonth; }
|
|
||||||
|
|||||||
@@ -1,20 +1,15 @@
|
|||||||
#ifndef GENERATEPASSWORDFILENAME_H_
|
#ifndef GENERATEPASSWORDFILENAME_H_
|
||||||
#define GENERATEPASSWORDFILENAME_H_
|
#define GENERATEPASSWORDFILENAME_H_
|
||||||
|
|
||||||
#include"TimeInformation.h"
|
#include<string>
|
||||||
|
|
||||||
using std::string;
|
class GeneratePasswordFileName
|
||||||
|
|
||||||
class GeneratePasswordFileName : public TimeInformation<int>
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GeneratePasswordFileName();
|
GeneratePasswordFileName();
|
||||||
string passwordFileNameString() const;
|
std::string passwordFileNameString() const;
|
||||||
int retrieveYear() const;
|
|
||||||
int retrieveMonth() const;
|
|
||||||
int retrieveDayOfMonth() const;
|
|
||||||
private:
|
private:
|
||||||
void generatedFileName();
|
void generatedFileName();
|
||||||
string filename;
|
std::string filename;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,69 +0,0 @@
|
|||||||
#ifndef KEY_H_
|
|
||||||
#define KEY_H_
|
|
||||||
|
|
||||||
#include<vector>
|
|
||||||
#include"FolderStructure.h"
|
|
||||||
#include"GenerateDate.h"
|
|
||||||
|
|
||||||
using std::string;
|
|
||||||
using std::vector;
|
|
||||||
|
|
||||||
template<typename S = string>
|
|
||||||
class Key
|
|
||||||
{
|
|
||||||
S filename;
|
|
||||||
const S keyDirectory{FolderStructure::keyDirectory};
|
|
||||||
vector<S> keys;
|
|
||||||
public:
|
|
||||||
Key();
|
|
||||||
explicit Key(const S&);
|
|
||||||
~Key() = default;
|
|
||||||
|
|
||||||
void keysInit(vector<S>&);
|
|
||||||
void setupFilename(const S&);
|
|
||||||
void generatedFilename();
|
|
||||||
S path() const;
|
|
||||||
S retrieveFilename() const;
|
|
||||||
vector<S> retrieveKeys() const;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename S>
|
|
||||||
Key<S>::Key()
|
|
||||||
{
|
|
||||||
generatedFilename();
|
|
||||||
}
|
|
||||||
template<typename S>
|
|
||||||
Key<S>::Key(const S& filename) : filename(filename)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename S>
|
|
||||||
void Key<S>::keysInit(vector<S>& keyFromElseWhere)
|
|
||||||
{
|
|
||||||
keys.swap(keyFromElseWhere);
|
|
||||||
}
|
|
||||||
template<typename S>
|
|
||||||
void Key<S>::setupFilename(const S& filename) { this->filename.assign(filename); }
|
|
||||||
template<typename S>
|
|
||||||
void Key<S>::generatedFilename()
|
|
||||||
{
|
|
||||||
GenerateDate<S, int> gd;
|
|
||||||
filename.assign(gd.retrieveDateString());
|
|
||||||
for (auto index=0; index!=8; ++index)
|
|
||||||
{
|
|
||||||
if (index==0) filename.append("_");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
auto randomInteger = rand()%10;
|
|
||||||
filename.append(std::to_string(randomInteger));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
filename.append(".txt");
|
|
||||||
}
|
|
||||||
template<typename S>
|
|
||||||
S Key<S>::retrieveFilename() const { return filename; }
|
|
||||||
template<typename S>
|
|
||||||
S Key<S>::path() const { return keyDirectory + filename; }
|
|
||||||
template<typename S>
|
|
||||||
vector<S> Key<S>::retrieveKeys() const { return keys; }
|
|
||||||
#endif
|
|
||||||
+30
-18
@@ -1,8 +1,10 @@
|
|||||||
|
#include<QString>
|
||||||
#include<QWidget>
|
#include<QWidget>
|
||||||
#include<QHeaderView>
|
#include<QHeaderView>
|
||||||
#include<QTableWidgetItem>
|
#include<QTableWidgetItem>
|
||||||
#include<iostream>
|
#include<iostream>
|
||||||
#include<string>
|
#include<string>
|
||||||
|
#include<sstream>
|
||||||
#include<cstdlib>
|
#include<cstdlib>
|
||||||
#include<fstream>
|
#include<fstream>
|
||||||
#include<ios>
|
#include<ios>
|
||||||
@@ -11,20 +13,15 @@
|
|||||||
#include"Encryption.h"
|
#include"Encryption.h"
|
||||||
#include"GenerateKeys.h"
|
#include"GenerateKeys.h"
|
||||||
#include"KeyRetrieval.h"
|
#include"KeyRetrieval.h"
|
||||||
|
#include"Conversions.h"
|
||||||
#include"FileNameRetrieval.h"
|
#include"FileNameRetrieval.h"
|
||||||
#include"FolderStructure.h"
|
#include"FolderStructure.h"
|
||||||
#include"Key.h"
|
|
||||||
|
|
||||||
KeyManagementWindow::KeyManagementWindow(QWidget* parent) : QDialog(parent)
|
KeyManagementWindow::KeyManagementWindow(QWidget* parent) : QDialog(parent)
|
||||||
{
|
{
|
||||||
setupWindow();
|
setupWindow();
|
||||||
connections();
|
connections();
|
||||||
}
|
}
|
||||||
KeyManagementWindow::KeyManagementWindow(QWidget* parent, MainWindow* mw, PasswordManagementWindow* pw) : QDialog(parent), mw(mw), pw(pw)
|
|
||||||
{
|
|
||||||
setupWindow();
|
|
||||||
connections();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void KeyManagementWindow::setContentsOfComboBox()
|
void KeyManagementWindow::setContentsOfComboBox()
|
||||||
@@ -32,7 +29,7 @@ void KeyManagementWindow::setContentsOfComboBox()
|
|||||||
selectionBox.get()->clear();
|
selectionBox.get()->clear();
|
||||||
FileNameRetrieval fnr;
|
FileNameRetrieval fnr;
|
||||||
fnr.retrieveFileNames();
|
fnr.retrieveFileNames();
|
||||||
vector<string> fn{fnr.fileNameContainer()};
|
std::vector<std::string> fn{fnr.fileNameContainer()};
|
||||||
|
|
||||||
for (auto fle: fn)
|
for (auto fle: fn)
|
||||||
{
|
{
|
||||||
@@ -44,11 +41,11 @@ void KeyManagementWindow::setContentOfKeyView()
|
|||||||
{
|
{
|
||||||
QString testQ;
|
QString testQ;
|
||||||
testQ.append(selectionBox.get()->currentText());
|
testQ.append(selectionBox.get()->currentText());
|
||||||
string testS{FolderStructure::keyDirectory+testQ.toStdString()};
|
std::string testS{FolderStructure::keyDirectory+testQ.toStdString()};
|
||||||
|
|
||||||
KeyRetrieval kr{testS};
|
KeyRetrieval kr{testS};
|
||||||
vector<int> asciiKeys{kr.codeCharacterStructure()};
|
std::vector<int> asciiKeys{kr.codeCharacterStructure()};
|
||||||
vector<string> asciiAssignment{kr.keyStructure()};
|
std::vector<std::string> asciiAssignment{kr.keyStructure()};
|
||||||
|
|
||||||
auto asciiKeysIter = asciiKeys.begin();
|
auto asciiKeysIter = asciiKeys.begin();
|
||||||
auto asciiAssignmentIter = asciiAssignment.begin();
|
auto asciiAssignmentIter = asciiAssignment.begin();
|
||||||
@@ -58,7 +55,7 @@ void KeyManagementWindow::setContentOfKeyView()
|
|||||||
{
|
{
|
||||||
if (column==0)
|
if (column==0)
|
||||||
{
|
{
|
||||||
string val;
|
std::string val;
|
||||||
QString s;
|
QString s;
|
||||||
switch (*asciiKeysIter)
|
switch (*asciiKeysIter)
|
||||||
{
|
{
|
||||||
@@ -73,7 +70,7 @@ void KeyManagementWindow::setContentOfKeyView()
|
|||||||
++asciiKeysIter;
|
++asciiKeysIter;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
val.assign(string{static_cast<char>(*asciiKeysIter++)});
|
val.assign(std::string{static_cast<char>(*asciiKeysIter++)});
|
||||||
s.append(val.c_str());
|
s.append(val.c_str());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -81,7 +78,7 @@ void KeyManagementWindow::setContentOfKeyView()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string val{*asciiAssignmentIter++};
|
std::string val{*asciiAssignmentIter++};
|
||||||
QString s{val.c_str()};
|
QString s{val.c_str()};
|
||||||
elementView.get()->setItem(row, column, new QTableWidgetItem(s));
|
elementView.get()->setItem(row, column, new QTableWidgetItem(s));
|
||||||
}
|
}
|
||||||
@@ -146,14 +143,29 @@ void KeyManagementWindow::connections()
|
|||||||
QObject::connect(closeButton.get(), SIGNAL(clicked()), this, SLOT(exitApplication()));
|
QObject::connect(closeButton.get(), SIGNAL(clicked()), this, SLOT(exitApplication()));
|
||||||
QObject::connect(actionButton.get(), SIGNAL(clicked()), this, SLOT(setContentOfKeyView()));
|
QObject::connect(actionButton.get(), SIGNAL(clicked()), this, SLOT(setContentOfKeyView()));
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
void KeyManagementWindow::test()
|
||||||
|
{
|
||||||
|
std::string emp{"d"};
|
||||||
|
Encryption ec{emp};
|
||||||
|
std::map<char, std::string> encrypted{ec.encryptedCharactersStructure()};
|
||||||
|
QString bo{selectionBox.get()->currentText()};
|
||||||
|
std::string k{bo.toStdString()};
|
||||||
|
char f{};
|
||||||
|
|
||||||
|
std::stringstream lazy{};
|
||||||
|
lazy << k;
|
||||||
|
lazy >> f;
|
||||||
|
|
||||||
|
std::string value{encrypted[f]};
|
||||||
|
QString v{QString::fromStdString(value)};
|
||||||
|
}
|
||||||
|
*/
|
||||||
void KeyManagementWindow::generation()
|
void KeyManagementWindow::generation()
|
||||||
{
|
{
|
||||||
GenerateKeys gk{};
|
GenerateKeys gk{};
|
||||||
Key<> theKey{};
|
gk.keyMove();
|
||||||
gk.keyMove(theKey);
|
gk.keyDump();
|
||||||
gk.keyDump(theKey);
|
|
||||||
setContentsOfComboBox();
|
setContentsOfComboBox();
|
||||||
mw.get()->refreshComboBox();
|
|
||||||
pw->setupContentOfComboBox();
|
|
||||||
}
|
}
|
||||||
void KeyManagementWindow::exitApplication() { this->hide(); }
|
void KeyManagementWindow::exitApplication() { this->hide(); }
|
||||||
|
|||||||
@@ -1,24 +1,20 @@
|
|||||||
#ifndef KEYMANAGEMENTWINDOW_H
|
#ifndef KEYMANAGEMENTWINDOW_H
|
||||||
#define KEYMANAGEMENTWINDOW_H
|
#define KEYMANAGEMENTWINDOW_H
|
||||||
|
|
||||||
|
#include<QDialog>
|
||||||
#include<QString>
|
#include<QString>
|
||||||
|
#include<memory>
|
||||||
#include"CommonWindow.h"
|
#include"CommonWindow.h"
|
||||||
#include"Encryption.h"
|
|
||||||
#include"MainWindow.h"
|
|
||||||
#include"PasswordManagementWindow.h"
|
|
||||||
#include"ViewingWindow.h"
|
#include"ViewingWindow.h"
|
||||||
|
|
||||||
class MainWindow;
|
|
||||||
class PasswordManagementWindow;
|
|
||||||
|
|
||||||
class KeyManagementWindow : public QDialog, public CommonWindow, public ViewingWindow
|
class KeyManagementWindow : public QDialog, public CommonWindow, public ViewingWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
KeyManagementWindow(QWidget* parent = 0);
|
KeyManagementWindow(QWidget* parent = 0);
|
||||||
explicit KeyManagementWindow(QWidget* parent = 0, MainWindow* mw = 0, PasswordManagementWindow* pw = 0);
|
|
||||||
~KeyManagementWindow() = default;
|
~KeyManagementWindow() = default;
|
||||||
private slots:
|
private slots:
|
||||||
|
//void test();
|
||||||
void generation();
|
void generation();
|
||||||
void exitApplication();
|
void exitApplication();
|
||||||
void setContentOfKeyView();
|
void setContentOfKeyView();
|
||||||
@@ -27,7 +23,5 @@ private:
|
|||||||
void setupWindow();
|
void setupWindow();
|
||||||
void connections();
|
void connections();
|
||||||
unique_ptr<QString> qSB;
|
unique_ptr<QString> qSB;
|
||||||
unique_ptr<MainWindow> mw;
|
|
||||||
unique_ptr<PasswordManagementWindow> pw;
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+6
-13
@@ -1,6 +1,6 @@
|
|||||||
|
#include<fstream>
|
||||||
#include<iostream>
|
#include<iostream>
|
||||||
#include<ios>
|
#include<ios>
|
||||||
#include"FolderStructure.h"
|
|
||||||
#include"KeyRetrieval.h"
|
#include"KeyRetrieval.h"
|
||||||
|
|
||||||
KeyRetrieval::KeyRetrieval()
|
KeyRetrieval::KeyRetrieval()
|
||||||
@@ -8,23 +8,16 @@ KeyRetrieval::KeyRetrieval()
|
|||||||
retrieveKey();
|
retrieveKey();
|
||||||
addToList();
|
addToList();
|
||||||
}
|
}
|
||||||
KeyRetrieval::KeyRetrieval(const string fileName)
|
KeyRetrieval::KeyRetrieval(const std::string fileName)
|
||||||
{
|
{
|
||||||
this->fileName.assign(fileName);
|
this->fileName.assign(fileName);
|
||||||
retrieveKey();
|
retrieveKey();
|
||||||
addToList();
|
addToList();
|
||||||
}
|
}
|
||||||
KeyRetrieval::KeyRetrieval(const Key<>& ky)
|
|
||||||
{
|
|
||||||
auto path = ky.path();
|
|
||||||
fileName.assign(path);
|
|
||||||
retrieveKey();
|
|
||||||
addToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
void KeyRetrieval::retrieveKey()
|
void KeyRetrieval::retrieveKey()
|
||||||
{
|
{
|
||||||
fstream readKeys{};
|
std::fstream readKeys{};
|
||||||
readKeys.open(fileName.c_str());
|
readKeys.open(fileName.c_str());
|
||||||
char keyChar[keySize];
|
char keyChar[keySize];
|
||||||
while (!readKeys.eof())
|
while (!readKeys.eof())
|
||||||
@@ -53,7 +46,7 @@ void KeyRetrieval::addRange(int from, const int to)
|
|||||||
for (; from<=to; ++from)
|
for (; from<=to; ++from)
|
||||||
codeCharacter.push_back(from);
|
codeCharacter.push_back(from);
|
||||||
}
|
}
|
||||||
void KeyRetrieval::fileNameChoice(const string& fileName) { this->fileName.assign(fileName); }
|
void KeyRetrieval::fileNameChoice(const std::string& fileName) { this->fileName.assign(fileName); }
|
||||||
|
|
||||||
vector<string> KeyRetrieval::keyStructure() { return keys; }
|
std::vector<std::string> KeyRetrieval::keyStructure() { return keys; }
|
||||||
vector<int> KeyRetrieval::codeCharacterStructure() { return codeCharacter; }
|
std::vector<int> KeyRetrieval::codeCharacterStructure() { return codeCharacter; }
|
||||||
|
|||||||
+9
-13
@@ -1,33 +1,29 @@
|
|||||||
#ifndef KEYRETRIEVAL_H
|
#ifndef KEYRETRIEVAL_H
|
||||||
#define KEYRETRIEVAL_H
|
#define KEYRETRIEVAL_H
|
||||||
|
|
||||||
#include<fstream>
|
|
||||||
#include<vector>
|
#include<vector>
|
||||||
|
#include<string>
|
||||||
#include<list>
|
#include<list>
|
||||||
#include"Key.h"
|
|
||||||
|
|
||||||
using std::fstream;
|
|
||||||
|
|
||||||
class KeyRetrieval
|
class KeyRetrieval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
KeyRetrieval();
|
KeyRetrieval();
|
||||||
KeyRetrieval(const string);
|
KeyRetrieval(const std::string);
|
||||||
KeyRetrieval(const Key<>&);
|
|
||||||
~KeyRetrieval() = default;
|
~KeyRetrieval() = default;
|
||||||
|
|
||||||
void retrieveKey();
|
void retrieveKey();
|
||||||
void addToList();
|
void addToList();
|
||||||
void addRange(int, const int);
|
void addRange(int, const int);
|
||||||
void fileNameChoice(const string&);
|
void fileNameChoice(const std::string&);
|
||||||
|
|
||||||
vector<string> keyStructure();
|
std::vector<std::string> keyStructure();
|
||||||
vector<int> codeCharacterStructure();
|
std::vector<int> codeCharacterStructure();
|
||||||
private:
|
private:
|
||||||
string fileName{"default_keys.txt"};
|
std::string fileName{"default_keys.txt"};
|
||||||
vector<string> keys;
|
std::vector<std::string> keys;
|
||||||
vector<char> characters;
|
std::vector<char> characters;
|
||||||
vector<int> codeCharacter;
|
std::vector<int> codeCharacter;
|
||||||
const int keySize{5};
|
const int keySize{5};
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+11
-57
@@ -6,17 +6,11 @@
|
|||||||
#include"KeyRetrieval.h"
|
#include"KeyRetrieval.h"
|
||||||
#include"FileNameRetrieval.h"
|
#include"FileNameRetrieval.h"
|
||||||
#include"FolderStructure.h"
|
#include"FolderStructure.h"
|
||||||
#include"Key.h"
|
|
||||||
#include"Password.h"
|
|
||||||
#include"SaveFile.h" //Do not know if it is included somewhere
|
|
||||||
|
|
||||||
MainWindow::MainWindow()
|
MainWindow::MainWindow()
|
||||||
{
|
{
|
||||||
MainWindow* mw = this;
|
kh = unique_ptr<KeyManagementWindow>{new KeyManagementWindow};
|
||||||
QWidget* w = 0;
|
|
||||||
ph = unique_ptr<PasswordManagementWindow>{new PasswordManagementWindow};
|
ph = unique_ptr<PasswordManagementWindow>{new PasswordManagementWindow};
|
||||||
kh = unique_ptr<KeyManagementWindow>{new KeyManagementWindow{w, mw, ph.get()}};
|
|
||||||
sf = unique_ptr<SaveFile>{new SaveFile{w, mw}};
|
|
||||||
setupMainWindow();
|
setupMainWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +53,7 @@ void MainWindow::setupContentOfComboBox()
|
|||||||
selectionBox.get()->clear();
|
selectionBox.get()->clear();
|
||||||
FileNameRetrieval fnr;
|
FileNameRetrieval fnr;
|
||||||
fnr.retrieveFileNames();
|
fnr.retrieveFileNames();
|
||||||
vector<string> fn{fnr.fileNameContainer()};
|
std::vector<std::string> fn{fnr.fileNameContainer()};
|
||||||
|
|
||||||
for (auto fle: fn)
|
for (auto fle: fn)
|
||||||
{
|
{
|
||||||
@@ -67,7 +61,6 @@ void MainWindow::setupContentOfComboBox()
|
|||||||
selectionBox.get()->addItem(bl);
|
selectionBox.get()->addItem(bl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void MainWindow::refreshComboBox() { setupContentOfComboBox(); }
|
|
||||||
void MainWindow::createMenus()
|
void MainWindow::createMenus()
|
||||||
{
|
{
|
||||||
fileMenu = unique_ptr<QMenu>{menuBar()->addMenu(tr("File"))};
|
fileMenu = unique_ptr<QMenu>{menuBar()->addMenu(tr("File"))};
|
||||||
@@ -93,44 +86,24 @@ void MainWindow::connections()
|
|||||||
QObject::connect(actionButton.get(), SIGNAL(clicked()), this, SLOT(encryptPassword()));
|
QObject::connect(actionButton.get(), SIGNAL(clicked()), this, SLOT(encryptPassword()));
|
||||||
QObject::connect(textForCryption.get(), SIGNAL(textChanged()), this, SLOT(activateButton()));
|
QObject::connect(textForCryption.get(), SIGNAL(textChanged()), this, SLOT(activateButton()));
|
||||||
}
|
}
|
||||||
void MainWindow::switchControlEnabling()
|
|
||||||
{
|
|
||||||
if (controlsEnabled)
|
|
||||||
{
|
|
||||||
switchControls(!controlsEnabled);
|
|
||||||
controlsEnabled = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
switchControls(!controlsEnabled);
|
|
||||||
controlsEnabled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void MainWindow::switchControls(const bool enabled)
|
|
||||||
{
|
|
||||||
textForCryption.get()->setEnabled(enabled);
|
|
||||||
selectionBox.get()->setEnabled(enabled);
|
|
||||||
actionButton.get()->setEnabled(enabled);
|
|
||||||
passwordManage.get()->setEnabled(enabled);
|
|
||||||
}
|
|
||||||
void MainWindow::requestFilename()
|
|
||||||
{
|
|
||||||
std::cout<<"Start"<<std::endl;
|
|
||||||
sf.get()->show();
|
|
||||||
std::cout<<"End"<<std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::encryptPassword()
|
void MainWindow::encryptPassword()
|
||||||
{
|
{
|
||||||
requestFilename();
|
QString passwordToEncrypt{textForCryption.get()->toPlainText()}, keyForEncryption{selectionBox.get()->currentText()};
|
||||||
switchControlEnabling();
|
auto passwordToEncryptString = passwordToEncrypt.toStdString(), keyForEncryptionString = FolderStructure::keyDirectory+keyForEncryption.toStdString();
|
||||||
|
std::cout<<"Will encrypt \""<<passwordToEncryptString<<"\""<<std::endl;
|
||||||
|
std::cout<<"With key \""<<keyForEncryptionString<<"\""<<std::endl;
|
||||||
|
std::cout<<"Encrypting..."<<std::endl;
|
||||||
|
Encryption ec{passwordToEncryptString, keyForEncryptionString};
|
||||||
|
std::cout<<"Encrypted"<<std::endl;
|
||||||
}
|
}
|
||||||
void MainWindow::keyManagementWindow() { kh.get()->show(); }
|
void MainWindow::keyManagementWindow() { kh.get()->show(); }
|
||||||
void MainWindow::passwordManageWindow() { ph.get()->show(); }
|
void MainWindow::passwordManageWindow() { ph.get()->show(); }
|
||||||
void MainWindow::exitApplication() { exit(0); }
|
void MainWindow::exitApplication() { exit(0); }
|
||||||
|
|
||||||
|
|
||||||
string MainWindow::grabCryptionText()
|
std::string MainWindow::grabCryptionText()
|
||||||
{
|
{
|
||||||
auto placeHolder = textForCryption.get()->toPlainText();
|
auto placeHolder = textForCryption.get()->toPlainText();
|
||||||
|
|
||||||
@@ -142,22 +115,3 @@ void MainWindow::activateButton()
|
|||||||
if (content.size()>0 && selectionBox.get()->count()>0) actionButton.get()->setEnabled(true);
|
if (content.size()>0 && selectionBox.get()->count()>0) actionButton.get()->setEnabled(true);
|
||||||
else actionButton.get()->setEnabled(false);
|
else actionButton.get()->setEnabled(false);
|
||||||
}
|
}
|
||||||
void MainWindow::processEncryption()
|
|
||||||
{
|
|
||||||
QString passwordToEncrypt{textForCryption.get()->toPlainText()}, keyForEncryption{selectionBox.get()->currentText()};
|
|
||||||
auto passwordToEncryptString = passwordToEncrypt.toStdString(), keyForEncryptionString = FolderStructure::keyDirectory+keyForEncryption.toStdString();
|
|
||||||
std::cout<<"Generated filename that contains encrypted password: "<<passwordToEncryptString<<std::endl;
|
|
||||||
auto strKeyFilename = keyForEncryption.toStdString();
|
|
||||||
Password<> pass{SaveFile::filenameStr};
|
|
||||||
cout << "Password filename: " << pass.passwordFilename() << endl;
|
|
||||||
Key<> k;
|
|
||||||
pass.setupDecryptedMessage(passwordToEncryptString);
|
|
||||||
k.setupFilename(strKeyFilename);
|
|
||||||
|
|
||||||
Encryption ec2{pass, k};
|
|
||||||
std::cout<<"Encrypted"<<std::endl;
|
|
||||||
ph.get()->updateElementView();
|
|
||||||
ph.get()->populatePass();
|
|
||||||
|
|
||||||
switchControlEnabling();
|
|
||||||
}
|
|
||||||
|
|||||||
+8
-15
@@ -2,22 +2,20 @@
|
|||||||
#define MAINWINDOW_H_
|
#define MAINWINDOW_H_
|
||||||
|
|
||||||
#include<QDialog>
|
#include<QDialog>
|
||||||
|
#include<QPushButton>
|
||||||
#include<QTextEdit>
|
#include<QTextEdit>
|
||||||
#include<QLabel>
|
#include<QLabel>
|
||||||
#include<QMenuBar>
|
#include<QMenuBar>
|
||||||
#include<QMainWindow>
|
#include<QMainWindow>
|
||||||
#include<QMenu>
|
#include<QMenu>
|
||||||
#include<QAction>
|
#include<QAction>
|
||||||
|
#include<QVBoxLayout>
|
||||||
#include<QDockWidget>
|
#include<QDockWidget>
|
||||||
#include<QWidget>
|
#include<QWidget>
|
||||||
#include"CommonWindow.h"
|
#include<memory>
|
||||||
#include"KeyManagementWindow.h"
|
#include"KeyManagementWindow.h"
|
||||||
#include"SaveFile.h"
|
|
||||||
#include"PasswordManagementWindow.h"
|
#include"PasswordManagementWindow.h"
|
||||||
|
#include"CommonWindow.h"
|
||||||
class KeyManagementWindow;
|
|
||||||
class PasswordManagementWindow;
|
|
||||||
class SaveFile;
|
|
||||||
|
|
||||||
|
|
||||||
class MainWindow : public QMainWindow, public CommonWindow
|
class MainWindow : public QMainWindow, public CommonWindow
|
||||||
@@ -26,10 +24,8 @@ class MainWindow : public QMainWindow, public CommonWindow
|
|||||||
public:
|
public:
|
||||||
MainWindow();
|
MainWindow();
|
||||||
~MainWindow() = default;
|
~MainWindow() = default;
|
||||||
|
|
||||||
void refreshComboBox();
|
|
||||||
void processEncryption();
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void encryptPassword();
|
void encryptPassword();
|
||||||
void keyManagementWindow();
|
void keyManagementWindow();
|
||||||
@@ -41,9 +37,6 @@ private:
|
|||||||
void setupContentOfComboBox();
|
void setupContentOfComboBox();
|
||||||
void createMenus();
|
void createMenus();
|
||||||
void connections();
|
void connections();
|
||||||
void switchControlEnabling();
|
|
||||||
void switchControls(const bool);
|
|
||||||
void requestFilename();
|
|
||||||
|
|
||||||
unique_ptr<QVBoxLayout> buttonLayout;
|
unique_ptr<QVBoxLayout> buttonLayout;
|
||||||
|
|
||||||
@@ -52,6 +45,8 @@ private:
|
|||||||
unique_ptr<QDockWidget> buttonDockWidget;
|
unique_ptr<QDockWidget> buttonDockWidget;
|
||||||
unique_ptr<QDockWidget> cryptionArea;
|
unique_ptr<QDockWidget> cryptionArea;
|
||||||
|
|
||||||
|
unique_ptr<QLabel> lblOfEncryptedBox;
|
||||||
|
|
||||||
unique_ptr<QTextEdit> textForCryption;
|
unique_ptr<QTextEdit> textForCryption;
|
||||||
|
|
||||||
unique_ptr<QMenu> fileMenu;
|
unique_ptr<QMenu> fileMenu;
|
||||||
@@ -62,9 +57,7 @@ private:
|
|||||||
|
|
||||||
unique_ptr<KeyManagementWindow> kh;
|
unique_ptr<KeyManagementWindow> kh;
|
||||||
unique_ptr<PasswordManagementWindow> ph;
|
unique_ptr<PasswordManagementWindow> ph;
|
||||||
unique_ptr<SaveFile> sf;
|
|
||||||
|
|
||||||
string grabCryptionText();
|
std::string grabCryptionText();
|
||||||
bool controlsEnabled{true};
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
-95
@@ -1,95 +0,0 @@
|
|||||||
#ifndef PASSWORD_H_
|
|
||||||
#define PASSWORD_H_
|
|
||||||
|
|
||||||
#include<iostream>
|
|
||||||
#include<string>
|
|
||||||
#include"Encryption.h"
|
|
||||||
#include"FileNameRetrieval.h"
|
|
||||||
#include"GeneratePasswordFileName.h"
|
|
||||||
#include"TimeInformation.h"
|
|
||||||
|
|
||||||
template<typename S = string>
|
|
||||||
class Password : public TimeInformation<int>
|
|
||||||
{
|
|
||||||
S filename;
|
|
||||||
const S passwordDirectory{FolderStructure::passwordDirectory};
|
|
||||||
S encryptedMessage;
|
|
||||||
S decryptedMessage;
|
|
||||||
int year, month, day;
|
|
||||||
public:
|
|
||||||
Password();
|
|
||||||
Password(const S&);
|
|
||||||
|
|
||||||
friend class Encryption;
|
|
||||||
|
|
||||||
void setupEncryptedMessage(const S&);
|
|
||||||
void setupDecryptedMessage(const S&);
|
|
||||||
void setupPasswordFilename();
|
|
||||||
void setupPasswordFilename(const S&);
|
|
||||||
void setupDate();
|
|
||||||
S retrieveEncryptedMessage() const;
|
|
||||||
S retrieveDecryptedMessage() const;
|
|
||||||
S passwordFilename() const;
|
|
||||||
S passwordPath() const;
|
|
||||||
bool repetitive();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
template<typename S>
|
|
||||||
Password<S>::Password()
|
|
||||||
{
|
|
||||||
setupPasswordFilename();
|
|
||||||
}
|
|
||||||
template<typename S>
|
|
||||||
Password<S>::Password(const S& filename) : filename(filename) { }
|
|
||||||
|
|
||||||
template<typename S>
|
|
||||||
void Password<S>::setupEncryptedMessage(const S& pass) { encryptedMessage.assign(pass); }
|
|
||||||
template<typename S>
|
|
||||||
void Password<S>::setupDecryptedMessage(const S& pass) { decryptedMessage.assign(pass); }
|
|
||||||
template<typename S>
|
|
||||||
void Password<S>::setupPasswordFilename()
|
|
||||||
{
|
|
||||||
for (auto passwordNameDoesNotExist = true; passwordNameDoesNotExist; passwordNameDoesNotExist = repetitive())
|
|
||||||
{
|
|
||||||
GeneratePasswordFileName gp{};
|
|
||||||
year = gp.retrieveYear();
|
|
||||||
month = gp.retrieveMonth();
|
|
||||||
dayOfMonth = gp.retrieveDayOfMonth();
|
|
||||||
filename.assign(gp.passwordFileNameString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
template<typename S>
|
|
||||||
void Password<S>::setupPasswordFilename(const S& fin)
|
|
||||||
{
|
|
||||||
for (auto passwordNameDoesNotExist = true; passwordNameDoesNotExist; passwordNameDoesNotExist = repetitive())
|
|
||||||
{
|
|
||||||
filename.assign(fin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
template<typename S>
|
|
||||||
S Password<S>::retrieveEncryptedMessage() const { return encryptedMessage; }
|
|
||||||
template<typename S>
|
|
||||||
S Password<S>::retrieveDecryptedMessage() const { return decryptedMessage; }
|
|
||||||
template<typename S>
|
|
||||||
S Password<S>::passwordFilename() const { return filename; }
|
|
||||||
template<typename S>
|
|
||||||
S Password<S>::passwordPath() const { return passwordDirectory + filename; }
|
|
||||||
|
|
||||||
|
|
||||||
template<typename S>
|
|
||||||
bool Password<S>::repetitive()
|
|
||||||
{
|
|
||||||
filename.append(".txt");
|
|
||||||
FileNameRetrieval fnr;
|
|
||||||
fnr.retrievePasswordNames();
|
|
||||||
vector<string> createdPasswordNames{fnr.passwordNameContainer()};
|
|
||||||
auto count = 0;
|
|
||||||
for (auto cPNBegin = createdPasswordNames.begin(); cPNBegin!=createdPasswordNames.end(); ++cPNBegin)
|
|
||||||
{
|
|
||||||
if (filename.compare(*cPNBegin)==0) ++count;
|
|
||||||
if (count>0) return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
######################################################################
|
|
||||||
# Automatically generated by qmake (3.1) Mon Feb 26 20:57:16 2018
|
|
||||||
######################################################################
|
|
||||||
|
|
||||||
TEMPLATE = app
|
|
||||||
TARGET = PasswordEncryption
|
|
||||||
INCLUDEPATH += .
|
|
||||||
QT += core gui
|
|
||||||
QT += widgets
|
|
||||||
|
|
||||||
# The following define makes your compiler warn you if you use any
|
|
||||||
# feature of Qt which has been marked as deprecated (the exact warnings
|
|
||||||
# depend on your compiler). Please consult the documentation of the
|
|
||||||
# deprecated API in order to know how to port your code away from it.
|
|
||||||
DEFINES += QT_DEPRECATED_WARNINGS
|
|
||||||
|
|
||||||
# You can also make your code fail to compile if you use deprecated APIs.
|
|
||||||
# In order to do so, uncomment the following line.
|
|
||||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
|
||||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
|
||||||
|
|
||||||
# Input
|
|
||||||
HEADERS += Characters.h \
|
|
||||||
CommonWindow.h \
|
|
||||||
Conversions.h \
|
|
||||||
Cryption.h \
|
|
||||||
Decryption.h \
|
|
||||||
Demo.h \
|
|
||||||
Encryption.h \
|
|
||||||
FileNameRetrieval.h \
|
|
||||||
FolderStructure.h \
|
|
||||||
GenerateDate.h \
|
|
||||||
GenerateKeys.h \
|
|
||||||
GeneratePasswordFileName.h \
|
|
||||||
Key.h \
|
|
||||||
KeyManagementWindow.h \
|
|
||||||
KeyRetrieval.h \
|
|
||||||
MainWindow.h \
|
|
||||||
Password.h \
|
|
||||||
PasswordManagementWindow.h \
|
|
||||||
SaveFile.h \
|
|
||||||
TimeInformation.h \
|
|
||||||
ViewingWindow.h
|
|
||||||
SOURCES += Cryption.cpp \
|
|
||||||
Decryption.cpp \
|
|
||||||
Encryption.cpp \
|
|
||||||
FileNameRetrieval.cpp \
|
|
||||||
FolderStructure.cpp \
|
|
||||||
GeneratePasswordFileName.cpp \
|
|
||||||
KeyManagementWindow.cpp \
|
|
||||||
KeyRetrieval.cpp \
|
|
||||||
Main.cpp \
|
|
||||||
MainWindow.cpp \
|
|
||||||
PasswordManagementWindow.cpp \
|
|
||||||
SaveFile.cpp
|
|
||||||
@@ -1,19 +1,8 @@
|
|||||||
#include<iostream>
|
|
||||||
#include<string>
|
|
||||||
#include<QString>
|
|
||||||
#include<QTableWidgetItem>
|
|
||||||
#include"Encryption.h"
|
|
||||||
#include"Decryption.h"
|
|
||||||
#include"Demo.h"
|
|
||||||
#include"FileNameRetrieval.h"
|
|
||||||
#include"Key.h"
|
|
||||||
#include"PasswordManagementWindow.h"
|
#include"PasswordManagementWindow.h"
|
||||||
|
|
||||||
PasswordManagementWindow::PasswordManagementWindow(QWidget* parent) : QDialog(parent)
|
PasswordManagementWindow::PasswordManagementWindow(QWidget* parent) : QDialog(parent)
|
||||||
{
|
{
|
||||||
determineAmountOfPasswords();
|
|
||||||
setupWindow();
|
setupWindow();
|
||||||
populatePass();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PasswordManagementWindow::setupWindow()
|
void PasswordManagementWindow::setupWindow()
|
||||||
@@ -22,28 +11,12 @@ void PasswordManagementWindow::setupWindow()
|
|||||||
windowHeight=450;
|
windowHeight=450;
|
||||||
|
|
||||||
elementView=unique_ptr<QTableWidget>{new QTableWidget};
|
elementView=unique_ptr<QTableWidget>{new QTableWidget};
|
||||||
elementView.get()->setRowCount(amountOfPasswords);
|
|
||||||
elementView.get()->setColumnCount(2);
|
|
||||||
tableHeader<<"password"<<"date";
|
|
||||||
elementView.get()->setHorizontalHeaderLabels(tableHeader);
|
|
||||||
|
|
||||||
selectionBox=unique_ptr<QComboBox>{new QComboBox};
|
selectionBox=unique_ptr<QComboBox>{new QComboBox};
|
||||||
actionButton=unique_ptr<QPushButton>{new QPushButton{"i3"}};
|
actionButton=unique_ptr<QPushButton>{new QPushButton{"i3"}};
|
||||||
closeButton=unique_ptr<QPushButton>{new QPushButton{"close"}};
|
closeButton=unique_ptr<QPushButton>{new QPushButton{"close"}};
|
||||||
crypticText=unique_ptr<QLineEdit>{new QLineEdit};
|
crypticText=unique_ptr<QLineEdit>{new QLineEdit};
|
||||||
crypticText.get()->insert(QString{"test"});
|
|
||||||
crypticText.get()->setReadOnly(true);
|
|
||||||
|
|
||||||
setupLayouts();
|
|
||||||
setupContentOfComboBox();
|
|
||||||
|
|
||||||
setFixedWidth(windowWidth);
|
|
||||||
setFixedHeight(windowHeight);
|
|
||||||
|
|
||||||
connections();
|
|
||||||
}
|
|
||||||
void PasswordManagementWindow::setupLayouts()
|
|
||||||
{
|
|
||||||
mainLayout=unique_ptr<QHBoxLayout>{new QHBoxLayout};
|
mainLayout=unique_ptr<QHBoxLayout>{new QHBoxLayout};
|
||||||
subLayoutOne=unique_ptr<QVBoxLayout>{new QVBoxLayout};
|
subLayoutOne=unique_ptr<QVBoxLayout>{new QVBoxLayout};
|
||||||
subLayoutTwo=unique_ptr<QVBoxLayout>{new QVBoxLayout};
|
subLayoutTwo=unique_ptr<QVBoxLayout>{new QVBoxLayout};
|
||||||
@@ -64,108 +37,14 @@ void PasswordManagementWindow::setupLayouts()
|
|||||||
mainLayout.get()->addLayout(subLayoutTwo.get());
|
mainLayout.get()->addLayout(subLayoutTwo.get());
|
||||||
|
|
||||||
setLayout(mainLayout.get());
|
setLayout(mainLayout.get());
|
||||||
}
|
|
||||||
void PasswordManagementWindow::setupContentOfComboBox()
|
|
||||||
{
|
|
||||||
selectionBox.get()->clear();
|
|
||||||
FileNameRetrieval fnr;
|
|
||||||
fnr.retrieveFileNames();
|
|
||||||
std::vector<std::string> fn{fnr.fileNameContainer()};
|
|
||||||
|
|
||||||
for (auto fle: fn)
|
setFixedWidth(windowWidth);
|
||||||
{
|
setFixedHeight(windowHeight);
|
||||||
QString bl{QString::fromStdString(fle)};
|
|
||||||
selectionBox.get()->addItem(bl);
|
connections();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
void PasswordManagementWindow::connections()
|
void PasswordManagementWindow::connections()
|
||||||
{
|
{
|
||||||
QObject::connect(closeButton.get(), SIGNAL(clicked()), this, SLOT(exitApplication()));
|
QObject::connect(closeButton.get(), SIGNAL(clicked()), this, SLOT(exitApplication()));
|
||||||
QObject::connect(actionButton.get(), SIGNAL(clicked()), this, SLOT(testTableView()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PasswordManagementWindow::populatePass()
|
|
||||||
{
|
|
||||||
z = unique_ptr<vector<QTableWidgetItem*>>{new vector<QTableWidgetItem*>{}};
|
|
||||||
Demo<> dm{};
|
|
||||||
|
|
||||||
auto passwordList = dm.retrievePasswordFilenames();
|
|
||||||
auto passwordListAmount = passwordList.size();
|
|
||||||
auto grassStuff = dm.retrieveGrass();
|
|
||||||
|
|
||||||
auto itPasswordList = passwordList.begin();
|
|
||||||
|
|
||||||
for (auto index = 0; index!=passwordListAmount; ++index)
|
|
||||||
{
|
|
||||||
for (auto innerIndex = 0; innerIndex!=2; ++innerIndex)
|
|
||||||
{
|
|
||||||
if (innerIndex==0)
|
|
||||||
{
|
|
||||||
auto name = *itPasswordList++;
|
|
||||||
QTableWidgetItem* it = new QTableWidgetItem{passwordList.at(index).c_str()};
|
|
||||||
it->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
|
||||||
z.get()->push_back(it);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
auto year = grassStuff.at(index)[0];
|
|
||||||
auto month = grassStuff.at(index)[1];
|
|
||||||
auto day = grassStuff.at(index)[2];
|
|
||||||
|
|
||||||
auto g1 = std::to_string(year);
|
|
||||||
g1.append("-" + std::to_string(month));
|
|
||||||
g1.append("-" + std::to_string(day));
|
|
||||||
QTableWidgetItem* it = new QTableWidgetItem{g1.c_str()};
|
|
||||||
it->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
|
||||||
z.get()->push_back(it);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
constexpr auto column = 2;
|
|
||||||
auto y = z.get()->begin();
|
|
||||||
for (auto index = 0; index!=passwordListAmount; ++index)
|
|
||||||
{
|
|
||||||
for (auto innerIndex = 0; innerIndex!=column; ++innerIndex)
|
|
||||||
{
|
|
||||||
elementView.get()->setItem(index, innerIndex, *y++);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void PasswordManagementWindow::exitApplication() { this->hide(); }
|
void PasswordManagementWindow::exitApplication() { this->hide(); }
|
||||||
void PasswordManagementWindow::testTableView()
|
|
||||||
{
|
|
||||||
auto currentRow = elementView.get()->currentRow();
|
|
||||||
crypticText.get()->clear();
|
|
||||||
|
|
||||||
Demo<> dm{};
|
|
||||||
|
|
||||||
auto names = dm.retrievePasswordFilenames();
|
|
||||||
auto selectedFile = names.at(currentRow);
|
|
||||||
auto selectedKey = selectionBox.get()->currentText();
|
|
||||||
auto selectedKeyString = selectedKey.toStdString();
|
|
||||||
|
|
||||||
|
|
||||||
Password<> ps{selectedFile};
|
|
||||||
Key<> ky{selectedKeyString};
|
|
||||||
|
|
||||||
Decryption dc{ps, ky};
|
|
||||||
|
|
||||||
auto decrypted = dc.getDecryptedMessage();
|
|
||||||
QString de = QString{decrypted.c_str()};
|
|
||||||
|
|
||||||
crypticText.get()->setText(de);
|
|
||||||
}
|
|
||||||
void PasswordManagementWindow::determineAmountOfPasswords()
|
|
||||||
{
|
|
||||||
Demo<> dm{};
|
|
||||||
|
|
||||||
auto passwordList = dm.retrievePasswordFilenames();
|
|
||||||
amountOfPasswords = passwordList.size();
|
|
||||||
}
|
|
||||||
void PasswordManagementWindow::updateElementView()
|
|
||||||
{
|
|
||||||
determineAmountOfPasswords();
|
|
||||||
elementView.get()->setRowCount(amountOfPasswords);
|
|
||||||
elementView.get()->setColumnCount(2);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,14 +1,10 @@
|
|||||||
#ifndef PASSWORDMANAGEMENTWINDOW_H_
|
#ifndef PASSWORDMANAGEMENTWINDOW_H_
|
||||||
#define PASSWORDMANAGEMENTWINDOW_H_
|
#define PASSWORDMANAGEMENTWINDOW_H_
|
||||||
|
|
||||||
#include<vector>
|
#include<QDialog>
|
||||||
#include"CommonWindow.h"
|
#include"CommonWindow.h"
|
||||||
#include"ViewingWindow.h"
|
#include"ViewingWindow.h"
|
||||||
|
|
||||||
#include"SaveFile.h"
|
|
||||||
|
|
||||||
using std::vector;
|
|
||||||
|
|
||||||
class PasswordManagementWindow : public QDialog, public CommonWindow, public ViewingWindow
|
class PasswordManagementWindow : public QDialog, public CommonWindow, public ViewingWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -16,20 +12,12 @@ public:
|
|||||||
PasswordManagementWindow(QWidget* parent=0);
|
PasswordManagementWindow(QWidget* parent=0);
|
||||||
~PasswordManagementWindow()=default;
|
~PasswordManagementWindow()=default;
|
||||||
|
|
||||||
void setupContentOfComboBox();
|
|
||||||
void populatePass();
|
|
||||||
void updateElementView();
|
|
||||||
private:
|
private:
|
||||||
void setupWindow();
|
void setupWindow();
|
||||||
void setupLayouts();
|
|
||||||
void connections();
|
void connections();
|
||||||
void determineAmountOfPasswords();
|
|
||||||
|
|
||||||
unique_ptr<QLineEdit> passwordField;
|
unique_ptr<QLineEdit> passwordField;
|
||||||
unique_ptr<vector<QTableWidgetItem*>> z;
|
|
||||||
int amountOfPasswords;
|
|
||||||
private slots:
|
private slots:
|
||||||
void exitApplication();
|
void exitApplication();
|
||||||
void testTableView();
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
#include<QString>
|
|
||||||
#include"SaveFile.h"
|
|
||||||
|
|
||||||
string SaveFile::filenameStr = "default.txt";
|
|
||||||
|
|
||||||
SaveFile::SaveFile(QWidget* parent) : QDialog(parent) { setupWindow(); }
|
|
||||||
SaveFile::SaveFile(QWidget* parent, MainWindow* mw) : QDialog(parent), mw(mw) { setupWindow(); }
|
|
||||||
|
|
||||||
|
|
||||||
void SaveFile::setupWindow()
|
|
||||||
{
|
|
||||||
|
|
||||||
windowWidth=250;
|
|
||||||
windowHeight=250;
|
|
||||||
|
|
||||||
filename = unique_ptr<QLineEdit>{new QLineEdit};
|
|
||||||
saveIt = unique_ptr<QPushButton>{new QPushButton};
|
|
||||||
|
|
||||||
subLayoutOne = unique_ptr<QVBoxLayout>{new QVBoxLayout};
|
|
||||||
subLayoutTwo = unique_ptr<QVBoxLayout>{new QVBoxLayout};
|
|
||||||
|
|
||||||
subLayoutOne.get()->addWidget(filename.get());
|
|
||||||
subLayoutOne.get()->addWidget(saveIt.get());
|
|
||||||
subLayoutTwo.get()->addLayout(subLayoutOne.get());
|
|
||||||
|
|
||||||
setLayout(subLayoutTwo.get());
|
|
||||||
|
|
||||||
setFixedWidth(windowWidth);
|
|
||||||
setFixedHeight(windowHeight);
|
|
||||||
|
|
||||||
connections();
|
|
||||||
}
|
|
||||||
void SaveFile::connections()
|
|
||||||
{
|
|
||||||
QObject::connect(saveIt.get(), SIGNAL(clicked()), this, SLOT(saveFileAs()));
|
|
||||||
}
|
|
||||||
void SaveFile::saveFileAs()
|
|
||||||
{
|
|
||||||
QString fs = filename.get()->text();
|
|
||||||
filenameStr.assign(fs.toUtf8().constData());
|
|
||||||
filenameStr.append(".txt");
|
|
||||||
|
|
||||||
mw.get()->processEncryption();
|
|
||||||
|
|
||||||
this->hide();
|
|
||||||
}
|
|
||||||
-33
@@ -1,33 +0,0 @@
|
|||||||
#ifndef SAVEFILE_H_
|
|
||||||
#define SAVEFILE_H_
|
|
||||||
|
|
||||||
#include<iostream>
|
|
||||||
#include<string>
|
|
||||||
#include"CommonWindow.h"
|
|
||||||
#include"MainWindow.h"
|
|
||||||
#include"ViewingWindow.h"
|
|
||||||
|
|
||||||
class MainWindow;
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
class SaveFile : public QDialog, public CommonWindow, public ViewingWindow
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
SaveFile(QWidget* parent = 0);
|
|
||||||
explicit SaveFile(QWidget* parent = 0, MainWindow* mw = 0);
|
|
||||||
static string filenameStr;
|
|
||||||
private:
|
|
||||||
void setupWindow();
|
|
||||||
void connections();
|
|
||||||
|
|
||||||
unique_ptr<QLineEdit> filename;
|
|
||||||
unique_ptr<QPushButton> saveIt;
|
|
||||||
unique_ptr<MainWindow> mw;
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void saveFileAs();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
#ifndef TIMEINFORMATION_H_
|
|
||||||
#define TIMEINFORMATION_H_
|
|
||||||
|
|
||||||
#include<iostream>
|
|
||||||
#include<string>
|
|
||||||
#include<ctime>
|
|
||||||
#include<cstdlib>
|
|
||||||
|
|
||||||
using std::string;
|
|
||||||
|
|
||||||
template<typename I = int>
|
|
||||||
class TimeInformation
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
I year, month, dayOfMonth;
|
|
||||||
void setupTime();
|
|
||||||
public:
|
|
||||||
TimeInformation();
|
|
||||||
|
|
||||||
I retrieveYear() const;
|
|
||||||
I retrieveMonth() const;
|
|
||||||
I retrieveDayOfMonth() const;
|
|
||||||
|
|
||||||
string dateString() const;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename I>
|
|
||||||
TimeInformation<I>::TimeInformation()
|
|
||||||
{
|
|
||||||
srand(time(0));
|
|
||||||
setupTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename I>
|
|
||||||
void TimeInformation<I>::setupTime()
|
|
||||||
{
|
|
||||||
time_t epochTime = time(0);
|
|
||||||
tm* currentTime = localtime(&epochTime);
|
|
||||||
|
|
||||||
year = 1900 + currentTime->tm_year;
|
|
||||||
month = 1 + currentTime->tm_mon;
|
|
||||||
dayOfMonth = currentTime->tm_mday;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename I>
|
|
||||||
I TimeInformation<I>::retrieveYear() const { return year; }
|
|
||||||
template<typename I>
|
|
||||||
I TimeInformation<I>::retrieveMonth() const { return month; }
|
|
||||||
template<typename I>
|
|
||||||
I TimeInformation<I>::retrieveDayOfMonth() const { return dayOfMonth; }
|
|
||||||
|
|
||||||
|
|
||||||
template<typename I>
|
|
||||||
string TimeInformation<I>::dateString() const
|
|
||||||
{
|
|
||||||
string dateString;
|
|
||||||
if (month<10 && dayOfMonth<10)
|
|
||||||
{
|
|
||||||
dateString.assign(std::to_string(year));
|
|
||||||
dateString.append("0"+std::to_string(month));
|
|
||||||
dateString.append("0"+std::to_string(dayOfMonth));
|
|
||||||
}
|
|
||||||
else if (month<10 && dayOfMonth>=10)
|
|
||||||
{
|
|
||||||
dateString.assign(std::to_string(year));
|
|
||||||
dateString.append("0"+std::to_string(month));
|
|
||||||
dateString.append(std::to_string(dayOfMonth));
|
|
||||||
}
|
|
||||||
else if (month>=10 && dayOfMonth<10)
|
|
||||||
{
|
|
||||||
dateString.assign(std::to_string(year));
|
|
||||||
dateString.append(std::to_string(month));
|
|
||||||
dateString.append("0"+std::to_string(dayOfMonth));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dateString.assign(std::to_string(year));
|
|
||||||
dateString.append(std::to_string(month));
|
|
||||||
dateString.append(std::to_string(dayOfMonth));
|
|
||||||
}
|
|
||||||
|
|
||||||
return dateString;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
nW(53
|
||||||
|
bm-91
|
||||||
|
CD=93
|
||||||
|
Ow{26
|
||||||
|
HI<92
|
||||||
|
SC>75
|
||||||
|
Jm)89
|
||||||
|
rx)12
|
||||||
|
Bl<94
|
||||||
|
FS{50
|
||||||
|
By(06
|
||||||
|
dy/61
|
||||||
|
xp#76
|
||||||
|
Re$37
|
||||||
|
MP-54
|
||||||
|
fW-30
|
||||||
|
Pk}88
|
||||||
|
QH<49
|
||||||
|
kU}89
|
||||||
|
sq#49
|
||||||
|
bu_87
|
||||||
|
JJ-72
|
||||||
|
wM\06
|
||||||
|
tB<49
|
||||||
|
MV(77
|
||||||
|
bl|97
|
||||||
|
ns$65
|
||||||
|
qf^48
|
||||||
|
fA>39
|
||||||
|
Ws%50
|
||||||
|
Bc:85
|
||||||
|
qH.59
|
||||||
|
sA_10
|
||||||
|
pQ[44
|
||||||
|
eH!31
|
||||||
|
vF#21
|
||||||
|
No^74
|
||||||
|
pq,97
|
||||||
|
jx}83
|
||||||
|
zY|64
|
||||||
|
bH-60
|
||||||
|
QC)89
|
||||||
|
dt%43
|
||||||
|
GD%92
|
||||||
|
Fc/59
|
||||||
|
iq&22
|
||||||
|
Yt$54
|
||||||
|
gD!89
|
||||||
|
Ta{02
|
||||||
|
HO(11
|
||||||
|
qK&06
|
||||||
|
sG|86
|
||||||
|
qm)72
|
||||||
|
Ag;29
|
||||||
|
ny}13
|
||||||
|
zl+34
|
||||||
|
wP$19
|
||||||
|
wb~38
|
||||||
|
aD}64
|
||||||
|
Uu=62
|
||||||
|
cD`69
|
||||||
|
eT_82
|
||||||
|
Xh{02
|
||||||
|
HW*32
|
||||||
|
xX&91
|
||||||
|
YX,07
|
||||||
|
dQ>04
|
||||||
|
WA}96
|
||||||
|
Ju)22
|
||||||
|
ci"52
|
||||||
|
bU]83
|
||||||
|
me-09
|
||||||
|
dr]25
|
||||||
|
iA:93
|
||||||
|
oG*02
|
||||||
|
fM&51
|
||||||
|
vI`14
|
||||||
|
uv+22
|
||||||
|
OY@28
|
||||||
|
Ul]88
|
||||||
|
mU#38
|
||||||
|
HZ<80
|
||||||
|
Cf-89
|
||||||
|
gG)79
|
||||||
|
iP.37
|
||||||
|
ZU?52
|
||||||
|
ML%79
|
||||||
|
Yk%10
|
||||||
|
ow\08
|
||||||
|
oO{79
|
||||||
|
PL%83
|
||||||
|
wp>89
|
||||||
|
jn[92
|
||||||
|
HD/99
|
||||||
|
wd|57
|
||||||
|
My*99
|
||||||
+1
-1
@@ -40,4 +40,4 @@ settingdirectory=$rootprojectdirectory/settings
|
|||||||
#echo $settingdirectory
|
#echo $settingdirectory
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
/usr/bin/PasswordEncryption $rootprojectdirectory
|
./encryptedmessaging $rootprojectdirectory
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
make
|
|
||||||
sudo cp -f encryptedstart.sh /usr/bin
|
|
||||||
sudo cp -f PasswordEncryption /usr/bin
|
|
||||||
@@ -1,127 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
** Meta object code from reading C++ file 'KeyManagementWindow.h'
|
|
||||||
**
|
|
||||||
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.10.1)
|
|
||||||
**
|
|
||||||
** WARNING! All changes made in this file will be lost!
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
#include "KeyManagementWindow.h"
|
|
||||||
#include <QtCore/qbytearray.h>
|
|
||||||
#include <QtCore/qmetatype.h>
|
|
||||||
#if !defined(Q_MOC_OUTPUT_REVISION)
|
|
||||||
#error "The header file 'KeyManagementWindow.h' doesn't include <QObject>."
|
|
||||||
#elif Q_MOC_OUTPUT_REVISION != 67
|
|
||||||
#error "This file was generated using the moc from 5.10.1. It"
|
|
||||||
#error "cannot be used with the include files from this version of Qt."
|
|
||||||
#error "(The moc has changed too much.)"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QT_BEGIN_MOC_NAMESPACE
|
|
||||||
QT_WARNING_PUSH
|
|
||||||
QT_WARNING_DISABLE_DEPRECATED
|
|
||||||
struct qt_meta_stringdata_KeyManagementWindow_t {
|
|
||||||
QByteArrayData data[5];
|
|
||||||
char stringdata0[68];
|
|
||||||
};
|
|
||||||
#define QT_MOC_LITERAL(idx, ofs, len) \
|
|
||||||
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
|
|
||||||
qptrdiff(offsetof(qt_meta_stringdata_KeyManagementWindow_t, stringdata0) + ofs \
|
|
||||||
- idx * sizeof(QByteArrayData)) \
|
|
||||||
)
|
|
||||||
static const qt_meta_stringdata_KeyManagementWindow_t qt_meta_stringdata_KeyManagementWindow = {
|
|
||||||
{
|
|
||||||
QT_MOC_LITERAL(0, 0, 19), // "KeyManagementWindow"
|
|
||||||
QT_MOC_LITERAL(1, 20, 10), // "generation"
|
|
||||||
QT_MOC_LITERAL(2, 31, 0), // ""
|
|
||||||
QT_MOC_LITERAL(3, 32, 15), // "exitApplication"
|
|
||||||
QT_MOC_LITERAL(4, 48, 19) // "setContentOfKeyView"
|
|
||||||
|
|
||||||
},
|
|
||||||
"KeyManagementWindow\0generation\0\0"
|
|
||||||
"exitApplication\0setContentOfKeyView"
|
|
||||||
};
|
|
||||||
#undef QT_MOC_LITERAL
|
|
||||||
|
|
||||||
static const uint qt_meta_data_KeyManagementWindow[] = {
|
|
||||||
|
|
||||||
// content:
|
|
||||||
7, // revision
|
|
||||||
0, // classname
|
|
||||||
0, 0, // classinfo
|
|
||||||
3, 14, // methods
|
|
||||||
0, 0, // properties
|
|
||||||
0, 0, // enums/sets
|
|
||||||
0, 0, // constructors
|
|
||||||
0, // flags
|
|
||||||
0, // signalCount
|
|
||||||
|
|
||||||
// slots: name, argc, parameters, tag, flags
|
|
||||||
1, 0, 29, 2, 0x08 /* Private */,
|
|
||||||
3, 0, 30, 2, 0x08 /* Private */,
|
|
||||||
4, 0, 31, 2, 0x08 /* Private */,
|
|
||||||
|
|
||||||
// slots: parameters
|
|
||||||
QMetaType::Void,
|
|
||||||
QMetaType::Void,
|
|
||||||
QMetaType::Void,
|
|
||||||
|
|
||||||
0 // eod
|
|
||||||
};
|
|
||||||
|
|
||||||
void KeyManagementWindow::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
|
|
||||||
{
|
|
||||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
|
||||||
KeyManagementWindow *_t = static_cast<KeyManagementWindow *>(_o);
|
|
||||||
Q_UNUSED(_t)
|
|
||||||
switch (_id) {
|
|
||||||
case 0: _t->generation(); break;
|
|
||||||
case 1: _t->exitApplication(); break;
|
|
||||||
case 2: _t->setContentOfKeyView(); break;
|
|
||||||
default: ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Q_UNUSED(_a);
|
|
||||||
}
|
|
||||||
|
|
||||||
QT_INIT_METAOBJECT const QMetaObject KeyManagementWindow::staticMetaObject = {
|
|
||||||
{ &QDialog::staticMetaObject, qt_meta_stringdata_KeyManagementWindow.data,
|
|
||||||
qt_meta_data_KeyManagementWindow, qt_static_metacall, nullptr, nullptr}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const QMetaObject *KeyManagementWindow::metaObject() const
|
|
||||||
{
|
|
||||||
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *KeyManagementWindow::qt_metacast(const char *_clname)
|
|
||||||
{
|
|
||||||
if (!_clname) return nullptr;
|
|
||||||
if (!strcmp(_clname, qt_meta_stringdata_KeyManagementWindow.stringdata0))
|
|
||||||
return static_cast<void*>(this);
|
|
||||||
if (!strcmp(_clname, "CommonWindow"))
|
|
||||||
return static_cast< CommonWindow*>(this);
|
|
||||||
if (!strcmp(_clname, "ViewingWindow"))
|
|
||||||
return static_cast< ViewingWindow*>(this);
|
|
||||||
return QDialog::qt_metacast(_clname);
|
|
||||||
}
|
|
||||||
|
|
||||||
int KeyManagementWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
|
||||||
{
|
|
||||||
_id = QDialog::qt_metacall(_c, _id, _a);
|
|
||||||
if (_id < 0)
|
|
||||||
return _id;
|
|
||||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
|
||||||
if (_id < 3)
|
|
||||||
qt_static_metacall(this, _c, _id, _a);
|
|
||||||
_id -= 3;
|
|
||||||
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
|
|
||||||
if (_id < 3)
|
|
||||||
*reinterpret_cast<int*>(_a[0]) = -1;
|
|
||||||
_id -= 3;
|
|
||||||
}
|
|
||||||
return _id;
|
|
||||||
}
|
|
||||||
QT_WARNING_POP
|
|
||||||
QT_END_MOC_NAMESPACE
|
|
||||||
@@ -1,134 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
** Meta object code from reading C++ file 'MainWindow.h'
|
|
||||||
**
|
|
||||||
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.10.1)
|
|
||||||
**
|
|
||||||
** WARNING! All changes made in this file will be lost!
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
#include "MainWindow.h"
|
|
||||||
#include <QtCore/qbytearray.h>
|
|
||||||
#include <QtCore/qmetatype.h>
|
|
||||||
#if !defined(Q_MOC_OUTPUT_REVISION)
|
|
||||||
#error "The header file 'MainWindow.h' doesn't include <QObject>."
|
|
||||||
#elif Q_MOC_OUTPUT_REVISION != 67
|
|
||||||
#error "This file was generated using the moc from 5.10.1. It"
|
|
||||||
#error "cannot be used with the include files from this version of Qt."
|
|
||||||
#error "(The moc has changed too much.)"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QT_BEGIN_MOC_NAMESPACE
|
|
||||||
QT_WARNING_PUSH
|
|
||||||
QT_WARNING_DISABLE_DEPRECATED
|
|
||||||
struct qt_meta_stringdata_MainWindow_t {
|
|
||||||
QByteArrayData data[7];
|
|
||||||
char stringdata0[100];
|
|
||||||
};
|
|
||||||
#define QT_MOC_LITERAL(idx, ofs, len) \
|
|
||||||
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
|
|
||||||
qptrdiff(offsetof(qt_meta_stringdata_MainWindow_t, stringdata0) + ofs \
|
|
||||||
- idx * sizeof(QByteArrayData)) \
|
|
||||||
)
|
|
||||||
static const qt_meta_stringdata_MainWindow_t qt_meta_stringdata_MainWindow = {
|
|
||||||
{
|
|
||||||
QT_MOC_LITERAL(0, 0, 10), // "MainWindow"
|
|
||||||
QT_MOC_LITERAL(1, 11, 15), // "encryptPassword"
|
|
||||||
QT_MOC_LITERAL(2, 27, 0), // ""
|
|
||||||
QT_MOC_LITERAL(3, 28, 19), // "keyManagementWindow"
|
|
||||||
QT_MOC_LITERAL(4, 48, 20), // "passwordManageWindow"
|
|
||||||
QT_MOC_LITERAL(5, 69, 15), // "exitApplication"
|
|
||||||
QT_MOC_LITERAL(6, 85, 14) // "activateButton"
|
|
||||||
|
|
||||||
},
|
|
||||||
"MainWindow\0encryptPassword\0\0"
|
|
||||||
"keyManagementWindow\0passwordManageWindow\0"
|
|
||||||
"exitApplication\0activateButton"
|
|
||||||
};
|
|
||||||
#undef QT_MOC_LITERAL
|
|
||||||
|
|
||||||
static const uint qt_meta_data_MainWindow[] = {
|
|
||||||
|
|
||||||
// content:
|
|
||||||
7, // revision
|
|
||||||
0, // classname
|
|
||||||
0, 0, // classinfo
|
|
||||||
5, 14, // methods
|
|
||||||
0, 0, // properties
|
|
||||||
0, 0, // enums/sets
|
|
||||||
0, 0, // constructors
|
|
||||||
0, // flags
|
|
||||||
0, // signalCount
|
|
||||||
|
|
||||||
// slots: name, argc, parameters, tag, flags
|
|
||||||
1, 0, 39, 2, 0x08 /* Private */,
|
|
||||||
3, 0, 40, 2, 0x08 /* Private */,
|
|
||||||
4, 0, 41, 2, 0x08 /* Private */,
|
|
||||||
5, 0, 42, 2, 0x08 /* Private */,
|
|
||||||
6, 0, 43, 2, 0x08 /* Private */,
|
|
||||||
|
|
||||||
// slots: parameters
|
|
||||||
QMetaType::Void,
|
|
||||||
QMetaType::Void,
|
|
||||||
QMetaType::Void,
|
|
||||||
QMetaType::Void,
|
|
||||||
QMetaType::Void,
|
|
||||||
|
|
||||||
0 // eod
|
|
||||||
};
|
|
||||||
|
|
||||||
void MainWindow::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
|
|
||||||
{
|
|
||||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
|
||||||
MainWindow *_t = static_cast<MainWindow *>(_o);
|
|
||||||
Q_UNUSED(_t)
|
|
||||||
switch (_id) {
|
|
||||||
case 0: _t->encryptPassword(); break;
|
|
||||||
case 1: _t->keyManagementWindow(); break;
|
|
||||||
case 2: _t->passwordManageWindow(); break;
|
|
||||||
case 3: _t->exitApplication(); break;
|
|
||||||
case 4: _t->activateButton(); break;
|
|
||||||
default: ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Q_UNUSED(_a);
|
|
||||||
}
|
|
||||||
|
|
||||||
QT_INIT_METAOBJECT const QMetaObject MainWindow::staticMetaObject = {
|
|
||||||
{ &QMainWindow::staticMetaObject, qt_meta_stringdata_MainWindow.data,
|
|
||||||
qt_meta_data_MainWindow, qt_static_metacall, nullptr, nullptr}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const QMetaObject *MainWindow::metaObject() const
|
|
||||||
{
|
|
||||||
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *MainWindow::qt_metacast(const char *_clname)
|
|
||||||
{
|
|
||||||
if (!_clname) return nullptr;
|
|
||||||
if (!strcmp(_clname, qt_meta_stringdata_MainWindow.stringdata0))
|
|
||||||
return static_cast<void*>(this);
|
|
||||||
if (!strcmp(_clname, "CommonWindow"))
|
|
||||||
return static_cast< CommonWindow*>(this);
|
|
||||||
return QMainWindow::qt_metacast(_clname);
|
|
||||||
}
|
|
||||||
|
|
||||||
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
|
||||||
{
|
|
||||||
_id = QMainWindow::qt_metacall(_c, _id, _a);
|
|
||||||
if (_id < 0)
|
|
||||||
return _id;
|
|
||||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
|
||||||
if (_id < 5)
|
|
||||||
qt_static_metacall(this, _c, _id, _a);
|
|
||||||
_id -= 5;
|
|
||||||
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
|
|
||||||
if (_id < 5)
|
|
||||||
*reinterpret_cast<int*>(_a[0]) = -1;
|
|
||||||
_id -= 5;
|
|
||||||
}
|
|
||||||
return _id;
|
|
||||||
}
|
|
||||||
QT_WARNING_POP
|
|
||||||
QT_END_MOC_NAMESPACE
|
|
||||||
@@ -1,123 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
** Meta object code from reading C++ file 'PasswordManagementWindow.h'
|
|
||||||
**
|
|
||||||
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.10.1)
|
|
||||||
**
|
|
||||||
** WARNING! All changes made in this file will be lost!
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
#include "PasswordManagementWindow.h"
|
|
||||||
#include <QtCore/qbytearray.h>
|
|
||||||
#include <QtCore/qmetatype.h>
|
|
||||||
#if !defined(Q_MOC_OUTPUT_REVISION)
|
|
||||||
#error "The header file 'PasswordManagementWindow.h' doesn't include <QObject>."
|
|
||||||
#elif Q_MOC_OUTPUT_REVISION != 67
|
|
||||||
#error "This file was generated using the moc from 5.10.1. It"
|
|
||||||
#error "cannot be used with the include files from this version of Qt."
|
|
||||||
#error "(The moc has changed too much.)"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QT_BEGIN_MOC_NAMESPACE
|
|
||||||
QT_WARNING_PUSH
|
|
||||||
QT_WARNING_DISABLE_DEPRECATED
|
|
||||||
struct qt_meta_stringdata_PasswordManagementWindow_t {
|
|
||||||
QByteArrayData data[4];
|
|
||||||
char stringdata0[56];
|
|
||||||
};
|
|
||||||
#define QT_MOC_LITERAL(idx, ofs, len) \
|
|
||||||
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
|
|
||||||
qptrdiff(offsetof(qt_meta_stringdata_PasswordManagementWindow_t, stringdata0) + ofs \
|
|
||||||
- idx * sizeof(QByteArrayData)) \
|
|
||||||
)
|
|
||||||
static const qt_meta_stringdata_PasswordManagementWindow_t qt_meta_stringdata_PasswordManagementWindow = {
|
|
||||||
{
|
|
||||||
QT_MOC_LITERAL(0, 0, 24), // "PasswordManagementWindow"
|
|
||||||
QT_MOC_LITERAL(1, 25, 15), // "exitApplication"
|
|
||||||
QT_MOC_LITERAL(2, 41, 0), // ""
|
|
||||||
QT_MOC_LITERAL(3, 42, 13) // "testTableView"
|
|
||||||
|
|
||||||
},
|
|
||||||
"PasswordManagementWindow\0exitApplication\0"
|
|
||||||
"\0testTableView"
|
|
||||||
};
|
|
||||||
#undef QT_MOC_LITERAL
|
|
||||||
|
|
||||||
static const uint qt_meta_data_PasswordManagementWindow[] = {
|
|
||||||
|
|
||||||
// content:
|
|
||||||
7, // revision
|
|
||||||
0, // classname
|
|
||||||
0, 0, // classinfo
|
|
||||||
2, 14, // methods
|
|
||||||
0, 0, // properties
|
|
||||||
0, 0, // enums/sets
|
|
||||||
0, 0, // constructors
|
|
||||||
0, // flags
|
|
||||||
0, // signalCount
|
|
||||||
|
|
||||||
// slots: name, argc, parameters, tag, flags
|
|
||||||
1, 0, 24, 2, 0x08 /* Private */,
|
|
||||||
3, 0, 25, 2, 0x08 /* Private */,
|
|
||||||
|
|
||||||
// slots: parameters
|
|
||||||
QMetaType::Void,
|
|
||||||
QMetaType::Void,
|
|
||||||
|
|
||||||
0 // eod
|
|
||||||
};
|
|
||||||
|
|
||||||
void PasswordManagementWindow::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
|
|
||||||
{
|
|
||||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
|
||||||
PasswordManagementWindow *_t = static_cast<PasswordManagementWindow *>(_o);
|
|
||||||
Q_UNUSED(_t)
|
|
||||||
switch (_id) {
|
|
||||||
case 0: _t->exitApplication(); break;
|
|
||||||
case 1: _t->testTableView(); break;
|
|
||||||
default: ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Q_UNUSED(_a);
|
|
||||||
}
|
|
||||||
|
|
||||||
QT_INIT_METAOBJECT const QMetaObject PasswordManagementWindow::staticMetaObject = {
|
|
||||||
{ &QDialog::staticMetaObject, qt_meta_stringdata_PasswordManagementWindow.data,
|
|
||||||
qt_meta_data_PasswordManagementWindow, qt_static_metacall, nullptr, nullptr}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const QMetaObject *PasswordManagementWindow::metaObject() const
|
|
||||||
{
|
|
||||||
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *PasswordManagementWindow::qt_metacast(const char *_clname)
|
|
||||||
{
|
|
||||||
if (!_clname) return nullptr;
|
|
||||||
if (!strcmp(_clname, qt_meta_stringdata_PasswordManagementWindow.stringdata0))
|
|
||||||
return static_cast<void*>(this);
|
|
||||||
if (!strcmp(_clname, "CommonWindow"))
|
|
||||||
return static_cast< CommonWindow*>(this);
|
|
||||||
if (!strcmp(_clname, "ViewingWindow"))
|
|
||||||
return static_cast< ViewingWindow*>(this);
|
|
||||||
return QDialog::qt_metacast(_clname);
|
|
||||||
}
|
|
||||||
|
|
||||||
int PasswordManagementWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
|
||||||
{
|
|
||||||
_id = QDialog::qt_metacall(_c, _id, _a);
|
|
||||||
if (_id < 0)
|
|
||||||
return _id;
|
|
||||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
|
||||||
if (_id < 2)
|
|
||||||
qt_static_metacall(this, _c, _id, _a);
|
|
||||||
_id -= 2;
|
|
||||||
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
|
|
||||||
if (_id < 2)
|
|
||||||
*reinterpret_cast<int*>(_a[0]) = -1;
|
|
||||||
_id -= 2;
|
|
||||||
}
|
|
||||||
return _id;
|
|
||||||
}
|
|
||||||
QT_WARNING_POP
|
|
||||||
QT_END_MOC_NAMESPACE
|
|
||||||
-389
@@ -1,389 +0,0 @@
|
|||||||
#define __SSP_STRONG__ 3
|
|
||||||
#define __DBL_MIN_EXP__ (-1021)
|
|
||||||
#define __FLT32X_MAX_EXP__ 1024
|
|
||||||
#define __cpp_attributes 200809
|
|
||||||
#define __UINT_LEAST16_MAX__ 0xffff
|
|
||||||
#define __ATOMIC_ACQUIRE 2
|
|
||||||
#define __FLT128_MAX_10_EXP__ 4932
|
|
||||||
#define __FLT_MIN__ 1.17549435082228750796873653722224568e-38F
|
|
||||||
#define __GCC_IEC_559_COMPLEX 2
|
|
||||||
#define __cpp_aggregate_nsdmi 201304
|
|
||||||
#define __UINT_LEAST8_TYPE__ unsigned char
|
|
||||||
#define __SIZEOF_FLOAT80__ 16
|
|
||||||
#define __INTMAX_C(c) c ## L
|
|
||||||
#define __CHAR_BIT__ 8
|
|
||||||
#define __UINT8_MAX__ 0xff
|
|
||||||
#define __WINT_MAX__ 0xffffffffU
|
|
||||||
#define __FLT32_MIN_EXP__ (-125)
|
|
||||||
#define __cpp_static_assert 200410
|
|
||||||
#define __ORDER_LITTLE_ENDIAN__ 1234
|
|
||||||
#define __SIZE_MAX__ 0xffffffffffffffffUL
|
|
||||||
#define __WCHAR_MAX__ 0x7fffffff
|
|
||||||
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
|
|
||||||
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
|
|
||||||
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
|
|
||||||
#define __DBL_DENORM_MIN__ double(4.94065645841246544176568792868221372e-324L)
|
|
||||||
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
|
|
||||||
#define __GCC_ATOMIC_CHAR_LOCK_FREE 2
|
|
||||||
#define __GCC_IEC_559 2
|
|
||||||
#define __FLT32X_DECIMAL_DIG__ 17
|
|
||||||
#define __FLT_EVAL_METHOD__ 0
|
|
||||||
#define __unix__ 1
|
|
||||||
#define __cpp_binary_literals 201304
|
|
||||||
#define __FLT64_DECIMAL_DIG__ 17
|
|
||||||
#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2
|
|
||||||
#define __x86_64 1
|
|
||||||
#define __cpp_variadic_templates 200704
|
|
||||||
#define __UINT_FAST64_MAX__ 0xffffffffffffffffUL
|
|
||||||
#define __SIG_ATOMIC_TYPE__ int
|
|
||||||
#define __DBL_MIN_10_EXP__ (-307)
|
|
||||||
#define __FINITE_MATH_ONLY__ 0
|
|
||||||
#define __cpp_variable_templates 201304
|
|
||||||
#define __GNUC_PATCHLEVEL__ 0
|
|
||||||
#define __FLT32_HAS_DENORM__ 1
|
|
||||||
#define __UINT_FAST8_MAX__ 0xff
|
|
||||||
#define __has_include(STR) __has_include__(STR)
|
|
||||||
#define __DEC64_MAX_EXP__ 385
|
|
||||||
#define __INT8_C(c) c
|
|
||||||
#define __INT_LEAST8_WIDTH__ 8
|
|
||||||
#define __UINT_LEAST64_MAX__ 0xffffffffffffffffUL
|
|
||||||
#define __SHRT_MAX__ 0x7fff
|
|
||||||
#define __LDBL_MAX__ 1.18973149535723176502126385303097021e+4932L
|
|
||||||
#define __FLT64X_MAX_10_EXP__ 4932
|
|
||||||
#define __UINT_LEAST8_MAX__ 0xff
|
|
||||||
#define __GCC_ATOMIC_BOOL_LOCK_FREE 2
|
|
||||||
#define __FLT128_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966F128
|
|
||||||
#define __UINTMAX_TYPE__ long unsigned int
|
|
||||||
#define __linux 1
|
|
||||||
#define __DEC32_EPSILON__ 1E-6DF
|
|
||||||
#define __FLT_EVAL_METHOD_TS_18661_3__ 0
|
|
||||||
#define __OPTIMIZE__ 1
|
|
||||||
#define __unix 1
|
|
||||||
#define __UINT32_MAX__ 0xffffffffU
|
|
||||||
#define __GXX_EXPERIMENTAL_CXX0X__ 1
|
|
||||||
#define __LDBL_MAX_EXP__ 16384
|
|
||||||
#define __FLT128_MIN_EXP__ (-16381)
|
|
||||||
#define __WINT_MIN__ 0U
|
|
||||||
#define __linux__ 1
|
|
||||||
#define __FLT128_MIN_10_EXP__ (-4931)
|
|
||||||
#define __INT_LEAST16_WIDTH__ 16
|
|
||||||
#define __SCHAR_MAX__ 0x7f
|
|
||||||
#define __FLT128_MANT_DIG__ 113
|
|
||||||
#define __WCHAR_MIN__ (-__WCHAR_MAX__ - 1)
|
|
||||||
#define __INT64_C(c) c ## L
|
|
||||||
#define __DBL_DIG__ 15
|
|
||||||
#define __GCC_ATOMIC_POINTER_LOCK_FREE 2
|
|
||||||
#define __FLT64X_MANT_DIG__ 64
|
|
||||||
#define __SIZEOF_INT__ 4
|
|
||||||
#define __SIZEOF_POINTER__ 8
|
|
||||||
#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2
|
|
||||||
#define __USER_LABEL_PREFIX__
|
|
||||||
#define __FLT64X_EPSILON__ 1.08420217248550443400745280086994171e-19F64x
|
|
||||||
#define __STDC_HOSTED__ 1
|
|
||||||
#define __LDBL_HAS_INFINITY__ 1
|
|
||||||
#define __FLT32_DIG__ 6
|
|
||||||
#define __FLT_EPSILON__ 1.19209289550781250000000000000000000e-7F
|
|
||||||
#define __GXX_WEAK__ 1
|
|
||||||
#define __SHRT_WIDTH__ 16
|
|
||||||
#define __LDBL_MIN__ 3.36210314311209350626267781732175260e-4932L
|
|
||||||
#define __DEC32_MAX__ 9.999999E96DF
|
|
||||||
#define __cpp_threadsafe_static_init 200806
|
|
||||||
#define __FLT64X_DENORM_MIN__ 3.64519953188247460252840593361941982e-4951F64x
|
|
||||||
#define __FLT32X_HAS_INFINITY__ 1
|
|
||||||
#define __INT32_MAX__ 0x7fffffff
|
|
||||||
#define __INT_WIDTH__ 32
|
|
||||||
#define __SIZEOF_LONG__ 8
|
|
||||||
#define __STDC_IEC_559__ 1
|
|
||||||
#define __STDC_ISO_10646__ 201706L
|
|
||||||
#define __UINT16_C(c) c
|
|
||||||
#define __PTRDIFF_WIDTH__ 64
|
|
||||||
#define __DECIMAL_DIG__ 21
|
|
||||||
#define __FLT64_EPSILON__ 2.22044604925031308084726333618164062e-16F64
|
|
||||||
#define __gnu_linux__ 1
|
|
||||||
#define __INTMAX_WIDTH__ 64
|
|
||||||
#define __FLT64_MIN_EXP__ (-1021)
|
|
||||||
#define __has_include_next(STR) __has_include_next__(STR)
|
|
||||||
#define __FLT64X_MIN_10_EXP__ (-4931)
|
|
||||||
#define __LDBL_HAS_QUIET_NAN__ 1
|
|
||||||
#define __FLT64_MANT_DIG__ 53
|
|
||||||
#define __GNUC__ 7
|
|
||||||
#define __GXX_RTTI 1
|
|
||||||
#define __pie__ 2
|
|
||||||
#define __MMX__ 1
|
|
||||||
#define __cpp_delegating_constructors 200604
|
|
||||||
#define __FLT_HAS_DENORM__ 1
|
|
||||||
#define __SIZEOF_LONG_DOUBLE__ 16
|
|
||||||
#define __BIGGEST_ALIGNMENT__ 16
|
|
||||||
#define __STDC_UTF_16__ 1
|
|
||||||
#define __FLT64_MAX_10_EXP__ 308
|
|
||||||
#define __FLT32_HAS_INFINITY__ 1
|
|
||||||
#define __DBL_MAX__ double(1.79769313486231570814527423731704357e+308L)
|
|
||||||
#define __cpp_raw_strings 200710
|
|
||||||
#define __INT_FAST32_MAX__ 0x7fffffffffffffffL
|
|
||||||
#define __DBL_HAS_INFINITY__ 1
|
|
||||||
#define __INT64_MAX__ 0x7fffffffffffffffL
|
|
||||||
#define __DEC32_MIN_EXP__ (-94)
|
|
||||||
#define __INTPTR_WIDTH__ 64
|
|
||||||
#define __FLT32X_HAS_DENORM__ 1
|
|
||||||
#define __INT_FAST16_TYPE__ long int
|
|
||||||
#define __LDBL_HAS_DENORM__ 1
|
|
||||||
#define __cplusplus 201402L
|
|
||||||
#define __cpp_ref_qualifiers 200710
|
|
||||||
#define __DEC128_MAX__ 9.999999999999999999999999999999999E6144DL
|
|
||||||
#define __INT_LEAST32_MAX__ 0x7fffffff
|
|
||||||
#define __DEC32_MIN__ 1E-95DF
|
|
||||||
#define __DEPRECATED 1
|
|
||||||
#define __cpp_rvalue_references 200610
|
|
||||||
#define __DBL_MAX_EXP__ 1024
|
|
||||||
#define __WCHAR_WIDTH__ 32
|
|
||||||
#define __FLT32_MAX__ 3.40282346638528859811704183484516925e+38F32
|
|
||||||
#define __DEC128_EPSILON__ 1E-33DL
|
|
||||||
#define __SSE2_MATH__ 1
|
|
||||||
#define __ATOMIC_HLE_RELEASE 131072
|
|
||||||
#define __PTRDIFF_MAX__ 0x7fffffffffffffffL
|
|
||||||
#define __amd64 1
|
|
||||||
#define __STDC_NO_THREADS__ 1
|
|
||||||
#define __ATOMIC_HLE_ACQUIRE 65536
|
|
||||||
#define __FLT32_HAS_QUIET_NAN__ 1
|
|
||||||
#define __GNUG__ 7
|
|
||||||
#define __LONG_LONG_MAX__ 0x7fffffffffffffffLL
|
|
||||||
#define __SIZEOF_SIZE_T__ 8
|
|
||||||
#define __cpp_rvalue_reference 200610
|
|
||||||
#define __cpp_nsdmi 200809
|
|
||||||
#define __FLT64X_MIN_EXP__ (-16381)
|
|
||||||
#define __SIZEOF_WINT_T__ 4
|
|
||||||
#define __LONG_LONG_WIDTH__ 64
|
|
||||||
#define __cpp_initializer_lists 200806
|
|
||||||
#define __FLT32_MAX_EXP__ 128
|
|
||||||
#define __cpp_hex_float 201603
|
|
||||||
#define __GCC_HAVE_DWARF2_CFI_ASM 1
|
|
||||||
#define __GXX_ABI_VERSION 1011
|
|
||||||
#define __FLT128_HAS_INFINITY__ 1
|
|
||||||
#define __FLT_MIN_EXP__ (-125)
|
|
||||||
#define __cpp_lambdas 200907
|
|
||||||
#define __FLT64X_HAS_QUIET_NAN__ 1
|
|
||||||
#define __INT_FAST64_TYPE__ long int
|
|
||||||
#define __FLT64_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F64
|
|
||||||
#define __DBL_MIN__ double(2.22507385850720138309023271733240406e-308L)
|
|
||||||
#define __PIE__ 2
|
|
||||||
#define __LP64__ 1
|
|
||||||
#define __FLT32X_EPSILON__ 2.22044604925031308084726333618164062e-16F32x
|
|
||||||
#define __DECIMAL_BID_FORMAT__ 1
|
|
||||||
#define __FLT64_MIN_10_EXP__ (-307)
|
|
||||||
#define __FLT64X_DECIMAL_DIG__ 21
|
|
||||||
#define __DEC128_MIN__ 1E-6143DL
|
|
||||||
#define __REGISTER_PREFIX__
|
|
||||||
#define __UINT16_MAX__ 0xffff
|
|
||||||
#define __DBL_HAS_DENORM__ 1
|
|
||||||
#define __FLT32_MIN__ 1.17549435082228750796873653722224568e-38F32
|
|
||||||
#define __UINT8_TYPE__ unsigned char
|
|
||||||
#define __FLT_MANT_DIG__ 24
|
|
||||||
#define __LDBL_DECIMAL_DIG__ 21
|
|
||||||
#define __VERSION__ "7.3.0"
|
|
||||||
#define __UINT64_C(c) c ## UL
|
|
||||||
#define __cpp_unicode_characters 200704
|
|
||||||
#define _STDC_PREDEF_H 1
|
|
||||||
#define __cpp_decltype_auto 201304
|
|
||||||
#define __GCC_ATOMIC_INT_LOCK_FREE 2
|
|
||||||
#define __FLT128_MAX_EXP__ 16384
|
|
||||||
#define __FLT32_MANT_DIG__ 24
|
|
||||||
#define __FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__
|
|
||||||
#define __STDC_IEC_559_COMPLEX__ 1
|
|
||||||
#define __FLT128_HAS_DENORM__ 1
|
|
||||||
#define __FLT128_DIG__ 33
|
|
||||||
#define __SCHAR_WIDTH__ 8
|
|
||||||
#define __INT32_C(c) c
|
|
||||||
#define __DEC64_EPSILON__ 1E-15DD
|
|
||||||
#define __ORDER_PDP_ENDIAN__ 3412
|
|
||||||
#define __DEC128_MIN_EXP__ (-6142)
|
|
||||||
#define __FLT32_MAX_10_EXP__ 38
|
|
||||||
#define __INT_FAST32_TYPE__ long int
|
|
||||||
#define __UINT_LEAST16_TYPE__ short unsigned int
|
|
||||||
#define __FLT64X_HAS_INFINITY__ 1
|
|
||||||
#define unix 1
|
|
||||||
#define __INT16_MAX__ 0x7fff
|
|
||||||
#define __cpp_rtti 199711
|
|
||||||
#define __SIZE_TYPE__ long unsigned int
|
|
||||||
#define __UINT64_MAX__ 0xffffffffffffffffUL
|
|
||||||
#define __FLT64X_DIG__ 18
|
|
||||||
#define __INT8_TYPE__ signed char
|
|
||||||
#define __cpp_digit_separators 201309
|
|
||||||
#define __ELF__ 1
|
|
||||||
#define __GCC_ASM_FLAG_OUTPUTS__ 1
|
|
||||||
#define __FLT_RADIX__ 2
|
|
||||||
#define __INT_LEAST16_TYPE__ short int
|
|
||||||
#define __LDBL_EPSILON__ 1.08420217248550443400745280086994171e-19L
|
|
||||||
#define __UINTMAX_C(c) c ## UL
|
|
||||||
#define __GLIBCXX_BITSIZE_INT_N_0 128
|
|
||||||
#define __k8 1
|
|
||||||
#define __SIG_ATOMIC_MAX__ 0x7fffffff
|
|
||||||
#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2
|
|
||||||
#define __cpp_sized_deallocation 201309
|
|
||||||
#define __SIZEOF_PTRDIFF_T__ 8
|
|
||||||
#define __FLT32X_MANT_DIG__ 53
|
|
||||||
#define __x86_64__ 1
|
|
||||||
#define __FLT32X_MIN_EXP__ (-1021)
|
|
||||||
#define __DEC32_SUBNORMAL_MIN__ 0.000001E-95DF
|
|
||||||
#define __INT_FAST16_MAX__ 0x7fffffffffffffffL
|
|
||||||
#define __FLT64_DIG__ 15
|
|
||||||
#define __UINT_FAST32_MAX__ 0xffffffffffffffffUL
|
|
||||||
#define __UINT_LEAST64_TYPE__ long unsigned int
|
|
||||||
#define __FLT_HAS_QUIET_NAN__ 1
|
|
||||||
#define __FLT_MAX_10_EXP__ 38
|
|
||||||
#define __LONG_MAX__ 0x7fffffffffffffffL
|
|
||||||
#define __FLT64X_HAS_DENORM__ 1
|
|
||||||
#define __DEC128_SUBNORMAL_MIN__ 0.000000000000000000000000000000001E-6143DL
|
|
||||||
#define __FLT_HAS_INFINITY__ 1
|
|
||||||
#define __cpp_unicode_literals 200710
|
|
||||||
#define __UINT_FAST16_TYPE__ long unsigned int
|
|
||||||
#define __DEC64_MAX__ 9.999999999999999E384DD
|
|
||||||
#define __INT_FAST32_WIDTH__ 64
|
|
||||||
#define __CHAR16_TYPE__ short unsigned int
|
|
||||||
#define __PRAGMA_REDEFINE_EXTNAME 1
|
|
||||||
#define __SIZE_WIDTH__ 64
|
|
||||||
#define __SEG_FS 1
|
|
||||||
#define __INT_LEAST16_MAX__ 0x7fff
|
|
||||||
#define __DEC64_MANT_DIG__ 16
|
|
||||||
#define __UINT_LEAST32_MAX__ 0xffffffffU
|
|
||||||
#define __SEG_GS 1
|
|
||||||
#define __FLT32_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F32
|
|
||||||
#define __GCC_ATOMIC_LONG_LOCK_FREE 2
|
|
||||||
#define __SIG_ATOMIC_WIDTH__ 32
|
|
||||||
#define __INT_LEAST64_TYPE__ long int
|
|
||||||
#define __INT16_TYPE__ short int
|
|
||||||
#define __INT_LEAST8_TYPE__ signed char
|
|
||||||
#define __DEC32_MAX_EXP__ 97
|
|
||||||
#define __INT_FAST8_MAX__ 0x7f
|
|
||||||
#define __FLT128_MAX__ 1.18973149535723176508575932662800702e+4932F128
|
|
||||||
#define __INTPTR_MAX__ 0x7fffffffffffffffL
|
|
||||||
#define linux 1
|
|
||||||
#define __cpp_range_based_for 200907
|
|
||||||
#define __FLT64_HAS_QUIET_NAN__ 1
|
|
||||||
#define __FLT32_MIN_10_EXP__ (-37)
|
|
||||||
#define __SSE2__ 1
|
|
||||||
#define __EXCEPTIONS 1
|
|
||||||
#define __LDBL_MANT_DIG__ 64
|
|
||||||
#define __DBL_HAS_QUIET_NAN__ 1
|
|
||||||
#define __FLT64_HAS_INFINITY__ 1
|
|
||||||
#define __FLT64X_MAX__ 1.18973149535723176502126385303097021e+4932F64x
|
|
||||||
#define __SIG_ATOMIC_MIN__ (-__SIG_ATOMIC_MAX__ - 1)
|
|
||||||
#define __code_model_small__ 1
|
|
||||||
#define __cpp_return_type_deduction 201304
|
|
||||||
#define __k8__ 1
|
|
||||||
#define __INTPTR_TYPE__ long int
|
|
||||||
#define __UINT16_TYPE__ short unsigned int
|
|
||||||
#define __WCHAR_TYPE__ int
|
|
||||||
#define __SIZEOF_FLOAT__ 4
|
|
||||||
#define __pic__ 2
|
|
||||||
#define __UINTPTR_MAX__ 0xffffffffffffffffUL
|
|
||||||
#define __INT_FAST64_WIDTH__ 64
|
|
||||||
#define __DEC64_MIN_EXP__ (-382)
|
|
||||||
#define __cpp_decltype 200707
|
|
||||||
#define __FLT32_DECIMAL_DIG__ 9
|
|
||||||
#define __INT_FAST64_MAX__ 0x7fffffffffffffffL
|
|
||||||
#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1
|
|
||||||
#define __FLT_DIG__ 6
|
|
||||||
#define __FLT64X_MAX_EXP__ 16384
|
|
||||||
#define __UINT_FAST64_TYPE__ long unsigned int
|
|
||||||
#define __INT_MAX__ 0x7fffffff
|
|
||||||
#define __amd64__ 1
|
|
||||||
#define __INT64_TYPE__ long int
|
|
||||||
#define __FLT_MAX_EXP__ 128
|
|
||||||
#define __ORDER_BIG_ENDIAN__ 4321
|
|
||||||
#define __DBL_MANT_DIG__ 53
|
|
||||||
#define __cpp_inheriting_constructors 201511
|
|
||||||
#define __SIZEOF_FLOAT128__ 16
|
|
||||||
#define __INT_LEAST64_MAX__ 0x7fffffffffffffffL
|
|
||||||
#define __DEC64_MIN__ 1E-383DD
|
|
||||||
#define __WINT_TYPE__ unsigned int
|
|
||||||
#define __UINT_LEAST32_TYPE__ unsigned int
|
|
||||||
#define __SIZEOF_SHORT__ 2
|
|
||||||
#define __SSE__ 1
|
|
||||||
#define __LDBL_MIN_EXP__ (-16381)
|
|
||||||
#define __FLT64_MAX__ 1.79769313486231570814527423731704357e+308F64
|
|
||||||
#define __WINT_WIDTH__ 32
|
|
||||||
#define __INT_LEAST8_MAX__ 0x7f
|
|
||||||
#define __FLT32X_MAX_10_EXP__ 308
|
|
||||||
#define __SIZEOF_INT128__ 16
|
|
||||||
#define __LDBL_MAX_10_EXP__ 4932
|
|
||||||
#define __ATOMIC_RELAXED 0
|
|
||||||
#define __DBL_EPSILON__ double(2.22044604925031308084726333618164062e-16L)
|
|
||||||
#define __FLT128_MIN__ 3.36210314311209350626267781732175260e-4932F128
|
|
||||||
#define _LP64 1
|
|
||||||
#define __UINT8_C(c) c
|
|
||||||
#define __FLT64_MAX_EXP__ 1024
|
|
||||||
#define __INT_LEAST32_TYPE__ int
|
|
||||||
#define __SIZEOF_WCHAR_T__ 4
|
|
||||||
#define __FLT128_HAS_QUIET_NAN__ 1
|
|
||||||
#define __INT_FAST8_TYPE__ signed char
|
|
||||||
#define __FLT64X_MIN__ 3.36210314311209350626267781732175260e-4932F64x
|
|
||||||
#define __GNUC_STDC_INLINE__ 1
|
|
||||||
#define __FLT64_HAS_DENORM__ 1
|
|
||||||
#define __FLT32_EPSILON__ 1.19209289550781250000000000000000000e-7F32
|
|
||||||
#define __DBL_DECIMAL_DIG__ 17
|
|
||||||
#define __STDC_UTF_32__ 1
|
|
||||||
#define __INT_FAST8_WIDTH__ 8
|
|
||||||
#define __FXSR__ 1
|
|
||||||
#define __DEC_EVAL_METHOD__ 2
|
|
||||||
#define __FLT32X_MAX__ 1.79769313486231570814527423731704357e+308F32x
|
|
||||||
#define __cpp_runtime_arrays 198712
|
|
||||||
#define __UINT64_TYPE__ long unsigned int
|
|
||||||
#define __UINT32_C(c) c ## U
|
|
||||||
#define __INTMAX_MAX__ 0x7fffffffffffffffL
|
|
||||||
#define __cpp_alias_templates 200704
|
|
||||||
#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
|
|
||||||
#define __FLT_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F
|
|
||||||
#define __INT8_MAX__ 0x7f
|
|
||||||
#define __LONG_WIDTH__ 64
|
|
||||||
#define __PIC__ 2
|
|
||||||
#define __UINT_FAST32_TYPE__ long unsigned int
|
|
||||||
#define __CHAR32_TYPE__ unsigned int
|
|
||||||
#define __FLT_MAX__ 3.40282346638528859811704183484516925e+38F
|
|
||||||
#define __cpp_constexpr 201304
|
|
||||||
#define __INT32_TYPE__ int
|
|
||||||
#define __SIZEOF_DOUBLE__ 8
|
|
||||||
#define __cpp_exceptions 199711
|
|
||||||
#define __FLT_MIN_10_EXP__ (-37)
|
|
||||||
#define __FLT64_MIN__ 2.22507385850720138309023271733240406e-308F64
|
|
||||||
#define __INT_LEAST32_WIDTH__ 32
|
|
||||||
#define __INTMAX_TYPE__ long int
|
|
||||||
#define __DEC128_MAX_EXP__ 6145
|
|
||||||
#define __FLT32X_HAS_QUIET_NAN__ 1
|
|
||||||
#define __ATOMIC_CONSUME 1
|
|
||||||
#define __GNUC_MINOR__ 3
|
|
||||||
#define __GLIBCXX_TYPE_INT_N_0 __int128
|
|
||||||
#define __INT_FAST16_WIDTH__ 64
|
|
||||||
#define __UINTMAX_MAX__ 0xffffffffffffffffUL
|
|
||||||
#define __DEC32_MANT_DIG__ 7
|
|
||||||
#define __FLT32X_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F32x
|
|
||||||
#define __DBL_MAX_10_EXP__ 308
|
|
||||||
#define __LDBL_DENORM_MIN__ 3.64519953188247460252840593361941982e-4951L
|
|
||||||
#define __INT16_C(c) c
|
|
||||||
#define __cpp_generic_lambdas 201304
|
|
||||||
#define __STDC__ 1
|
|
||||||
#define __FLT32X_DIG__ 15
|
|
||||||
#define __PTRDIFF_TYPE__ long int
|
|
||||||
#define __ATOMIC_SEQ_CST 5
|
|
||||||
#define __UINT32_TYPE__ unsigned int
|
|
||||||
#define __FLT32X_MIN_10_EXP__ (-307)
|
|
||||||
#define __UINTPTR_TYPE__ long unsigned int
|
|
||||||
#define __DEC64_SUBNORMAL_MIN__ 0.000000000000001E-383DD
|
|
||||||
#define __DEC128_MANT_DIG__ 34
|
|
||||||
#define __LDBL_MIN_10_EXP__ (-4931)
|
|
||||||
#define __FLT128_EPSILON__ 1.92592994438723585305597794258492732e-34F128
|
|
||||||
#define __SSE_MATH__ 1
|
|
||||||
#define __SIZEOF_LONG_LONG__ 8
|
|
||||||
#define __cpp_user_defined_literals 200809
|
|
||||||
#define __FLT128_DECIMAL_DIG__ 36
|
|
||||||
#define __GCC_ATOMIC_LLONG_LOCK_FREE 2
|
|
||||||
#define __FLT32X_MIN__ 2.22507385850720138309023271733240406e-308F32x
|
|
||||||
#define __LDBL_DIG__ 18
|
|
||||||
#define __FLT_DECIMAL_DIG__ 9
|
|
||||||
#define __UINT_FAST16_MAX__ 0xffffffffffffffffUL
|
|
||||||
#define __GCC_ATOMIC_SHORT_LOCK_FREE 2
|
|
||||||
#define __INT_LEAST64_WIDTH__ 64
|
|
||||||
#define __UINT_FAST8_TYPE__ unsigned char
|
|
||||||
#define _GNU_SOURCE 1
|
|
||||||
#define __cpp_init_captures 201304
|
|
||||||
#define __ATOMIC_ACQ_REL 4
|
|
||||||
#define __ATOMIC_RELEASE 3
|
|
||||||
Reference in New Issue
Block a user