Botan  1.10.9
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 
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
size_t block_size() const
Definition: cascade.h:24
unsigned char byte
Definition: types.h:22
Key_Length_Specification key_spec() const
Definition: cascade.h:26