Botan: src/block/des/des.h Source File

Botan 1.10.17

des.h
Go to the documentation of this file.
1 /*
2 * DES
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #ifndef BOTAN_DES_H__
9 #define BOTAN_DES_H__
10
11 #include <botan/block_cipher.h>
12
13 namespace Botan {
14
15 /**
16 * DES
17 */
18 class BOTAN_DLL DES : public Block_Cipher_Fixed_Params<8, 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() { zeroise(round_key); }
25 std::string name() const { return "DES"; }
26 BlockCipher* clone() const { return new DES; }
27
28 DES() : round_key(32) {}
29 private:
30 void key_schedule(const byte[], size_t);
31
32 SecureVector<u32bit> round_key;
33 };
34
35 /**
36 * Triple DES
37 */
38 class BOTAN_DLL TripleDES : public Block_Cipher_Fixed_Params<8, 16, 24, 8>
39 {
40 public:
41 void encrypt_n(const byte in[], byte out[], size_t blocks) const;
42 void decrypt_n(const byte in[], byte out[], size_t blocks) const;
43
44 void clear() { zeroise(round_key); }
45 std::string name() const { return "TripleDES"; }
46 BlockCipher* clone() const { return new TripleDES; }
47
48 TripleDES() : round_key(96) {}
49 private:
50 void key_schedule(const byte[], size_t);
51
52 SecureVector<u32bit> round_key;
53 };
54
55 /*
56 * DES Tables
57 */
58 extern const u32bit DES_SPBOX1[256];
59 extern const u32bit DES_SPBOX2[256];
60 extern const u32bit DES_SPBOX3[256];
61 extern const u32bit DES_SPBOX4[256];
62 extern const u32bit DES_SPBOX5[256];
63 extern const u32bit DES_SPBOX6[256];
64 extern const u32bit DES_SPBOX7[256];
65 extern const u32bit DES_SPBOX8[256];
66
67 extern const u64bit DES_IPTAB1[256];
68 extern const u64bit DES_IPTAB2[256];
69 extern const u64bit DES_FPTAB1[256];
70 extern const u64bit DES_FPTAB2[256];
71
72 }
73
74 #endif
Botan::DES_SPBOX4
const u32bit DES_SPBOX4[256]
Definition: des_tab.cpp:147
Botan::DES_IPTAB1
const u64bit DES_IPTAB1[256]
Definition: des_tab.cpp:372
Botan::TripleDES::clone
BlockCipher * clone() const
Definition: des.h:46
Botan::DES_SPBOX6
const u32bit DES_SPBOX6[256]
Definition: des_tab.cpp:237
Botan::DES_SPBOX7
const u32bit DES_SPBOX7[256]
Definition: des_tab.cpp:282
Botan::DES_SPBOX3
const u32bit DES_SPBOX3[256]
Definition: des_tab.cpp:102
Botan::DES_SPBOX5
const u32bit DES_SPBOX5[256]
Definition: des_tab.cpp:192
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::TripleDES::TripleDES
TripleDES()
Definition: des.h:48
Botan::u64bit
unsigned long long u64bit
Definition: types.h:49
Botan::DES_SPBOX1
const u32bit DES_SPBOX1[256]
Definition: des_tab.cpp:12
Botan::DES_SPBOX8
const u32bit DES_SPBOX8[256]
Definition: des_tab.cpp:327
Botan::DES_IPTAB2
const u64bit DES_IPTAB2[256]
Definition: des_tab.cpp:438
Botan::DES::clone
BlockCipher * clone() const
Definition: des.h:26
Botan
Definition: algo_base.h:14
Botan::DES_FPTAB2
const u64bit DES_FPTAB2[256]
Definition: des_tab.cpp:570
Botan::DES::name
std::string name() const
Definition: des.h:25
Botan::DES::clear
void clear()
Definition: des.h:24
Botan::DES_FPTAB1
const u64bit DES_FPTAB1[256]
Definition: des_tab.cpp:504
Botan::DES::DES
DES()
Definition: des.h:28
Botan::DES
Definition: des.h:18
Botan::SecureVector< u32bit >
Botan::TripleDES
Definition: des.h:38
Botan::Block_Cipher_Fixed_Params
Definition: block_cipher.h:104
Botan::DES_SPBOX2
const u32bit DES_SPBOX2[256]
Definition: des_tab.cpp:57
Botan::zeroise
void zeroise(MemoryRegion< T > &vec)
Definition: secmem.h:428
Botan::TripleDES::clear
void clear()
Definition: des.h:44
Botan::u32bit
unsigned int u32bit
Definition: types.h:32
Botan::BlockCipher
Definition: block_cipher.h:18
Botan::TripleDES::name
std::string name() const
Definition: des.h:45