Botan 1.10.17

cascade.h
Go to the documentation of this file.
1 /*
2 * Block Cipher Cascade
3 * (C) 2010 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #ifndef BOTAN_CASCADE_H__
9 #define BOTAN_CASCADE_H__
10
11 #include <botan/block_cipher.h>
12
13 namespace Botan {
14
15 /**
16 * Block Cipher Cascade
17 */
18 class BOTAN_DLL Cascade_Cipher : public BlockCipher
19 {
20 public:
21 void encrypt_n(const byte in[], byte out[], size_t blocks) const;
22 void decrypt_n(const byte in[], byte out[], size_t blocks) const;
23
24 size_t block_size() const { return block; }
25
26 Key_Length_Specification key_spec() const
27 {
28 return Key_Length_Specification(cipher1->maximum_keylength() +
29 cipher2->maximum_keylength());
30 }
31
32 void clear();
33 std::string name() const;
34 BlockCipher* clone() const;
35
36 /**
37 * Create a cascade of two block ciphers
38 * @param cipher1 the first cipher
39 * @param cipher2 the second cipher
40 */
41 Cascade_Cipher(BlockCipher* cipher1, BlockCipher* cipher2);
42
43 ~Cascade_Cipher();
44 private:
45 void key_schedule(const byte[], size_t);
46
47 size_t block;
48 BlockCipher* cipher1;
49 BlockCipher* cipher2;
50 };
51
52
53 }
54
55 #endif
Botan::Key_Length_Specification
Definition: key_spec.h:18
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::Cascade_Cipher
Definition: cascade.h:18
Botan::Cascade_Cipher::key_spec
Key_Length_Specification key_spec() const
Definition: cascade.h:26
Botan
Definition: algo_base.h:14
Botan::Cascade_Cipher::block_size
size_t block_size() const
Definition: cascade.h:24
Botan::BlockCipher
Definition: block_cipher.h:18