Renamed method DigestFlexblock to CipherFlexblock, and made it public
This commit is contained in:
parent
734324ec10
commit
cf784ca8ac
@ -28,10 +28,11 @@ namespace Leonetienne::GCrypt {
|
||||
//! @filename_out The file the decrypted version should be saved in.
|
||||
static bool DecryptFile(const std::string& filename_in, const std::string& filename_out, const std::string& password, bool printProgressReport = false);
|
||||
|
||||
//! Will enncrypt or decrypt an entire flexblock of binary data, given a key.
|
||||
static Flexblock CipherFlexblock(const Flexblock& data, const Block& key, const GCipher::DIRECTION direction);
|
||||
|
||||
private:
|
||||
|
||||
//! Will digest a flexblock with a key
|
||||
static Flexblock DigestFlexblock(const Flexblock& data, const Block& key, const GCipher::DIRECTION direction);
|
||||
|
||||
// No instanciation! >:(
|
||||
GCryptWrapper();
|
||||
|
@ -12,7 +12,7 @@ namespace Leonetienne::GCrypt {
|
||||
const Flexblock cleartext_bits = StringToBits(cleartext);
|
||||
|
||||
// Encrypt our cleartext bits
|
||||
const Flexblock ciphertext_bits = DigestFlexblock(cleartext_bits, key, GCipher::DIRECTION::ENCIPHER);
|
||||
const Flexblock ciphertext_bits = CipherFlexblock(cleartext_bits, key, GCipher::DIRECTION::ENCIPHER);
|
||||
|
||||
// Recode the ciphertext bits to a hex-string
|
||||
const std::string ciphertext = BitsToHexstring(ciphertext_bits);
|
||||
@ -29,7 +29,7 @@ namespace Leonetienne::GCrypt {
|
||||
const Flexblock ciphertext_bits = HexstringToBits(ciphertext);
|
||||
|
||||
// Decrypt the ciphertext bits
|
||||
const std::string cleartext_bits = DigestFlexblock(ciphertext_bits, key, GCipher::DIRECTION::DECIPHER);
|
||||
const std::string cleartext_bits = CipherFlexblock(ciphertext_bits, key, GCipher::DIRECTION::DECIPHER);
|
||||
|
||||
// Recode the cleartext bits to an ascii-string
|
||||
const std::string cleartext = BitsToString(cleartext_bits);
|
||||
@ -47,7 +47,7 @@ namespace Leonetienne::GCrypt {
|
||||
const Block key = PasswordToKey(password);
|
||||
|
||||
// Encrypt our cleartext bits
|
||||
const Flexblock ciphertext_bits = DigestFlexblock(cleartext_bits, key, GCipher::DIRECTION::ENCIPHER);
|
||||
const Flexblock ciphertext_bits = CipherFlexblock(cleartext_bits, key, GCipher::DIRECTION::ENCIPHER);
|
||||
|
||||
// Write our ciphertext bits to file
|
||||
WriteBitsToFile(filename_out, ciphertext_bits);
|
||||
@ -68,7 +68,7 @@ namespace Leonetienne::GCrypt {
|
||||
const Block key = PasswordToKey(password);
|
||||
|
||||
// Decrypt the ciphertext bits
|
||||
const Flexblock cleartext_bits = DigestFlexblock(ciphertext_bits, key, GCipher::DIRECTION::DECIPHER);
|
||||
const Flexblock cleartext_bits = CipherFlexblock(ciphertext_bits, key, GCipher::DIRECTION::DECIPHER);
|
||||
|
||||
// Write our cleartext bits to file
|
||||
WriteBitsToFile(filename_out, cleartext_bits);
|
||||
@ -80,7 +80,11 @@ namespace Leonetienne::GCrypt {
|
||||
}
|
||||
}
|
||||
|
||||
Flexblock GCryptWrapper::DigestFlexblock(const Flexblock& data, const Block& key, const GCipher::DIRECTION direction) {
|
||||
Flexblock GCryptWrapper::CipherFlexblock(
|
||||
const Flexblock& data,
|
||||
const Block& key,
|
||||
const GCipher::DIRECTION direction)
|
||||
{
|
||||
// Split input into blocks
|
||||
std::vector<Block> blocks;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user