2021-12-05 22:40:36 +01:00
|
|
|
#pragma once
|
2021-12-05 15:47:31 +01:00
|
|
|
#include <iostream>
|
2021-12-05 22:40:36 +01:00
|
|
|
#include "Util.h"
|
2021-12-06 02:09:03 +01:00
|
|
|
#include "GhettoCipherWrapper.h"
|
2021-12-05 17:50:17 +01:00
|
|
|
|
2021-12-06 02:20:47 +01:00
|
|
|
using namespace GhettoCipher;
|
|
|
|
|
2021-12-06 02:09:03 +01:00
|
|
|
void ExampleString()
|
2021-12-05 15:47:31 +01:00
|
|
|
{
|
2021-12-06 02:09:03 +01:00
|
|
|
std::cout << "Example on how to encrypt & decrypt a string:" << std::endl;
|
2021-12-06 01:33:55 +01:00
|
|
|
|
2021-12-06 02:09:03 +01:00
|
|
|
// Get some string
|
|
|
|
const std::string input = "I am a super secret message!";
|
|
|
|
std::cout << input << std::endl;
|
2021-12-06 00:39:58 +01:00
|
|
|
|
2021-12-06 02:09:03 +01:00
|
|
|
// Encrypt
|
2021-12-06 02:20:47 +01:00
|
|
|
const std::string encrypted = GhettoCryptWrapper::EncryptString(input, "password1");
|
2021-12-06 02:09:03 +01:00
|
|
|
std::cout << encrypted << std::endl;
|
2021-12-06 00:39:58 +01:00
|
|
|
|
2021-12-06 02:09:03 +01:00
|
|
|
// Decrypt
|
2021-12-06 02:20:47 +01:00
|
|
|
const std::string decrypted = GhettoCryptWrapper::DecryptString(encrypted, "password1");
|
2021-12-06 02:09:03 +01:00
|
|
|
std::cout << decrypted << std::endl;
|
2021-12-06 00:39:58 +01:00
|
|
|
|
2021-12-06 02:09:03 +01:00
|
|
|
return;
|
|
|
|
}
|
2021-12-06 00:39:58 +01:00
|
|
|
|
2021-12-06 02:09:03 +01:00
|
|
|
void ExampleFiles()
|
|
|
|
{
|
|
|
|
std::cout << "Example on how to encrypt & decrypt any file:" << std::endl;
|
2021-12-06 00:39:58 +01:00
|
|
|
|
2021-12-06 02:09:03 +01:00
|
|
|
// Encrypt
|
2021-12-06 02:20:47 +01:00
|
|
|
GhettoCryptWrapper::EncryptFile("main.cpp", "main.cpp.crypt", "password1");
|
2021-12-06 00:39:58 +01:00
|
|
|
|
|
|
|
// Decrypt
|
2021-12-06 02:20:47 +01:00
|
|
|
GhettoCryptWrapper::DecryptFile("main.cpp.crypt", "main.cpp.clear", "password1");
|
2021-12-06 02:09:03 +01:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
ExampleString();
|
|
|
|
ExampleFiles();
|
2021-12-05 19:26:58 +01:00
|
|
|
|
2021-12-05 22:40:36 +01:00
|
|
|
return 0;
|
2021-12-05 19:26:58 +01:00
|
|
|
}
|