diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-11-28 17:39:09 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-11-28 17:39:09 +0000 |
commit | 03e8c5ad314252cde58c53688c70b9f836a1d5b4 (patch) | |
tree | 6d26558aaae5e3758ca8b23c4086116e6d6b2636 /src/unstable/ciphermodeecb.h | |
parent | 223e2986ad7752d38ce24d1cbeff47db98df1ae3 (diff) | |
download | libbu++-03e8c5ad314252cde58c53688c70b9f836a1d5b4.tar.gz libbu++-03e8c5ad314252cde58c53688c70b9f836a1d5b4.tar.bz2 libbu++-03e8c5ad314252cde58c53688c70b9f836a1d5b4.tar.xz libbu++-03e8c5ad314252cde58c53688c70b9f836a1d5b4.zip |
More comments; moved the encryption system to unstable.
Diffstat (limited to 'src/unstable/ciphermodeecb.h')
-rw-r--r-- | src/unstable/ciphermodeecb.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/unstable/ciphermodeecb.h b/src/unstable/ciphermodeecb.h new file mode 100644 index 0000000..c4a7f23 --- /dev/null +++ b/src/unstable/ciphermodeecb.h | |||
@@ -0,0 +1,40 @@ | |||
1 | #ifndef BU_MODE_ECB_H | ||
2 | #define BU_MODE_ECB_H | ||
3 | |||
4 | namespace Bu | ||
5 | { | ||
6 | /** | ||
7 | * Electronic Code Book mode. This cipher mode is the simplest, it's | ||
8 | * effectively a pass-through mode. It's the same as using the encryption | ||
9 | * scheme without a mode, but at least you absolutely know that you've got | ||
10 | * the correct mode. I recommend using this instead of the raw mode if for | ||
11 | * no other reason than it makes your code more self-documenting, and with | ||
12 | * optomization shouldn't add any extra calls to your code. | ||
13 | */ | ||
14 | template<int iBlockSize, typename CipherType> | ||
15 | class CipherModeEcb : public CipherType | ||
16 | { | ||
17 | public: | ||
18 | CipherModeEcb( class Stream &rNext ) : | ||
19 | CipherType( rNext ) | ||
20 | { | ||
21 | } | ||
22 | |||
23 | virtual ~CipherModeEcb() | ||
24 | { | ||
25 | } | ||
26 | |||
27 | protected: | ||
28 | virtual void decipher( void *pBuf ) | ||
29 | { | ||
30 | CipherType::decipher( pBuf ); | ||
31 | } | ||
32 | |||
33 | virtual void encipher( void *pBuf ) | ||
34 | { | ||
35 | CipherType::encipher( pBuf ); | ||
36 | } | ||
37 | }; | ||
38 | }; | ||
39 | |||
40 | #endif | ||