GCrypt/main.cpp

28 lines
682 B
C++
Raw Normal View History

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"
#include "FeistelMan.h"
2021-12-05 17:50:17 +01:00
2021-12-05 15:47:31 +01:00
int main()
{
FeistelMan feistel("Password yo");
const std::string message = "I am a veeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeery long message!";
std::cout << "Cleartext: " << message << std::endl;
// Encrypt
const Flexblock ciphertext = feistel.Encipher(StringToBits(message));
const std::string cipherHex = BitsToHexstring(ciphertext);
std::cout << "Ciphertext: " << cipherHex << std::endl;
// Decrypt
const Flexblock cleartextBits = feistel.Decipher(HexstringToBits(cipherHex));
std::cout << "Decrypted: " << BitsToString(cleartextBits) << std::endl;
2021-12-05 22:40:36 +01:00
return 0;
}