aboutsummaryrefslogtreecommitdiff
path: root/src/experimental/blowfish.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-04-09 16:29:18 +0000
committerMike Buland <eichlan@xagasoft.com>2012-04-09 16:29:18 +0000
commit228b885b41652a015a91770dfd993456d76ad102 (patch)
tree9a4b0756133fa1b7553f9aacf9ad50e7f26179d8 /src/experimental/blowfish.h
parentb93f18e1dd303fb648bc350416f7f5ace536fd1f (diff)
downloadlibbu++-228b885b41652a015a91770dfd993456d76ad102.tar.gz
libbu++-228b885b41652a015a91770dfd993456d76ad102.tar.bz2
libbu++-228b885b41652a015a91770dfd993456d76ad102.tar.xz
libbu++-228b885b41652a015a91770dfd993456d76ad102.zip
Blowfish works in it's new split form, which will make it much easier to add
other types of ciphers down the road, should we choose to.
Diffstat (limited to 'src/experimental/blowfish.h')
-rw-r--r--src/experimental/blowfish.h17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/experimental/blowfish.h b/src/experimental/blowfish.h
index 054fc82..4dbd637 100644
--- a/src/experimental/blowfish.h
+++ b/src/experimental/blowfish.h
@@ -1,7 +1,7 @@
1#ifndef BU_BLOWFISH_H 1#ifndef BU_BLOWFISH_H
2#define BU_BLOWFISH_H 2#define BU_BLOWFISH_H
3 3
4#include "bu/filter.h" 4#include "bu/cipher.h"
5 5
6#define NUM_SUBKEYS 18 6#define NUM_SUBKEYS 18
7#define NUM_S_BOXES 4 7#define NUM_S_BOXES 4
@@ -12,7 +12,7 @@
12 12
13namespace Bu 13namespace Bu
14{ 14{
15 class Blowfish : public Bu::Filter 15 class Blowfish : public Bu::Cipher
16 { 16 {
17 public: 17 public:
18 Blowfish( Bu::Stream &rNext ); 18 Blowfish( Bu::Stream &rNext );
@@ -20,14 +20,6 @@ namespace Bu
20 20
21 void setPassword( const Bu::String &sPass ); 21 void setPassword( const Bu::String &sPass );
22 22
23 virtual void start();
24 virtual Bu::size stop();
25
26 virtual Bu::size read( void *pBuf, Bu::size iBytes );
27 virtual Bu::size write( const void *pBuf, Bu::size iBytes );
28 using Bu::Stream::read;
29 using Bu::Stream::write;
30
31 private: 23 private:
32 uint32_t PA[NUM_SUBKEYS]; 24 uint32_t PA[NUM_SUBKEYS];
33 uint32_t SB[NUM_S_BOXES][NUM_ENTRIES]; 25 uint32_t SB[NUM_S_BOXES][NUM_ENTRIES];
@@ -65,8 +57,9 @@ namespace Bu
65 }; 57 };
66 58
67 void reset(); 59 void reset();
68 inline void BF_En( Word *, Word * ); 60 virtual void encipher( void *pData );
69 inline void BF_De( Word *, Word * ); 61 virtual void decipher( void *pData );
62 inline void keyEncipher( Word &w1, Word &w2 );
70 }; 63 };
71}; 64};
72 65