Added a FeistelManager to en/decipher arbitrarily long messages using cipher block chaining
This commit is contained in:
19
main.cpp
19
main.cpp
@@ -1,10 +1,27 @@
|
||||
#pragma once
|
||||
#include <iostream>
|
||||
#include "Util.h"
|
||||
#include "Feistel.h"
|
||||
#include "FeistelMan.h"
|
||||
|
||||
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;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user