From bb76cbb2d7a9abf2b354542f3f1e89f8501592aa Mon Sep 17 00:00:00 2001 From: Leonetienne Date: Sun, 22 May 2022 13:07:40 +0200 Subject: [PATCH] Renamed class GCryptWrapper to GWrapper --- GCryptLib/exec/main.cpp | 10 +++++----- .../include/GCrypt/{GCryptWrapper.h => GWrapper.h} | 5 ++--- GCryptLib/src/{GCryptWrapper.cpp => GWrapper.cpp} | 12 ++++++------ 3 files changed, 13 insertions(+), 14 deletions(-) rename GCryptLib/include/GCrypt/{GCryptWrapper.h => GWrapper.h} (97%) rename GCryptLib/src/{GCryptWrapper.cpp => GWrapper.cpp} (82%) diff --git a/GCryptLib/exec/main.cpp b/GCryptLib/exec/main.cpp index d53da03..5f9d3dc 100644 --- a/GCryptLib/exec/main.cpp +++ b/GCryptLib/exec/main.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include #include @@ -14,11 +14,11 @@ void ExampleString() { std::cout << input << std::endl; // Encrypt - const std::string encrypted = GCryptWrapper::EncryptString(input, "password1"); + const std::string encrypted = GWrapper::EncryptString(input, "password1"); std::cout << encrypted << std::endl; // Decrypt - const std::string decrypted = GCryptWrapper::DecryptString(encrypted, "password1"); + const std::string decrypted = GWrapper::DecryptString(encrypted, "password1"); std::cout << decrypted << std::endl; return; @@ -28,10 +28,10 @@ void ExampleFiles() { std::cout << "Example on how to encrypt & decrypt any file:" << std::endl; // Encrypt - GCryptWrapper::EncryptFile("main.cpp", "main.cpp.crypt", "password1"); + GWrapper::EncryptFile("main.cpp", "main.cpp.crypt", "password1"); // Decrypt - GCryptWrapper::DecryptFile("main.cpp.crypt", "main.cpp.clear", "password1"); + GWrapper::DecryptFile("main.cpp.crypt", "main.cpp.clear", "password1"); return; } diff --git a/GCryptLib/include/GCrypt/GCryptWrapper.h b/GCryptLib/include/GCrypt/GWrapper.h similarity index 97% rename from GCryptLib/include/GCrypt/GCryptWrapper.h rename to GCryptLib/include/GCrypt/GWrapper.h index bf56ada..edd984b 100644 --- a/GCryptLib/include/GCrypt/GCryptWrapper.h +++ b/GCryptLib/include/GCrypt/GWrapper.h @@ -8,7 +8,7 @@ namespace Leonetienne::GCrypt { /** This class is a wrapper to make working with the GhettoCipher * super easy with a python-like syntax */ - class GCryptWrapper { + class GWrapper { public: //! Will encrypt a string and return it hexadecimally encoded. static std::string EncryptString(const std::string& cleartext, const std::string& password); @@ -33,9 +33,8 @@ namespace Leonetienne::GCrypt { private: - // No instanciation! >:( - GCryptWrapper(); + GWrapper(); }; } diff --git a/GCryptLib/src/GCryptWrapper.cpp b/GCryptLib/src/GWrapper.cpp similarity index 82% rename from GCryptLib/src/GCryptWrapper.cpp rename to GCryptLib/src/GWrapper.cpp index 9161f0a..386476a 100644 --- a/GCryptLib/src/GCryptWrapper.cpp +++ b/GCryptLib/src/GWrapper.cpp @@ -1,10 +1,10 @@ -#include "GCrypt/GCryptWrapper.h" +#include "GCrypt/GWrapper.h" #include "GCrypt/GCipher.h" #include "GCrypt/Util.h" namespace Leonetienne::GCrypt { - std::string GCryptWrapper::EncryptString(const std::string& cleartext, const std::string& password) { + std::string GWrapper::EncryptString(const std::string& cleartext, const std::string& password) { // Transform the password to a key const Block key = PasswordToKey(password); @@ -21,7 +21,7 @@ namespace Leonetienne::GCrypt { return ciphertext; } - std::string GCryptWrapper::DecryptString(const std::string& ciphertext, const std::string& password) { + std::string GWrapper::DecryptString(const std::string& ciphertext, const std::string& password) { // Transform the password to a key const Block key = PasswordToKey(password); @@ -38,7 +38,7 @@ namespace Leonetienne::GCrypt { return cleartext; } - bool GCryptWrapper::EncryptFile(const std::string& filename_in, const std::string& filename_out, const std::string& password, bool printProgressReport) { + bool GWrapper::EncryptFile(const std::string& filename_in, const std::string& filename_out, const std::string& password, bool printProgressReport) { try { // Read the file to bits const Flexblock cleartext_bits = ReadFileToBits(filename_in); @@ -59,7 +59,7 @@ namespace Leonetienne::GCrypt { } } - bool GCryptWrapper::DecryptFile(const std::string& filename_in, const std::string& filename_out, const std::string& password, bool printProgressReport) { + bool GWrapper::DecryptFile(const std::string& filename_in, const std::string& filename_out, const std::string& password, bool printProgressReport) { try { // Read the file to bits const Flexblock ciphertext_bits = ReadFileToBits(filename_in); @@ -80,7 +80,7 @@ namespace Leonetienne::GCrypt { } } - Flexblock GCryptWrapper::CipherFlexblock( + Flexblock GWrapper::CipherFlexblock( const Flexblock& data, const Block& key, const GCipher::DIRECTION direction)