Crypto++ 8.9 Free C++ class library of cryptographic schemes

hight.h
Go to the documentation of this file.
1 // hight.h - written and placed in the public domain by Kim Sung Hee and Jeffrey Walton
2 // Based on "HIGHT: A New Block Cipher Suitable for Low-Resource Device"
3 // by Deukjo Hong, Jaechul Sung, Seokhie Hong, Jongin Lim, Sangjin Lee,
4 // Bon-Seok Koo, Changhoon Lee, Donghoon Chang, Jesang Lee, Kitae Jeong,
5 // Hyun Kim, Jongsung Kim, and Seongtaek Chee
6
7 /// \file hight.h
8 /// \brief Classes for the HIGHT block cipher
9 /// \since Crypto++ 8.0
10
11 #ifndef CRYPTOPP_HIGHT_H
12 #define CRYPTOPP_HIGHT_H
13
14 #include "config.h"
15 #include "seckey.h"
16 #include "secblock.h"
17 #include "algparam.h"
18
19 NAMESPACE_BEGIN(CryptoPP)
20
21 /// \brief HIGHT block cipher information
22 /// \since Crypto++ 8.0
23 struct HIGHT_Info : public FixedBlockSize<8>, public FixedKeyLength<16>
24 {
25 static const std::string StaticAlgorithmName()
26 {
27 // Format is Cipher-Blocksize
28 return "HIGHT";
29 }
30 };
31
32 /// \brief HIGHT 64-bit block cipher
33 /// \details HIGHT provides 64-bit block size. The valid key size is 128-bits.
34 /// \note Crypto++ provides a byte oriented implementation
35 /// \sa <a href="http://www.cryptopp.com/wiki/HIGHT">HIGHT</a>,
36 /// <a href="https://seed.kisa.or.kr/">Korea Internet &amp; Security
37 /// Agency</a> website
38 /// \since Crypto++ 8.0
39 class CRYPTOPP_NO_VTABLE HIGHT : public HIGHT_Info, public BlockCipherDocumentation
40 {
41 public:
42 /// \brief HIGHT block cipher transformation functions
43 /// \details Provides implementation common to encryption and decryption
44 /// \since Crypto++ 8.0
45 class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<HIGHT_Info>
46 {
47 protected:
48 void UncheckedSetKey(const byte *userKey, unsigned int keyLength, const NameValuePairs &params);
49
50 FixedSizeSecBlock<byte, 136> m_rkey;
51 mutable FixedSizeSecBlock<word32, 8> m_xx;
52 };
53
54 /// \brief Encryption transformation
55 /// \details Enc provides implementation for encryption transformation.
56 /// \since Crypto++ 8.0
57 class CRYPTOPP_NO_VTABLE Enc : public Base
58 {
59 public:
60 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
61 };
62
63 /// \brief Decryption transformation
64 /// \details Dec provides implementation for decryption transformation.
65 /// \since Crypto++ 8.0
66 class CRYPTOPP_NO_VTABLE Dec : public Base
67 {
68 public:
69 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
70 };
71
72 typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
73 typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
74 };
75
76 typedef HIGHT::Encryption HIGHTEncryption;
77 typedef HIGHT::Decryption HIGHTDecryption;
78
79 NAMESPACE_END
80
81 #endif // CRYPTOPP_HIGHT_H
algparam.h
Classes for working with NameValuePairs.
BlockCipherFinal< ENCRYPTION, Enc >
BlockCipherImpl
Provides a base implementation of Algorithm and SimpleKeyingInterface for block ciphers.
Definition: seckey.h:306
FixedBlockSize
Inherited by algorithms with fixed block size.
Definition: seckey.h:41
FixedKeyLength
Inherited by keyed algorithms with fixed key length.
Definition: seckey.h:125
FixedSizeSecBlock< byte, 136 >
HIGHT::Base
HIGHT block cipher transformation functions.
Definition: hight.h:46
HIGHT::Dec
Decryption transformation.
Definition: hight.h:67
HIGHT::Enc
Encryption transformation.
Definition: hight.h:58
HIGHT
HIGHT 64-bit block cipher.
Definition: hight.h:40
NameValuePairs
Interface for retrieving values given their names.
Definition: cryptlib.h:327
config.h
Library configuration file.
CryptoPP
Crypto++ library namespace.
secblock.h
Classes and functions for secure memory allocations.
seckey.h
Classes and functions for implementing secret key algorithms.
BlockCipherDocumentation
Provides Encryption and Decryption typedefs used by derived classes to implement a block cipher.
Definition: seckey.h:399
BlockCipherDocumentation::Decryption
BlockCipher Decryption
implements the BlockCipher interface
Definition: seckey.h:403
BlockCipherDocumentation::Encryption
BlockCipher Encryption
implements the BlockCipher interface
Definition: seckey.h:401
HIGHT_Info
HIGHT block cipher information.
Definition: hight.h:24