Botan 1.10.17

lubyrack.h
Go to the documentation of this file.
1 /*
2 * Luby-Rackoff
3 * (C) 1999-2008 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #ifndef BOTAN_LUBY_RACKOFF_H__
9 #define BOTAN_LUBY_RACKOFF_H__
10
11 #include <botan/block_cipher.h>
12 #include <botan/hash.h>
13
14 namespace Botan {
15
16 /**
17 * Luby-Rackoff block cipher construction
18 */
19 class BOTAN_DLL LubyRackoff : public BlockCipher
20 {
21 public:
22 void encrypt_n(const byte in[], byte out[], size_t blocks) const;
23 void decrypt_n(const byte in[], byte out[], size_t blocks) const;
24
25 size_t block_size() const { return 2 * hash->output_length(); }
26
27 Key_Length_Specification key_spec() const
28 {
29 return Key_Length_Specification(2, 32, 2);
30 }
31
32 void clear();
33 std::string name() const;
34 BlockCipher* clone() const;
35
36 /**
37 * @param hash function to use to form the block cipher
38 */
39 LubyRackoff(HashFunction* hash);
40 ~LubyRackoff() { delete hash; }
41 private:
42 void key_schedule(const byte[], size_t);
43
44 HashFunction* hash;
45 SecureVector<byte> K1, K2;
46 };
47
48 }
49
50 #endif
Botan::LubyRackoff::key_spec
Key_Length_Specification key_spec() const
Definition: lubyrack.h:27
Botan::Key_Length_Specification
Definition: key_spec.h:18
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::LubyRackoff
Definition: lubyrack.h:19
Botan
Definition: algo_base.h:14
Botan::HashFunction
Definition: hash.h:20
Botan::LubyRackoff::~LubyRackoff
~LubyRackoff()
Definition: lubyrack.h:40
Botan::LubyRackoff::block_size
size_t block_size() const
Definition: lubyrack.h:25
Botan::SecureVector< byte >
Botan::BlockCipher
Definition: block_cipher.h:18