Botan 1.10.17
cast128.h
Go to the documentation of this file.
1/*
2* CAST-128
3* (C) 1999-2007 Jack Lloyd
4*
5* Distributed under the terms of the Botan license
6*/
7
8#ifndef BOTAN_CAST128_H__
9#define BOTAN_CAST128_H__
10
11#include <botan/block_cipher.h>
12
13namespace Botan {
14
15/**
16* CAST-128
17*/
18class BOTAN_DLL CAST_128 : public Block_Cipher_Fixed_Params<8, 11, 16>
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-128"; }
26 BlockCipher* clone() const { return new CAST_128; }
27
28 CAST_128() : MK(16), RK(16) {}
29 private:
30 void key_schedule(const byte[], size_t);
31
32 static void cast_ks(MemoryRegion<u32bit>& ks,
33 MemoryRegion<u32bit>& user_key);
34
35 static const u32bit S5[256];
36 static const u32bit S6[256];
37 static const u32bit S7[256];
38 static const u32bit S8[256];
39
41 };
42
43extern const u32bit CAST_SBOX1[256];
44extern const u32bit CAST_SBOX2[256];
45extern const u32bit CAST_SBOX3[256];
46extern const u32bit CAST_SBOX4[256];
47
48}
49
50#endif
std::string name() const
Definition cast128.h:25
void encrypt_n(const byte in[], byte out[], size_t blocks) const
Definition cast128.cpp:51
void decrypt_n(const byte in[], byte out[], size_t blocks) const
Definition cast128.cpp:85
BlockCipher * clone() const
Definition cast128.h:26
void clear()
Definition cast128.h:24
void zeroise(MemoryRegion< T > &vec)
Definition secmem.h:428
const u32bit CAST_SBOX1[256]
Definition cast256.h:39
const u32bit CAST_SBOX2[256]
Definition cast256.h:40
unsigned int u32bit
Definition types.h:32
const u32bit CAST_SBOX3[256]
Definition cast256.h:41
const u32bit CAST_SBOX4[256]
Definition cast256.h:42