Botan  1.10.9
rc5.h
Go to the documentation of this file.
1 /*
2 * RC5
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7 
8 #ifndef BOTAN_RC5_H__
9 #define BOTAN_RC5_H__
10 
11 #include <botan/block_cipher.h>
12 
13 namespace Botan {
14 
15 /**
16 * RC5
17 */
18 class BOTAN_DLL RC5 : public Block_Cipher_Fixed_Params<8, 1, 32>
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  void clear() { zeroise(S); }
25  std::string name() const;
26  BlockCipher* clone() const { return new RC5(get_rounds()); }
27 
28  /**
29  * @param rounds the number of RC5 rounds to run. Must be between
30  * 8 and 32 and a multiple of 4.
31  */
32  RC5(size_t rounds);
33  private:
34  size_t get_rounds() const { return (S.size() - 2) / 2; }
35 
36  void key_schedule(const byte[], size_t);
37 
38  SecureVector<u32bit> S;
39  };
40 
41 }
42 
43 #endif
unsigned char byte
Definition: types.h:22
void clear()
Definition: rc5.h:24
BlockCipher * clone() const
Definition: rc5.h:26
void zeroise(MemoryRegion< T > &vec)
Definition: secmem.h:415
Definition: rc5.h:18