Botan  1.10.9
cast256.h
Go to the documentation of this file.
1 /*
2 * CAST-256
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7 
8 #ifndef BOTAN_CAST256_H__
9 #define BOTAN_CAST256_H__
10 
11 #include <botan/block_cipher.h>
12 
13 namespace Botan {
14 
15 /**
16 * CAST-256
17 */
18 class BOTAN_DLL CAST_256 : public Block_Cipher_Fixed_Params<16, 4, 32, 4>
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(MK); zeroise(RK); }
25  std::string name() const { return "CAST-256"; }
26  BlockCipher* clone() const { return new CAST_256; }
27 
28  CAST_256() : MK(48), RK(48) {}
29  private:
30  void key_schedule(const byte[], size_t);
31 
32  static const u32bit KEY_MASK[192];
33  static const byte KEY_ROT[32];
34 
37  };
38 
39 extern const u32bit CAST_SBOX1[256];
40 extern const u32bit CAST_SBOX2[256];
41 extern const u32bit CAST_SBOX3[256];
42 extern const u32bit CAST_SBOX4[256];
43 
44 }
45 
46 #endif
const u32bit CAST_SBOX2[256]
Definition: cast256.h:40
const u32bit CAST_SBOX1[256]
Definition: cast256.h:39
BlockCipher * clone() const
Definition: cast256.h:26
unsigned char byte
Definition: types.h:22
const u32bit CAST_SBOX4[256]
Definition: cast256.h:42
std::string name() const
Definition: cast256.h:25
void clear()
Definition: cast256.h:24
void zeroise(MemoryRegion< T > &vec)
Definition: secmem.h:415
unsigned int u32bit
Definition: types.h:32
const u32bit CAST_SBOX3[256]
Definition: cast256.h:41