Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5d8b8959d4 | |||
| 30bc1f8245 | |||
| d1662f12fb | |||
| 05b559bacf | |||
| cec1e0bbb6 |
@@ -0,0 +1,24 @@
|
||||
#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,6 +1,7 @@
|
||||
#ifndef COMMONWINDOW_H_
|
||||
#define COMMONWINDOW_H_
|
||||
|
||||
#include<QDialog>
|
||||
#include<QHBoxLayout>
|
||||
#include<QVBoxLayout>
|
||||
#include<QComboBox>
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
#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;
|
||||
}
|
||||
+18
-17
@@ -4,36 +4,37 @@
|
||||
#include<string>
|
||||
#include<sstream>
|
||||
|
||||
using std::string;
|
||||
using std::stringstream;
|
||||
|
||||
class Conversions
|
||||
{
|
||||
public:
|
||||
Conversions() = default;
|
||||
~Conversions()=default;
|
||||
|
||||
template<typename C=char,typename S=std::string>
|
||||
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)
|
||||
{
|
||||
std::stringstream cToS{};
|
||||
template<typename C=char,typename S=string>
|
||||
S cstringToString(const C* tmp, const int size)
|
||||
{
|
||||
stringstream cToS{};
|
||||
for (auto index=0; index!=size; ++index)
|
||||
cToS<<tmp[index];
|
||||
std::string tmpString{};
|
||||
S tmpString{};
|
||||
cToS>>tmpString;
|
||||
return tmpString;
|
||||
}
|
||||
template<typename C=char,typename S=std::string>
|
||||
C Conversions::stringToChar(const S& tmp)
|
||||
{
|
||||
std::stringstream sToC{};
|
||||
|
||||
}
|
||||
template<typename C=char,typename S=string>
|
||||
C stringToChar(const S& tmp)
|
||||
{
|
||||
|
||||
stringstream sToC{};
|
||||
for (auto tmpElements:tmp)
|
||||
sToC<<tmpElements;
|
||||
char tmpChar{};
|
||||
sToC>>tmpChar;
|
||||
return tmpChar;
|
||||
}
|
||||
}
|
||||
private:
|
||||
};
|
||||
#endif
|
||||
|
||||
+1
-12
@@ -1,15 +1,4 @@
|
||||
#include"Cryption.h"
|
||||
|
||||
Cryption::Cryption(const std::string& message)
|
||||
Cryption::Cryption(const string& message)
|
||||
{ this->message = message; }
|
||||
|
||||
|
||||
/**
|
||||
void Cryption::setMessage(const std::string& message)
|
||||
{ this->message = message; }
|
||||
*/
|
||||
|
||||
/**
|
||||
std::string Cryption::getMessage() const
|
||||
{ return message; }
|
||||
*/
|
||||
|
||||
+6
-4
@@ -3,17 +3,19 @@
|
||||
|
||||
#include<string>
|
||||
|
||||
using std::string;
|
||||
|
||||
class Cryption
|
||||
{
|
||||
public:
|
||||
Cryption() = default;
|
||||
~Cryption() = default;
|
||||
Cryption(const std::string&);
|
||||
Cryption(const string&);
|
||||
|
||||
virtual void setMessage(const std::string&) = 0;
|
||||
virtual std::string getMessage() const = 0;
|
||||
virtual void setMessage(const string&) = 0;
|
||||
virtual string getMessage() const = 0;
|
||||
|
||||
std::string message;
|
||||
string message;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+22
-15
@@ -1,29 +1,36 @@
|
||||
#include<iostream>
|
||||
#include<fstream>
|
||||
#include<sstream>
|
||||
#include<ios>
|
||||
#include<vector>
|
||||
#include"Conversions.h"
|
||||
#include"Decryption.h"
|
||||
#include"KeyRetrieval.h"
|
||||
|
||||
Decryption::Decryption(const std::string& message)
|
||||
Decryption::Decryption(const string& message)
|
||||
{
|
||||
this->message = message;
|
||||
setupMap();
|
||||
decryptMessage();
|
||||
}
|
||||
Decryption::Decryption(const Password<>& py, const Key<>& ky)
|
||||
{
|
||||
setupMap(ky);
|
||||
passwordPath.assign(py.passwordPath());
|
||||
decryptMessage();
|
||||
}
|
||||
|
||||
|
||||
void Decryption::setDecryptedMessage(const std::string& message) { this->decryptedMessage = message; }
|
||||
void Decryption::setMessage(const std::string& message) { this->message = message; }
|
||||
void Decryption::setDecryptedMessage(const string& message) { this->decryptedMessage = message; }
|
||||
void Decryption::setMessage(const string& message) { this->message = message; }
|
||||
|
||||
void Decryption::retrieveMetaData()
|
||||
{
|
||||
|
||||
}
|
||||
void Decryption::decryptMessage()
|
||||
{
|
||||
std::fstream ioEvent{};
|
||||
ioEvent.open("encryptedFile.txt", std::ios::in);
|
||||
fstream ioEvent{};
|
||||
ioEvent.open(passwordPath.c_str(), std::ios::in);
|
||||
|
||||
std::string messageToBeDecrypted{}, decryptedMessage{};
|
||||
string messageToBeDecrypted{}, decryptedMessage{};
|
||||
|
||||
while(ioEvent >> messageToBeDecrypted);
|
||||
|
||||
@@ -41,14 +48,14 @@ void Decryption::decryptMessage()
|
||||
}
|
||||
|
||||
|
||||
std::string Decryption::getDecryptedMessage() const { return decryptedMessage; }
|
||||
std::string Decryption::getMessage() const { return message; }
|
||||
string Decryption::getDecryptedMessage() const { return decryptedMessage; }
|
||||
string Decryption::getMessage() const { return message; }
|
||||
|
||||
void Decryption::setupMap()
|
||||
void Decryption::setupMap(const Key<>& ky)
|
||||
{
|
||||
KeyRetrieval kr{};
|
||||
std::vector<std::string> k{kr.keyStructure()};
|
||||
std::vector<int> c{kr.codeCharacterStructure()};
|
||||
KeyRetrieval kr{ky};
|
||||
vector<string> k{kr.keyStructure()};
|
||||
vector<int> c{kr.codeCharacterStructure()};
|
||||
|
||||
for (auto index = 0u; index!=c.size(); ++index)
|
||||
decryptedCharacters[k[index]] = c[index];
|
||||
|
||||
+14
-9
@@ -1,27 +1,32 @@
|
||||
#ifndef DECRYPTION_H
|
||||
#define DECRYPTION_H
|
||||
|
||||
#include<string>
|
||||
#include<map>
|
||||
#include"Cryption.h"
|
||||
#include"Encryption.h"
|
||||
|
||||
using std::map;
|
||||
|
||||
class Decryption : public Cryption
|
||||
{
|
||||
public:
|
||||
Decryption() = default;
|
||||
~Decryption() = default;
|
||||
Decryption(const std::string&);
|
||||
Decryption(const string&);
|
||||
explicit Decryption(const Password<>&, const Key<>&);
|
||||
|
||||
void setDecryptedMessage(const std::string&);
|
||||
void setMessage(const std::string&) override;
|
||||
void setDecryptedMessage(const string&);
|
||||
void setMessage(const string&) override;
|
||||
void retrieveMetaData();
|
||||
void decryptMessage();
|
||||
|
||||
std::string getDecryptedMessage() const;
|
||||
std::string getMessage() const override;
|
||||
string getDecryptedMessage() const;
|
||||
string getMessage() const override;
|
||||
private:
|
||||
void setupMap();
|
||||
std::string decryptedMessage;
|
||||
std::map<std::string, char> decryptedCharacters;
|
||||
void setupMap(const Key<>&);
|
||||
string decryptedMessage;
|
||||
string passwordPath;
|
||||
map<string, char> decryptedCharacters;
|
||||
const int keyLength{5};
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
#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
|
||||
+31
-28
@@ -1,37 +1,32 @@
|
||||
#include<ios>
|
||||
#include<iostream>
|
||||
#include<fstream>
|
||||
#include<string>
|
||||
#include"Encryption.h"
|
||||
#include"GenerateKeys.h"
|
||||
#include"GeneratePasswordFileName.h"
|
||||
#include"KeyRetrieval.h"
|
||||
#include"FileNameRetrieval.h"
|
||||
#include"FolderStructure.h"
|
||||
|
||||
/**
|
||||
Encryption::Encryption(const std::string& message)
|
||||
{
|
||||
this->message = message;
|
||||
setupMap();
|
||||
|
||||
encryptMessage();
|
||||
}
|
||||
*/
|
||||
Encryption::Encryption(const std::string& message, const std::string& keyPath)
|
||||
Encryption::Encryption(const string& message, const string& keyPath)
|
||||
{
|
||||
this->message = message;
|
||||
setupMap(keyPath);
|
||||
configurePasswordFileName();
|
||||
encryptMessage();
|
||||
}
|
||||
Encryption::Encryption(const Password<>& pass, const Key<>& ky)
|
||||
{
|
||||
message.assign(pass.retrieveDecryptedMessage());
|
||||
setupMap(ky.path());
|
||||
encryptMessage(pass);
|
||||
}
|
||||
|
||||
void Encryption::setEncryptedMessage(const std::string& encryptedMessage) { this->encryptedMessage = encryptedMessage; }
|
||||
void Encryption::setMessage(const std::string& message) { this->message = message; }
|
||||
void Encryption::encryptMessage()
|
||||
void Encryption::setEncryptedMessage(const string& encryptedMessage) { this->encryptedMessage = encryptedMessage; }
|
||||
void Encryption::setMessage(const string& message) { this->message = message; }
|
||||
void Encryption::encryptMessage(const Password<>& pass)
|
||||
{
|
||||
std::fstream ioEvent{};
|
||||
ioEvent.open(passwordFileName, std::ios::out);
|
||||
fstream ioEvent{};
|
||||
ioEvent.open(pass.passwordPath(), std::ios::out);
|
||||
auto p = pass.passwordPath();
|
||||
|
||||
addMetadata(pass, ioEvent);
|
||||
|
||||
for (auto indexOfString = 0u; indexOfString!=message.size(); ++indexOfString)
|
||||
{
|
||||
@@ -41,13 +36,21 @@ void Encryption::encryptMessage()
|
||||
this->encryptedMessage = encryptedMessage;
|
||||
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 std::string& keyPath)
|
||||
void Encryption::setupMap(const string& keyPath)
|
||||
{
|
||||
KeyRetrieval kr{keyPath};
|
||||
std::vector<std::string> k{kr.keyStructure()};
|
||||
std::vector<int> c{kr.codeCharacterStructure()};
|
||||
vector<string> k{kr.keyStructure()};
|
||||
vector<int> c{kr.codeCharacterStructure()};
|
||||
|
||||
for (auto index = 0u; index!=k.size(); ++index)
|
||||
encryptedCharacters[c[index]] = k[index];
|
||||
@@ -59,7 +62,7 @@ void Encryption::configurePasswordFileName()
|
||||
GeneratePasswordFileName gp{};
|
||||
passwordFileName.assign(gp.passwordFileNameString());
|
||||
}
|
||||
std::string tmpString{passwordFileName};
|
||||
string tmpString{passwordFileName};
|
||||
passwordFileName.assign(FolderStructure::passwordDirectory);
|
||||
passwordFileName.append(tmpString);
|
||||
}
|
||||
@@ -68,7 +71,7 @@ bool Encryption::repetitive()
|
||||
passwordFileName.append(".txt");
|
||||
FileNameRetrieval fnr;
|
||||
fnr.retrievePasswordNames();
|
||||
std::vector<std::string> createdPasswordNames{fnr.passwordNameContainer()};
|
||||
vector<string> createdPasswordNames{fnr.passwordNameContainer()};
|
||||
auto count = 0;
|
||||
for (auto cPNBegin = createdPasswordNames.begin(); cPNBegin!=createdPasswordNames.end(); ++cPNBegin)
|
||||
{
|
||||
@@ -77,6 +80,6 @@ bool Encryption::repetitive()
|
||||
}
|
||||
return false;
|
||||
}
|
||||
std::string Encryption::getEncryptedMessage() const { return encryptedMessage; }
|
||||
std::string Encryption::getMessage() const { return message; }
|
||||
std::map<char, std::string> Encryption::encryptedCharactersStructure() { return encryptedCharacters; }
|
||||
string Encryption::getEncryptedMessage() const { return encryptedMessage; }
|
||||
string Encryption::getMessage() const { return message; }
|
||||
map<char, string> Encryption::encryptedCharactersStructure() { return encryptedCharacters; }
|
||||
|
||||
+18
-13
@@ -1,31 +1,36 @@
|
||||
#ifndef ENCRYPTION_H
|
||||
#define ENCRYPTION_H
|
||||
|
||||
#include<string>
|
||||
#include<map>
|
||||
#include"Cryption.h"
|
||||
#include"Key.h"
|
||||
#include"Password.h"
|
||||
|
||||
using std::map;
|
||||
using std::fstream;
|
||||
|
||||
class Encryption : public Cryption
|
||||
{
|
||||
public:
|
||||
Encryption() = default;
|
||||
~Encryption() = default;
|
||||
//Encryption(const std::string&);
|
||||
explicit Encryption(const std::string&, const std::string&);
|
||||
explicit Encryption(const string&, const string&);
|
||||
explicit Encryption(const Password<>&, const Key<>&);
|
||||
|
||||
void setEncryptedMessage(const std::string&);
|
||||
void setMessage(const std::string&) override;
|
||||
void encryptMessage();
|
||||
void setEncryptedMessage(const string&);
|
||||
void setMessage(const string&) override;
|
||||
void encryptMessage(const Password<>&);
|
||||
void addMetadata(const Password<>&, fstream&);
|
||||
|
||||
std::string getEncryptedMessage() const;
|
||||
std::string getMessage() const override;
|
||||
std::map<char, std::string> encryptedCharactersStructure();
|
||||
string getEncryptedMessage() const;
|
||||
string getMessage() const override;
|
||||
map<char, string> encryptedCharactersStructure();
|
||||
private:
|
||||
void setupMap(const std::string&);
|
||||
void setupMap(const string&);
|
||||
void configurePasswordFileName();
|
||||
bool repetitive();
|
||||
std::string encryptedMessage;
|
||||
std::string passwordFileName;
|
||||
std::map<char, std::string> encryptedCharacters;
|
||||
string encryptedMessage;
|
||||
string passwordFileName;
|
||||
map<char, string> encryptedCharacters;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
FileNameRetrieval::FileNameRetrieval() { }
|
||||
|
||||
std::vector<std::string> FileNameRetrieval::fileNameContainer() const { return fileNames; }
|
||||
std::vector<std::string> FileNameRetrieval::passwordNameContainer() const { return passwordNames; }
|
||||
vector<string> FileNameRetrieval::fileNameContainer() const { return fileNames; }
|
||||
vector<string> FileNameRetrieval::passwordNameContainer() const { return passwordNames; }
|
||||
void FileNameRetrieval::retrieveFileNames()
|
||||
{
|
||||
boost::filesystem::path directory(FolderStructure::keyDirectory);
|
||||
@@ -23,5 +23,8 @@ void FileNameRetrieval::retrievePasswordNames()
|
||||
|
||||
for (; beg!=end; ++beg)
|
||||
if (beg->path().extension()==".txt")
|
||||
passwordNames.push_back(beg->path().filename().string());
|
||||
{
|
||||
std::string passwordFilename = beg->path().filename().string();
|
||||
passwordNames.push_back(passwordFilename);
|
||||
}
|
||||
}
|
||||
|
||||
+7
-4
@@ -4,6 +4,9 @@
|
||||
#include<vector>
|
||||
#include<string>
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
class FileNameRetrieval
|
||||
{
|
||||
public:
|
||||
@@ -11,10 +14,10 @@ public:
|
||||
|
||||
void retrieveFileNames();
|
||||
void retrievePasswordNames();
|
||||
std::vector<std::string> fileNameContainer() const;
|
||||
std::vector<std::string> passwordNameContainer() const;
|
||||
vector<string> fileNameContainer() const;
|
||||
vector<string> passwordNameContainer() const;
|
||||
private:
|
||||
std::vector<std::string> fileNames;
|
||||
std::vector<std::string> passwordNames;
|
||||
vector<string> fileNames;
|
||||
vector<string> passwordNames;
|
||||
};
|
||||
#endif
|
||||
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
#include"FolderStructure.h"
|
||||
|
||||
std::string FolderStructure::rootDirectory{};
|
||||
std::string FolderStructure::keyDirectory{};
|
||||
std::string FolderStructure::passwordDirectory{};
|
||||
std::string FolderStructure::settingDirectory{};
|
||||
string FolderStructure::rootDirectory{};
|
||||
string FolderStructure::keyDirectory{};
|
||||
string FolderStructure::passwordDirectory{};
|
||||
string FolderStructure::settingDirectory{};
|
||||
|
||||
void FolderStructure::setupPaths(const char* rootPath)
|
||||
{
|
||||
|
||||
+6
-4
@@ -3,12 +3,14 @@
|
||||
|
||||
#include<string>
|
||||
|
||||
using std::string;
|
||||
|
||||
struct FolderStructure
|
||||
{
|
||||
static std::string rootDirectory;
|
||||
static std::string keyDirectory;
|
||||
static std::string passwordDirectory;
|
||||
static std::string settingDirectory;
|
||||
static string rootDirectory;
|
||||
static string keyDirectory;
|
||||
static string passwordDirectory;
|
||||
static string settingDirectory;
|
||||
|
||||
void setupPaths(const char*);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
#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
|
||||
@@ -1,201 +0,0 @@
|
||||
#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;
|
||||
}
|
||||
+195
-23
@@ -1,20 +1,36 @@
|
||||
#ifndef GENERATEKEYS_H
|
||||
#define GENERATEKEYS_H
|
||||
|
||||
#include<string>
|
||||
#include<vector>
|
||||
#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"
|
||||
|
||||
class GenerateKeys
|
||||
using std::vector;
|
||||
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:
|
||||
|
||||
GenerateKeys();
|
||||
~GenerateKeys() = default;
|
||||
|
||||
void populateDecryptedValues();
|
||||
void populateEncryptedValues();
|
||||
void keyMove();
|
||||
void keyDump();
|
||||
void keyMove(Key<>&);
|
||||
void keyDump(Key<>&);
|
||||
|
||||
friend class Encryption;
|
||||
friend class Decryption;
|
||||
@@ -24,26 +40,182 @@ private:
|
||||
void populateSymbols();
|
||||
void populateNumbers();
|
||||
void populateLetters();
|
||||
void addRange(std::vector<int>&, int, const int);
|
||||
void addToCentralContainer(std::vector<int>&);
|
||||
template<typename C, typename L>
|
||||
void addToDesignatedContainer(C&, const L&);
|
||||
template<typename C, typename DT>
|
||||
void addRange(C&, DT, const DT);
|
||||
template<typename C>
|
||||
void addToCentralContainer(C&);
|
||||
|
||||
void generateKey(std::string&, const int&);
|
||||
bool isThereRepetition();
|
||||
void print(const std::vector<int>&);
|
||||
template<typename S, typename DT>
|
||||
void generateKey(S&, const DT);
|
||||
bool isThereRepetition(const Key<>&);
|
||||
template<typename C>
|
||||
void print(const C&);
|
||||
|
||||
char getChar(std::vector<int>&);
|
||||
template<typename C>
|
||||
char getChar(const C&);
|
||||
|
||||
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"};
|
||||
string defaultKeyFileName;
|
||||
//KeySize show equal the value in key
|
||||
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
|
||||
|
||||
@@ -5,42 +5,11 @@
|
||||
|
||||
GeneratePasswordFileName::GeneratePasswordFileName()
|
||||
{
|
||||
srand(time(0));
|
||||
generatedFileName();
|
||||
}
|
||||
void GeneratePasswordFileName::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)
|
||||
{
|
||||
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));
|
||||
}
|
||||
filename.assign(dateString());
|
||||
for (auto index = 0; index!=8; ++index)
|
||||
{
|
||||
if (index==0) filename.append("_");
|
||||
@@ -52,4 +21,7 @@ void GeneratePasswordFileName::generatedFileName()
|
||||
}
|
||||
}
|
||||
|
||||
std::string GeneratePasswordFileName::passwordFileNameString() const { return filename; }
|
||||
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,15 +1,20 @@
|
||||
#ifndef GENERATEPASSWORDFILENAME_H_
|
||||
#define GENERATEPASSWORDFILENAME_H_
|
||||
|
||||
#include<string>
|
||||
#include"TimeInformation.h"
|
||||
|
||||
class GeneratePasswordFileName
|
||||
using std::string;
|
||||
|
||||
class GeneratePasswordFileName : public TimeInformation<int>
|
||||
{
|
||||
public:
|
||||
GeneratePasswordFileName();
|
||||
std::string passwordFileNameString() const;
|
||||
string passwordFileNameString() const;
|
||||
int retrieveYear() const;
|
||||
int retrieveMonth() const;
|
||||
int retrieveDayOfMonth() const;
|
||||
private:
|
||||
void generatedFileName();
|
||||
std::string filename;
|
||||
string filename;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
#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
|
||||
+18
-30
@@ -1,10 +1,8 @@
|
||||
#include<QString>
|
||||
#include<QWidget>
|
||||
#include<QHeaderView>
|
||||
#include<QTableWidgetItem>
|
||||
#include<iostream>
|
||||
#include<string>
|
||||
#include<sstream>
|
||||
#include<cstdlib>
|
||||
#include<fstream>
|
||||
#include<ios>
|
||||
@@ -13,15 +11,20 @@
|
||||
#include"Encryption.h"
|
||||
#include"GenerateKeys.h"
|
||||
#include"KeyRetrieval.h"
|
||||
#include"Conversions.h"
|
||||
#include"FileNameRetrieval.h"
|
||||
#include"FolderStructure.h"
|
||||
#include"Key.h"
|
||||
|
||||
KeyManagementWindow::KeyManagementWindow(QWidget* parent) : QDialog(parent)
|
||||
{
|
||||
setupWindow();
|
||||
connections();
|
||||
}
|
||||
KeyManagementWindow::KeyManagementWindow(QWidget* parent, MainWindow* mw, PasswordManagementWindow* pw) : QDialog(parent), mw(mw), pw(pw)
|
||||
{
|
||||
setupWindow();
|
||||
connections();
|
||||
}
|
||||
|
||||
|
||||
void KeyManagementWindow::setContentsOfComboBox()
|
||||
@@ -29,7 +32,7 @@ void KeyManagementWindow::setContentsOfComboBox()
|
||||
selectionBox.get()->clear();
|
||||
FileNameRetrieval fnr;
|
||||
fnr.retrieveFileNames();
|
||||
std::vector<std::string> fn{fnr.fileNameContainer()};
|
||||
vector<string> fn{fnr.fileNameContainer()};
|
||||
|
||||
for (auto fle: fn)
|
||||
{
|
||||
@@ -41,11 +44,11 @@ void KeyManagementWindow::setContentOfKeyView()
|
||||
{
|
||||
QString testQ;
|
||||
testQ.append(selectionBox.get()->currentText());
|
||||
std::string testS{FolderStructure::keyDirectory+testQ.toStdString()};
|
||||
string testS{FolderStructure::keyDirectory+testQ.toStdString()};
|
||||
|
||||
KeyRetrieval kr{testS};
|
||||
std::vector<int> asciiKeys{kr.codeCharacterStructure()};
|
||||
std::vector<std::string> asciiAssignment{kr.keyStructure()};
|
||||
vector<int> asciiKeys{kr.codeCharacterStructure()};
|
||||
vector<string> asciiAssignment{kr.keyStructure()};
|
||||
|
||||
auto asciiKeysIter = asciiKeys.begin();
|
||||
auto asciiAssignmentIter = asciiAssignment.begin();
|
||||
@@ -55,7 +58,7 @@ void KeyManagementWindow::setContentOfKeyView()
|
||||
{
|
||||
if (column==0)
|
||||
{
|
||||
std::string val;
|
||||
string val;
|
||||
QString s;
|
||||
switch (*asciiKeysIter)
|
||||
{
|
||||
@@ -70,7 +73,7 @@ void KeyManagementWindow::setContentOfKeyView()
|
||||
++asciiKeysIter;
|
||||
break;
|
||||
default:
|
||||
val.assign(std::string{static_cast<char>(*asciiKeysIter++)});
|
||||
val.assign(string{static_cast<char>(*asciiKeysIter++)});
|
||||
s.append(val.c_str());
|
||||
break;
|
||||
}
|
||||
@@ -78,7 +81,7 @@ void KeyManagementWindow::setContentOfKeyView()
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string val{*asciiAssignmentIter++};
|
||||
string val{*asciiAssignmentIter++};
|
||||
QString s{val.c_str()};
|
||||
elementView.get()->setItem(row, column, new QTableWidgetItem(s));
|
||||
}
|
||||
@@ -143,29 +146,14 @@ void KeyManagementWindow::connections()
|
||||
QObject::connect(closeButton.get(), SIGNAL(clicked()), this, SLOT(exitApplication()));
|
||||
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()
|
||||
{
|
||||
GenerateKeys gk{};
|
||||
gk.keyMove();
|
||||
gk.keyDump();
|
||||
Key<> theKey{};
|
||||
gk.keyMove(theKey);
|
||||
gk.keyDump(theKey);
|
||||
setContentsOfComboBox();
|
||||
mw.get()->refreshComboBox();
|
||||
pw->setupContentOfComboBox();
|
||||
}
|
||||
void KeyManagementWindow::exitApplication() { this->hide(); }
|
||||
|
||||
@@ -1,20 +1,24 @@
|
||||
#ifndef KEYMANAGEMENTWINDOW_H
|
||||
#define KEYMANAGEMENTWINDOW_H
|
||||
|
||||
#include<QDialog>
|
||||
#include<QString>
|
||||
#include<memory>
|
||||
#include"CommonWindow.h"
|
||||
#include"Encryption.h"
|
||||
#include"MainWindow.h"
|
||||
#include"PasswordManagementWindow.h"
|
||||
#include"ViewingWindow.h"
|
||||
|
||||
class MainWindow;
|
||||
class PasswordManagementWindow;
|
||||
|
||||
class KeyManagementWindow : public QDialog, public CommonWindow, public ViewingWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
KeyManagementWindow(QWidget* parent = 0);
|
||||
explicit KeyManagementWindow(QWidget* parent = 0, MainWindow* mw = 0, PasswordManagementWindow* pw = 0);
|
||||
~KeyManagementWindow() = default;
|
||||
private slots:
|
||||
//void test();
|
||||
void generation();
|
||||
void exitApplication();
|
||||
void setContentOfKeyView();
|
||||
@@ -23,5 +27,7 @@ private:
|
||||
void setupWindow();
|
||||
void connections();
|
||||
unique_ptr<QString> qSB;
|
||||
unique_ptr<MainWindow> mw;
|
||||
unique_ptr<PasswordManagementWindow> pw;
|
||||
};
|
||||
#endif
|
||||
|
||||
+13
-6
@@ -1,6 +1,6 @@
|
||||
#include<fstream>
|
||||
#include<iostream>
|
||||
#include<ios>
|
||||
#include"FolderStructure.h"
|
||||
#include"KeyRetrieval.h"
|
||||
|
||||
KeyRetrieval::KeyRetrieval()
|
||||
@@ -8,16 +8,23 @@ KeyRetrieval::KeyRetrieval()
|
||||
retrieveKey();
|
||||
addToList();
|
||||
}
|
||||
KeyRetrieval::KeyRetrieval(const std::string fileName)
|
||||
KeyRetrieval::KeyRetrieval(const string fileName)
|
||||
{
|
||||
this->fileName.assign(fileName);
|
||||
retrieveKey();
|
||||
addToList();
|
||||
}
|
||||
KeyRetrieval::KeyRetrieval(const Key<>& ky)
|
||||
{
|
||||
auto path = ky.path();
|
||||
fileName.assign(path);
|
||||
retrieveKey();
|
||||
addToList();
|
||||
}
|
||||
|
||||
void KeyRetrieval::retrieveKey()
|
||||
{
|
||||
std::fstream readKeys{};
|
||||
fstream readKeys{};
|
||||
readKeys.open(fileName.c_str());
|
||||
char keyChar[keySize];
|
||||
while (!readKeys.eof())
|
||||
@@ -46,7 +53,7 @@ void KeyRetrieval::addRange(int from, const int to)
|
||||
for (; from<=to; ++from)
|
||||
codeCharacter.push_back(from);
|
||||
}
|
||||
void KeyRetrieval::fileNameChoice(const std::string& fileName) { this->fileName.assign(fileName); }
|
||||
void KeyRetrieval::fileNameChoice(const string& fileName) { this->fileName.assign(fileName); }
|
||||
|
||||
std::vector<std::string> KeyRetrieval::keyStructure() { return keys; }
|
||||
std::vector<int> KeyRetrieval::codeCharacterStructure() { return codeCharacter; }
|
||||
vector<string> KeyRetrieval::keyStructure() { return keys; }
|
||||
vector<int> KeyRetrieval::codeCharacterStructure() { return codeCharacter; }
|
||||
|
||||
+13
-9
@@ -1,29 +1,33 @@
|
||||
#ifndef KEYRETRIEVAL_H
|
||||
#define KEYRETRIEVAL_H
|
||||
|
||||
#include<fstream>
|
||||
#include<vector>
|
||||
#include<string>
|
||||
#include<list>
|
||||
#include"Key.h"
|
||||
|
||||
using std::fstream;
|
||||
|
||||
class KeyRetrieval
|
||||
{
|
||||
public:
|
||||
KeyRetrieval();
|
||||
KeyRetrieval(const std::string);
|
||||
KeyRetrieval(const string);
|
||||
KeyRetrieval(const Key<>&);
|
||||
~KeyRetrieval() = default;
|
||||
|
||||
void retrieveKey();
|
||||
void addToList();
|
||||
void addRange(int, const int);
|
||||
void fileNameChoice(const std::string&);
|
||||
void fileNameChoice(const string&);
|
||||
|
||||
std::vector<std::string> keyStructure();
|
||||
std::vector<int> codeCharacterStructure();
|
||||
vector<string> keyStructure();
|
||||
vector<int> codeCharacterStructure();
|
||||
private:
|
||||
std::string fileName{"default_keys.txt"};
|
||||
std::vector<std::string> keys;
|
||||
std::vector<char> characters;
|
||||
std::vector<int> codeCharacter;
|
||||
string fileName{"default_keys.txt"};
|
||||
vector<string> keys;
|
||||
vector<char> characters;
|
||||
vector<int> codeCharacter;
|
||||
const int keySize{5};
|
||||
};
|
||||
#endif
|
||||
|
||||
+57
-11
@@ -6,11 +6,17 @@
|
||||
#include"KeyRetrieval.h"
|
||||
#include"FileNameRetrieval.h"
|
||||
#include"FolderStructure.h"
|
||||
#include"Key.h"
|
||||
#include"Password.h"
|
||||
#include"SaveFile.h" //Do not know if it is included somewhere
|
||||
|
||||
MainWindow::MainWindow()
|
||||
{
|
||||
kh = unique_ptr<KeyManagementWindow>{new KeyManagementWindow};
|
||||
MainWindow* mw = this;
|
||||
QWidget* w = 0;
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -53,7 +59,7 @@ void MainWindow::setupContentOfComboBox()
|
||||
selectionBox.get()->clear();
|
||||
FileNameRetrieval fnr;
|
||||
fnr.retrieveFileNames();
|
||||
std::vector<std::string> fn{fnr.fileNameContainer()};
|
||||
vector<string> fn{fnr.fileNameContainer()};
|
||||
|
||||
for (auto fle: fn)
|
||||
{
|
||||
@@ -61,6 +67,7 @@ void MainWindow::setupContentOfComboBox()
|
||||
selectionBox.get()->addItem(bl);
|
||||
}
|
||||
}
|
||||
void MainWindow::refreshComboBox() { setupContentOfComboBox(); }
|
||||
void MainWindow::createMenus()
|
||||
{
|
||||
fileMenu = unique_ptr<QMenu>{menuBar()->addMenu(tr("File"))};
|
||||
@@ -86,24 +93,44 @@ void MainWindow::connections()
|
||||
QObject::connect(actionButton.get(), SIGNAL(clicked()), this, SLOT(encryptPassword()));
|
||||
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()
|
||||
{
|
||||
QString passwordToEncrypt{textForCryption.get()->toPlainText()}, keyForEncryption{selectionBox.get()->currentText()};
|
||||
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;
|
||||
requestFilename();
|
||||
switchControlEnabling();
|
||||
}
|
||||
void MainWindow::keyManagementWindow() { kh.get()->show(); }
|
||||
void MainWindow::passwordManageWindow() { ph.get()->show(); }
|
||||
void MainWindow::exitApplication() { exit(0); }
|
||||
|
||||
|
||||
std::string MainWindow::grabCryptionText()
|
||||
string MainWindow::grabCryptionText()
|
||||
{
|
||||
auto placeHolder = textForCryption.get()->toPlainText();
|
||||
|
||||
@@ -115,3 +142,22 @@ void MainWindow::activateButton()
|
||||
if (content.size()>0 && selectionBox.get()->count()>0) actionButton.get()->setEnabled(true);
|
||||
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();
|
||||
}
|
||||
|
||||
+16
-9
@@ -2,20 +2,22 @@
|
||||
#define MAINWINDOW_H_
|
||||
|
||||
#include<QDialog>
|
||||
#include<QPushButton>
|
||||
#include<QTextEdit>
|
||||
#include<QLabel>
|
||||
#include<QMenuBar>
|
||||
#include<QMainWindow>
|
||||
#include<QMenu>
|
||||
#include<QAction>
|
||||
#include<QVBoxLayout>
|
||||
#include<QDockWidget>
|
||||
#include<QWidget>
|
||||
#include<memory>
|
||||
#include"KeyManagementWindow.h"
|
||||
#include"PasswordManagementWindow.h"
|
||||
#include"CommonWindow.h"
|
||||
#include"KeyManagementWindow.h"
|
||||
#include"SaveFile.h"
|
||||
#include"PasswordManagementWindow.h"
|
||||
|
||||
class KeyManagementWindow;
|
||||
class PasswordManagementWindow;
|
||||
class SaveFile;
|
||||
|
||||
|
||||
class MainWindow : public QMainWindow, public CommonWindow
|
||||
@@ -24,8 +26,10 @@ class MainWindow : public QMainWindow, public CommonWindow
|
||||
public:
|
||||
MainWindow();
|
||||
~MainWindow() = default;
|
||||
signals:
|
||||
|
||||
void refreshComboBox();
|
||||
void processEncryption();
|
||||
signals:
|
||||
private slots:
|
||||
void encryptPassword();
|
||||
void keyManagementWindow();
|
||||
@@ -37,6 +41,9 @@ private:
|
||||
void setupContentOfComboBox();
|
||||
void createMenus();
|
||||
void connections();
|
||||
void switchControlEnabling();
|
||||
void switchControls(const bool);
|
||||
void requestFilename();
|
||||
|
||||
unique_ptr<QVBoxLayout> buttonLayout;
|
||||
|
||||
@@ -45,8 +52,6 @@ private:
|
||||
unique_ptr<QDockWidget> buttonDockWidget;
|
||||
unique_ptr<QDockWidget> cryptionArea;
|
||||
|
||||
unique_ptr<QLabel> lblOfEncryptedBox;
|
||||
|
||||
unique_ptr<QTextEdit> textForCryption;
|
||||
|
||||
unique_ptr<QMenu> fileMenu;
|
||||
@@ -57,7 +62,9 @@ private:
|
||||
|
||||
unique_ptr<KeyManagementWindow> kh;
|
||||
unique_ptr<PasswordManagementWindow> ph;
|
||||
unique_ptr<SaveFile> sf;
|
||||
|
||||
std::string grabCryptionText();
|
||||
string grabCryptionText();
|
||||
bool controlsEnabled{true};
|
||||
};
|
||||
#endif
|
||||
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
#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
|
||||
@@ -0,0 +1,55 @@
|
||||
######################################################################
|
||||
# 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,8 +1,19 @@
|
||||
#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"
|
||||
|
||||
PasswordManagementWindow::PasswordManagementWindow(QWidget* parent) : QDialog(parent)
|
||||
{
|
||||
determineAmountOfPasswords();
|
||||
setupWindow();
|
||||
populatePass();
|
||||
}
|
||||
|
||||
void PasswordManagementWindow::setupWindow()
|
||||
@@ -11,12 +22,28 @@ void PasswordManagementWindow::setupWindow()
|
||||
windowHeight=450;
|
||||
|
||||
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};
|
||||
actionButton=unique_ptr<QPushButton>{new QPushButton{"i3"}};
|
||||
closeButton=unique_ptr<QPushButton>{new QPushButton{"close"}};
|
||||
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};
|
||||
subLayoutOne=unique_ptr<QVBoxLayout>{new QVBoxLayout};
|
||||
subLayoutTwo=unique_ptr<QVBoxLayout>{new QVBoxLayout};
|
||||
@@ -37,14 +64,108 @@ void PasswordManagementWindow::setupWindow()
|
||||
mainLayout.get()->addLayout(subLayoutTwo.get());
|
||||
|
||||
setLayout(mainLayout.get());
|
||||
}
|
||||
void PasswordManagementWindow::setupContentOfComboBox()
|
||||
{
|
||||
selectionBox.get()->clear();
|
||||
FileNameRetrieval fnr;
|
||||
fnr.retrieveFileNames();
|
||||
std::vector<std::string> fn{fnr.fileNameContainer()};
|
||||
|
||||
setFixedWidth(windowWidth);
|
||||
setFixedHeight(windowHeight);
|
||||
|
||||
connections();
|
||||
for (auto fle: fn)
|
||||
{
|
||||
QString bl{QString::fromStdString(fle)};
|
||||
selectionBox.get()->addItem(bl);
|
||||
}
|
||||
}
|
||||
void PasswordManagementWindow::connections()
|
||||
{
|
||||
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::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,10 +1,14 @@
|
||||
#ifndef PASSWORDMANAGEMENTWINDOW_H_
|
||||
#define PASSWORDMANAGEMENTWINDOW_H_
|
||||
|
||||
#include<QDialog>
|
||||
#include<vector>
|
||||
#include"CommonWindow.h"
|
||||
#include"ViewingWindow.h"
|
||||
|
||||
#include"SaveFile.h"
|
||||
|
||||
using std::vector;
|
||||
|
||||
class PasswordManagementWindow : public QDialog, public CommonWindow, public ViewingWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -12,12 +16,20 @@ public:
|
||||
PasswordManagementWindow(QWidget* parent=0);
|
||||
~PasswordManagementWindow()=default;
|
||||
|
||||
void setupContentOfComboBox();
|
||||
void populatePass();
|
||||
void updateElementView();
|
||||
private:
|
||||
void setupWindow();
|
||||
void setupLayouts();
|
||||
void connections();
|
||||
void determineAmountOfPasswords();
|
||||
|
||||
unique_ptr<QLineEdit> passwordField;
|
||||
unique_ptr<vector<QTableWidgetItem*>> z;
|
||||
int amountOfPasswords;
|
||||
private slots:
|
||||
void exitApplication();
|
||||
void testTableView();
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
#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
@@ -0,0 +1,33 @@
|
||||
#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
|
||||
@@ -0,0 +1,84 @@
|
||||
#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
|
||||
@@ -1,96 +0,0 @@
|
||||
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 ""
|
||||
|
||||
./encryptedmessaging $rootprojectdirectory
|
||||
/usr/bin/PasswordEncryption $rootprojectdirectory
|
||||
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
make
|
||||
sudo cp -f encryptedstart.sh /usr/bin
|
||||
sudo cp -f PasswordEncryption /usr/bin
|
||||
@@ -0,0 +1,127 @@
|
||||
/****************************************************************************
|
||||
** 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
|
||||
@@ -0,0 +1,134 @@
|
||||
/****************************************************************************
|
||||
** 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
|
||||
@@ -0,0 +1,123 @@
|
||||
/****************************************************************************
|
||||
** 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
@@ -0,0 +1,389 @@
|
||||
#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