aboutsummaryrefslogtreecommitdiff
path: root/src/unstable/ciphermodeecb.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/unstable/ciphermodeecb.h')
-rw-r--r--src/unstable/ciphermodeecb.h40
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
4namespace 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