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
13namespace Botan {
14
15/**
16* Turing
17*/
18class 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
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;
51 SecureVector<byte> buffer;
52 size_t position;
53 };
54
55}
56
57#endif
void cipher(const byte in[], byte out[], size_t length)
Definition turing.cpp:38
bool valid_iv_length(size_t iv_len) const
Definition turing.h:24
StreamCipher * clone() const
Definition turing.h:34
std::string name() const
Definition turing.h:33
void set_iv(const byte iv[], size_t iv_length)
Definition turing.cpp:282
Key_Length_Specification key_spec() const
Definition turing.h:27
unsigned int u32bit
Definition types.h:32