From d49fc3aeac4daa65416751f94943b6611ad247d3 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 10 Apr 2012 08:32:23 +0000 Subject: Rearranged the Cipher system, and added four modes of operation. It's pretty slick, really, and we actually support four of the most common modes. Blowfish is still a template, but it doesn't really need to be anymore... --- src/tests/blowfish.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/tests') diff --git a/src/tests/blowfish.cpp b/src/tests/blowfish.cpp index c7486e1..293539d 100644 --- a/src/tests/blowfish.cpp +++ b/src/tests/blowfish.cpp @@ -4,6 +4,8 @@ #include #include #include +#include +#include using namespace Bu; @@ -50,13 +52,13 @@ int main( int argc, char *argv[] ) for( int j = 0; j < 34; j++ ) { MemBuf mb; - Blowfish bf( mb ); + BlowfishEcb bf( mb ); bf.setPassword( decodeStr( testdat[j][0] ) ); bf.write( decodeStr( testdat[j][1] ) ); sio << "Test " << j << ": " << (mb.getString() == decodeStr( testdat[j][2] )) << " (" << encodeStr( mb.getString(), true ) << " == " << testdat[j][2] << ")" << sio.nl; mb.setPos( 0 ); - Blowfish bf2( mb ); + BlowfishEcb bf2( mb ); bf2.setPassword( decodeStr( testdat[j][0] ) ); char buf[8]; bf2.read( buf, 8 ); @@ -64,29 +66,27 @@ int main( int argc, char *argv[] ) sio << " - Back: " << (Bu::String(testdat[j][1]) == encodeStr(String(buf,8),true)) << sio.nl; } - /* { File fIn("data.plain", File::Read ); File fOut("data.crypt", File::WriteNew ); - Blowfish bOut( fOut ); + BlowfishOfb bOut( fOut ); + bOut.setIv("01234567"); bOut.setPassword("abcdefghijklmnop"); bOut.write( fIn.readAll() ); } - */ - /* { File fIn("data.java", File::Read ); File fOut("data.stuff", File::WriteNew ); - Blowfish bIn( fIn ); + BlowfishOfb bIn( fIn ); + bIn.setIv("01234567"); bIn.setPassword("abcdefghijklmnop"); char buf[64]; bIn.read( buf, 64 ); fOut.write( buf, 64 ); sio << sio.nl << "All done." << sio.nl; } - */ return 0; } -- cgit v1.2.3