From 2c6cbad869b0e60b37859c3c4f0c850721d057ce Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Sat, 7 Apr 2012 18:01:20 +0000 Subject: Basic blowfish encryption filter. It needs to be silghtly more clever. I'm going to steal the extra cleverness from the AesFilter in fishtrax. --- src/experimental/blowfish.cpp | 444 ++++++++++++++++++++++++++++++++++++++++++ src/experimental/blowfish.h | 73 +++++++ 2 files changed, 517 insertions(+) create mode 100644 src/experimental/blowfish.cpp create mode 100644 src/experimental/blowfish.h (limited to 'src/experimental') diff --git a/src/experimental/blowfish.cpp b/src/experimental/blowfish.cpp new file mode 100644 index 0000000..401291c --- /dev/null +++ b/src/experimental/blowfish.cpp @@ -0,0 +1,444 @@ +#include "bu/blowfish.h" + +#include "bu/sio.h" + +using Bu::sio; + +#define F(x) \ + (((SB[0][x.byte.zero] + SB[1][x.byte.one]) ^ SB[2][x.byte.two]) + \ + SB[3][x.byte.three]) + +Bu::Blowfish::Blowfish( Bu::Stream &rNext ) : + Bu::Filter( rNext ) +{ +} + +Bu::Blowfish::~Blowfish() +{ + reset(); +} + +void Bu::Blowfish::setPassword( const Bu::String &sPass ) +{ + reset(); + + unsigned int i,j,len=sPass.getSize(); + Word Work,null0,null1; + + if (len > 0) + { + j = 0; + for (i=0;i