Botan: src/block/cast/cast256.h Source File

Botan 1.10.16

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
35 SecureVector<u32bit> MK;
36 SecureVector<byte> RK;
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
Botan::CAST_256::CAST_256
CAST_256()
Definition: cast256.h:28
Botan::CAST_SBOX2
const u32bit CAST_SBOX2[256]
Definition: cast256.h:40
Botan::CAST_SBOX1
const u32bit CAST_SBOX1[256]
Definition: cast256.h:39
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::CAST_SBOX4
const u32bit CAST_SBOX4[256]
Definition: cast256.h:42
Botan::CAST_256::clone
BlockCipher * clone() const
Definition: cast256.h:26
Botan
Definition: algo_base.h:14
Botan::CAST_256::clear
void clear()
Definition: cast256.h:24
Botan::SecureVector< u32bit >
Botan::Block_Cipher_Fixed_Params
Definition: block_cipher.h:104
Botan::zeroise
void zeroise(MemoryRegion< T > &vec)
Definition: secmem.h:415
Botan::u32bit
unsigned int u32bit
Definition: types.h:32
Botan::CAST_SBOX3
const u32bit CAST_SBOX3[256]
Definition: cast256.h:41
Botan::BlockCipher
Definition: block_cipher.h:18
Botan::CAST_256::name
std::string name() const
Definition: cast256.h:25
Botan::CAST_256
Definition: cast256.h:18