Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

des.h
Go to the documentation of this file.
1 /*
2 * DES
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
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 final : public Block_Cipher_Fixed_Params<8, 8>
19 {
20 public:
21 void encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override;
22 void decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override;
23
24 void clear() override;
25 std::string name() const override { return "DES"; }
26 BlockCipher* clone() const override { return new DES; }
27 private:
28 void key_schedule(const uint8_t[], size_t) override;
29
30 secure_vector<uint32_t> m_round_key;
31 };
32
33 /**
34 * Triple DES
35 */
36 class BOTAN_DLL TripleDES final : public Block_Cipher_Fixed_Params<8, 16, 24, 8>
37 {
38 public:
39 void encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override;
40 void decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override;
41
42 void clear() override;
43 std::string name() const override { return "TripleDES"; }
44 BlockCipher* clone() const override { return new TripleDES; }
45 private:
46 void key_schedule(const uint8_t[], size_t) override;
47
48 secure_vector<uint32_t> m_round_key;
49 };
50
51 /*
52 * DES Tables
53 */
54 extern const uint32_t DES_SPBOX1[256];
55 extern const uint32_t DES_SPBOX2[256];
56 extern const uint32_t DES_SPBOX3[256];
57 extern const uint32_t DES_SPBOX4[256];
58 extern const uint32_t DES_SPBOX5[256];
59 extern const uint32_t DES_SPBOX6[256];
60 extern const uint32_t DES_SPBOX7[256];
61 extern const uint32_t DES_SPBOX8[256];
62
63 extern const uint64_t DES_IPTAB1[256];
64 extern const uint64_t DES_IPTAB2[256];
65 extern const uint64_t DES_FPTAB1[256];
66 extern const uint64_t DES_FPTAB2[256];
67
68 }
69
70 #endif
Botan::DES::name
std::string name() const override
Definition: des.h:25
Botan::DES_IPTAB2
const uint64_t DES_IPTAB2[256]
Definition: des_tab.cpp:438
Botan::DES_SPBOX6
const uint32_t DES_SPBOX6[256]
Definition: des_tab.cpp:237
Botan::DES_SPBOX7
const uint32_t DES_SPBOX7[256]
Definition: des_tab.cpp:282
Botan::DES::clone
BlockCipher * clone() const override
Definition: des.h:26
Botan::TripleDES::name
std::string name() const override
Definition: des.h:43
Botan::DES_IPTAB1
const uint64_t DES_IPTAB1[256]
Definition: des_tab.cpp:372
Botan::DES_SPBOX4
const uint32_t DES_SPBOX4[256]
Definition: des_tab.cpp:147
Botan::DES_SPBOX3
const uint32_t DES_SPBOX3[256]
Definition: des_tab.cpp:102
Botan::DES_SPBOX8
const uint32_t DES_SPBOX8[256]
Definition: des_tab.cpp:327
Botan::secure_vector
std::vector< T, secure_allocator< T >> secure_vector
Definition: secmem.h:121
Botan::DES_SPBOX1
const uint32_t DES_SPBOX1[256]
Definition: des_tab.cpp:12
Botan
Definition: alg_id.cpp:13
Botan::TripleDES::clone
BlockCipher * clone() const override
Definition: des.h:44
Botan::DES_SPBOX5
const uint32_t DES_SPBOX5[256]
Definition: des_tab.cpp:192
Botan::DES_SPBOX2
const uint32_t DES_SPBOX2[256]
Definition: des_tab.cpp:57
Botan::DES_FPTAB1
const uint64_t DES_FPTAB1[256]
Definition: des_tab.cpp:504
Botan::DES
Definition: des.h:18
Botan::TripleDES
Definition: des.h:36
Botan::Block_Cipher_Fixed_Params
Definition: block_cipher.h:183
Botan::BlockCipher
Definition: block_cipher.h:19
Botan::DES_FPTAB2
const uint64_t DES_FPTAB2[256]
Definition: des_tab.cpp:570