Botan: src/stream/turing/turing.h Source File

Botan 1.10.17

turing.h
Go to the documentation of this file.
1 /*
2 * Turing
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #ifndef BOTAN_TURING_H__
9 #define BOTAN_TURING_H__
10
11 #include <botan/stream_cipher.h>
12
13 namespace Botan {
14
15 /**
16 * Turing
17 */
18 class BOTAN_DLL Turing : public StreamCipher
19 {
20 public:
21 void cipher(const byte in[], byte out[], size_t length);
22 void set_iv(const byte iv[], size_t iv_length);
23
24 bool valid_iv_length(size_t iv_len) const
25 { return (iv_len % 4 == 0 && iv_len <= 16); }
26
27 Key_Length_Specification key_spec() const
28 {
29 return Key_Length_Specification(4, 32, 4);
30 }
31
32 void clear();
33 std::string name() const { return "Turing"; }
34 StreamCipher* clone() const { return new Turing; }
35
36 Turing() : S0(256), S1(256), S2(256), S3(256),
37 R(17), buffer(340), position(0) {}
38
39 private:
40 void key_schedule(const byte[], size_t);
41 void generate();
42
43 static u32bit fixedS(u32bit);
44
45 static const u32bit Q_BOX[256];
46 static const byte SBOX[256];
47
48 SecureVector<u32bit> S0, S1, S2, S3;
49 SecureVector<u32bit> R;
50 SecureVector<u32bit> K;
51 SecureVector<byte> buffer;
52 size_t position;
53 };
54
55 }
56
57 #endif
Botan::Turing
Definition: turing.h:18
Botan::Key_Length_Specification
Definition: key_spec.h:18
Botan::Turing::name
std::string name() const
Definition: turing.h:33
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::Turing::key_spec
Key_Length_Specification key_spec() const
Definition: turing.h:27
Botan::StreamCipher
Definition: stream_cipher.h:18
Botan::Turing::Turing
Turing()
Definition: turing.h:36
Botan
Definition: algo_base.h:14
Botan::Turing::valid_iv_length
bool valid_iv_length(size_t iv_len) const
Definition: turing.h:24
Botan::Turing::clone
StreamCipher * clone() const
Definition: turing.h:34
Botan::SecureVector< u32bit >
Botan::u32bit
unsigned int u32bit
Definition: types.h:32