#include <vector>
#include <iostream>

#include "blowfish.h"
#include "filters.h"
#include "eax.h"

#pragma comment (lib, "cryptlib")

using namespace CryptoPP;

int main()
{
    //bp for these
    std::vector<uint8_t> key = { 
        0xD8, 0xF9, 0x7D, 0x3A, 
        0x78, 0x4E, 0x09, 0xE0, 
        0xFA, 0x1A, 0xD5, 0x79, 
        0x22, 0x12, 0x6A, 0x87 };

    std::vector<uint8_t> iv = {
        0x48, 0x2D, 0x60, 0x0D,
        0x60, 0x61, 0x63, 0x6C };

    std::vector<char> encoded = { -107, 28, -36, -53, 35, 49, -80, 13, -20, -04, -87, 39, -93, -122, 39, 20, -86, 95, 125, 76, -46, 21, 55, -47, -02, -94, 73, 21, 109, -69, 16, -96 };

    //solution
    std::string encoded_string(encoded.begin(), encoded.end());
    std::string decrypted_string = "";

    EAX<Blowfish>::Decryption decryption;
    decryption.SetKeyWithIV(key.data(), key.size(), iv.data());

    StringSource ss(encoded_string, true, new AuthenticatedDecryptionFilter(decryption, new StringSink(decrypted_string)));

    //prints "keiths_lit_fish_13FA3BFE"
    std::cout << decrypted_string << std::endl;

    return 0;
}

results matching ""

    No results matching ""