Botan: src/block/lion/lion.h Source File

Botan 1.10.16

lion.h
Go to the documentation of this file.
1 /*
2 * Lion
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #ifndef BOTAN_LION_H__
9 #define BOTAN_LION_H__
10
11 #include <botan/block_cipher.h>
12 #include <botan/stream_cipher.h>
13 #include <botan/hash.h>
14
15 namespace Botan {
16
17 /**
18 * Lion is a block cipher construction designed by Ross Anderson and
19 * Eli Biham, described in "Two Practical and Provably Secure Block
20 * Ciphers: BEAR and LION". It has a variable block size and is
21 * designed to encrypt very large blocks (up to a megabyte)
22
23 * http://www.cl.cam.ac.uk/~rja14/Papers/bear-lion.pdf
24 */
25 class BOTAN_DLL Lion : public BlockCipher
26 {
27 public:
28 void encrypt_n(const byte in[], byte out[], size_t blocks) const;
29 void decrypt_n(const byte in[], byte out[], size_t blocks) const;
30
31 size_t block_size() const { return BLOCK_SIZE; }
32
33 Key_Length_Specification key_spec() const
34 {
35 return Key_Length_Specification(2, 2*hash->output_length(), 2);
36 }
37
38 void clear();
39 std::string name() const;
40 BlockCipher* clone() const;
41
42 /**
43 * @param hash the hash to use internally
44 * @param cipher the stream cipher to use internally
45 * @param block_size the size of the block to use
46 */
47 Lion(HashFunction* hash,
48 StreamCipher* cipher,
49 size_t block_size);
50
51 ~Lion() { delete hash; delete cipher; }
52 private:
53 void key_schedule(const byte[], size_t);
54
55 const size_t BLOCK_SIZE, LEFT_SIZE, RIGHT_SIZE;
56
57 HashFunction* hash;
58 StreamCipher* cipher;
59 SecureVector<byte> key1, key2;
60 };
61
62 }
63
64 #endif
Botan::Lion::key_spec
Key_Length_Specification key_spec() const
Definition: lion.h:33
Botan::Key_Length_Specification
Definition: key_spec.h:18
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::Lion::~Lion
~Lion()
Definition: lion.h:51
Botan::StreamCipher
Definition: stream_cipher.h:18
Botan::Lion
Definition: lion.h:25
Botan
Definition: algo_base.h:14
Botan::HashFunction
Definition: hash.h:20
Botan::SecureVector< byte >
Botan::Lion::block_size
size_t block_size() const
Definition: lion.h:31
Botan::BlockCipher
Definition: block_cipher.h:18