A bit of cleanup

This commit is contained in:
Leonetienne
2022-05-27 16:44:42 +02:00
parent b0d0f831d9
commit 5365233b43
7 changed files with 82 additions and 60 deletions

View File

@@ -1,4 +1,4 @@
#include "ModuleDataFormatter.h"
#include "DataFormatter.h"
#include "Bases.h"
#include <GeneralUtility/BaseConversion.h>
#include <StringTools/StringTools.h>
@@ -8,7 +8,7 @@ using namespace Leonetienne::GCrypt;
using namespace Leonetienne::StringTools;
using namespace Leonetienne::GeneralUtility;
std::string ModuleDataFormatter::FormatBlock(
std::string DataFormatter::FormatBlock(
const Block& block,
const Configuration::IOBASE_FORMAT base
) {
@@ -64,7 +64,7 @@ std::string ModuleDataFormatter::FormatBlock(
}
}
std::string ModuleDataFormatter::FormatBlocks(
std::string DataFormatter::FormatBlocks(
const std::vector<Block>& blocks,
const Configuration::IOBASE_FORMAT base
) {
@@ -89,7 +89,7 @@ std::string ModuleDataFormatter::FormatBlocks(
return ss.str();
}
Block ModuleDataFormatter::DecodeFormat(
Block DataFormatter::DecodeFormat(
const std::string& str,
const Configuration::IOBASE_FORMAT base
) {
@@ -163,7 +163,7 @@ Block ModuleDataFormatter::DecodeFormat(
return b;
}
std::vector<Block> ModuleDataFormatter::DecodeFormatMultiblock(
std::vector<Block> DataFormatter::DecodeFormatMultiblock(
const std::string& str,
const Configuration::IOBASE_FORMAT base
) {
@@ -238,7 +238,7 @@ std::vector<Block> ModuleDataFormatter::DecodeFormatMultiblock(
}
default:
throw std::invalid_argument("ModuleDataFormatter::StringToBlocks() has been passed an unknown base! No switch-case matched!");
throw std::invalid_argument("DataFormatter::StringToBlocks() has been passed an unknown base! No switch-case matched!");
break;
}
@@ -246,7 +246,7 @@ std::vector<Block> ModuleDataFormatter::DecodeFormatMultiblock(
return blocks;
}
std::string ModuleDataFormatter::Bin2CustomBase(
std::string DataFormatter::Bin2CustomBase(
const std::string& bin,
const std::vector<std::string>& customSet,
const std::size_t minLen,
@@ -275,7 +275,7 @@ std::string ModuleDataFormatter::Bin2CustomBase(
return ss.str();
}
std::string ModuleDataFormatter::CustomBase2Bin(
std::string DataFormatter::CustomBase2Bin(
const std::string& in,
const std::vector<std::string>& customSet,
const std::string& seperator
@@ -293,7 +293,7 @@ std::string ModuleDataFormatter::CustomBase2Bin(
);
if (binary.length() != Block::BLOCK_SIZE_BITS) {
throw std::invalid_argument("ModuleDataFormatter::CustomBase2Bin() received input that doesn't translate to a bitstring of length 512!");
throw std::invalid_argument("DataFormatter::CustomBase2Bin() received input that doesn't translate to a bitstring of length 512!");
}
return binary;

View File

@@ -1,4 +1,4 @@
#include "ModulePrepareKey.h"
#include "KeyManager.h"
#include "CommandlineInterface.h"
#include "Configuration.h"
#include <cstring>
@@ -12,7 +12,7 @@
#include <unistd.h>
#endif
void ModulePrepareKey::PrepareKey() {
void KeyManager::PrepareKey() {
// Special-case: We are hashing:
// no key needed.
@@ -67,11 +67,11 @@ void ModulePrepareKey::PrepareKey() {
}
const Key& ModulePrepareKey::GetKey() {
const Key& KeyManager::GetKey() {
return key;
}
std::string ModulePrepareKey::PasswordPrompt() {
std::string KeyManager::PasswordPrompt() {
// Disable stdin-echo
#if defined _WIN32 || defined _WIN64
HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
@@ -103,5 +103,5 @@ std::string ModulePrepareKey::PasswordPrompt() {
return password;
}
Key ModulePrepareKey::key;
Key KeyManager::key;

View File

@@ -1,6 +1,6 @@
#include "CommandlineInterface.h"
#include "Configuration.h"
#include "ModulePrepareKey.h"
#include "KeyManager.h"
int main(int argc, char* const* argv) {
@@ -11,7 +11,7 @@ int main(int argc, char* const* argv) {
Configuration::Parse();
// Prepare the key
ModulePrepareKey::PrepareKey();
KeyManager::PrepareKey();
return 0;
}