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
14namespace Botan {
15
16/**
17* Luby-Rackoff block cipher construction
18*/
19class 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
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 */
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
size_t block_size() const
Definition lubyrack.h:25
void encrypt_n(const byte in[], byte out[], size_t blocks) const
Definition lubyrack.cpp:16
Key_Length_Specification key_spec() const
Definition lubyrack.h:27
void decrypt_n(const byte in[], byte out[], size_t blocks) const
Definition lubyrack.cpp:53
LubyRackoff(HashFunction *hash)
Definition lubyrack.cpp:127