Hi Gordon,

Taking from vaildat1.cpp ;)

Jeff

bool ValidateBlowfish()
{
        cout << "\nBlowfish validation suite running...\n\n";

        HexEncoder output(new FileSink(cout));
        char *key[]={"abcdefghijklmnopqrstuvwxyz", "Who is John
Galt?"};
        byte *plain[]={(byte *)"BLOWFISH", (byte
*)"\xfe\xdc\xba\x98\x76\x54\x32\x10"};
        byte *cipher[]={(byte *)"\x32\x4e\xd0\xfe\xf4\x13\xa2\x03",
(byte *)"\xcc\x91\x73\x2b\x80\x22\xf6\x84"};
        byte out[8], outplain[8];
        bool pass=true, fail;

        for (int i=0; i<2; i++)
        {
                ECB_Mode<Blowfish>::Encryption enc((byte *)key[i],
strlen(key[i]));
                enc.ProcessData(out, plain[i], 8);
                fail = memcmp(out, cipher[i], 8) != 0;

                ECB_Mode<Blowfish>::Decryption dec((byte *)key[i],
strlen(key[i]));
                dec.ProcessData(outplain, cipher[i], 8);
                fail = fail || memcmp(outplain, plain[i], 8);
                pass = pass && !fail;

                cout << (fail ? "FAILED    " : "passed    ");
                cout << '\"' << key[i] << '\"';
                for (int j=0; j<(signed int)(30-strlen(key[i])); j++)
                        cout << ' ';
                output.Put(outplain, 8);
                cout << "  ";
                output.Put(out, 8);
                cout << endl;
        }
        return pass;
}

>>> [EMAIL PROTECTED] 2/9/2006 1:39 PM >>>
Hi,

I am a newbie with CryptoPP and I want to use blowfish algorithm

but I don't know how

because there is no example source code to learn how to use blowfish
with
CryptoPP :(

can you help me ?

thanks




Reply via email to