Botan 1.10.17
twofish.h
Go to the documentation of this file.
1/*
2* Twofish
3* (C) 1999-2007 Jack Lloyd
4*
5* Distributed under the terms of the Botan license
6*/
7
8#ifndef BOTAN_TWOFISH_H__
9#define BOTAN_TWOFISH_H__
10
11#include <botan/block_cipher.h>
12
13namespace Botan {
14
15/**
16* Twofish, an AES finalist
17*/
18class BOTAN_DLL Twofish : public Block_Cipher_Fixed_Params<16, 16, 32, 8>
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();
25 std::string name() const { return "Twofish"; }
26 BlockCipher* clone() const { return new Twofish; }
27
28 Twofish() : SB(1024), RK(40) {}
29 private:
30 void key_schedule(const byte[], size_t);
31
32 static void rs_mul(byte[4], byte, size_t);
33
34 static const u32bit MDS0[256];
35 static const u32bit MDS1[256];
36 static const u32bit MDS2[256];
37 static const u32bit MDS3[256];
38 static const byte Q0[256];
39 static const byte Q1[256];
40 static const byte RS[32];
41 static const byte EXP_TO_POLY[255];
42 static const byte POLY_TO_EXP[255];
43
45 };
46
47}
48
49#endif
std::string name() const
Definition twofish.h:25
void decrypt_n(const byte in[], byte out[], size_t blocks) const
Definition twofish.cpp:71
BlockCipher * clone() const
Definition twofish.h:26
void encrypt_n(const byte in[], byte out[], size_t blocks) const
Definition twofish.cpp:20
unsigned int u32bit
Definition types.h:32