Added multiblocks methods to data formatter

This commit is contained in:
Leonetienne
2022-05-27 03:00:34 +02:00
parent 8e04e91e88
commit 2ecf0cc427
3 changed files with 135 additions and 25 deletions

View File

@@ -4,6 +4,7 @@
#include "ModuleDataFormatter.h"
#include "Bases.h"
#include <iostream>
#include <GCrypt/Util.h>
int main(int argc, char* const* argv) {
@@ -16,11 +17,25 @@ int main(int argc, char* const* argv) {
// Prepare the key
ModulePrepareKey::PrepareKey();
Block block;
block.FromTextString("Hello World :3");
std::cout << block.ToBinaryString() << std::endl << std::endl;
std::cout << block.ToHexString() << std::endl << std::endl;
const std::vector<Block> textblocks = StringToBitblocks("Hansel and Gretel are a brother and sister abandoned in a forest, where they fall into the hands of a witch who lives in a house made of gingerbread, cake, and candy. The cannibalistic witch intends to fatten the children before eventually eating them, but Gretel outwits the witch and kills her. The two children then escape with their lives and return home with the witch's treasure.");
const std::string formattedBlocks =
ModuleDataFormatter::FormatBlocks(
textblocks,
Configuration::iobaseFormat
);
std::cout << "Formatted: " << formattedBlocks << std::endl << std::endl;
const std::vector<Block> retrievedBlocks =
ModuleDataFormatter::StringToBlocks(
formattedBlocks,
Configuration::iobaseFormat
);
const std::string retrievedText = BitblocksToString(retrievedBlocks);
std::cout << "Retrieved: " << retrievedText << std::endl << std::endl;
return 0;
/*
Block all1;
@@ -77,8 +92,7 @@ int main(int argc, char* const* argv) {
std::cout
<< ModuleDataFormatter::StringToBlock(
ModuleDataFormatter::FormatBlock(
//ModulePrepareKey::GetKey(),
block,
ModulePrepareKey::GetKey(),
Configuration::iobaseFormat
),
Configuration::iobaseFormat