Security Scol plugin
simeck.h
Go to the documentation of this file.
1// simeck.h - written and placed in the public domain by Gangqiang Yang and Jeffrey Walton.
2// Based on "The Simeck Family of Lightweight Block Ciphers" by Gangqiang Yang,
3// Bo Zhu, Valentin Suder, Mark D. Aagaard, and Guang Gong
4
11
12#ifndef CRYPTOPP_SIMECK_H
13#define CRYPTOPP_SIMECK_H
14
15#include "config.h"
16#include "seckey.h"
17#include "secblock.h"
18#include "algparam.h"
19
20NAMESPACE_BEGIN(CryptoPP)
21
22
24struct SIMECK32_Info : public FixedBlockSize<4>, public FixedKeyLength<8>, public FixedRounds<32>
25{
30 static const std::string StaticAlgorithmName()
31 {
32 // Format is Cipher-Blocksize
33 return "SIMECK-32";
34 }
35};
36
39struct SIMECK64_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public FixedRounds<44>
40{
45 static const std::string StaticAlgorithmName()
46 {
47 // Format is Cipher-Blocksize
48 return "SIMECK-64";
49 }
50};
51
59class CRYPTOPP_NO_VTABLE SIMECK32 : public SIMECK32_Info, public BlockCipherDocumentation
60{
61public:
65 class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<SIMECK32_Info>
66 {
67 protected:
68 void UncheckedSetKey(const byte *userKey, unsigned int keyLength, const NameValuePairs &params);
69 std::string AlgorithmProvider() const;
70
73 };
74
79 class CRYPTOPP_NO_VTABLE Enc : public Base
80 {
81 public:
82 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
83 };
84
89 class CRYPTOPP_NO_VTABLE Dec : public Base
90 {
91 public:
92 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
93 };
94
97};
98
101
109class CRYPTOPP_NO_VTABLE SIMECK64 : public SIMECK64_Info, public BlockCipherDocumentation
110{
111public:
115 class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<SIMECK64_Info>
116 {
117 protected:
118 void UncheckedSetKey(const byte *userKey, unsigned int keyLength, const NameValuePairs &params);
119 std::string AlgorithmProvider() const;
120
123 };
124
129 class CRYPTOPP_NO_VTABLE Enc : public Base
130 {
131 public:
132 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
133
134#if CRYPTOPP_SIMECK_ADVANCED_PROCESS_BLOCKS
135 size_t AdvancedProcessBlocks(const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const;
136#endif
137 };
138
143 class CRYPTOPP_NO_VTABLE Dec : public Base
144 {
145 public:
146 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
147
148#if CRYPTOPP_SIMECK_ADVANCED_PROCESS_BLOCKS
149 size_t AdvancedProcessBlocks(const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const;
150#endif
151 };
152
155};
156
159
160NAMESPACE_END
161
162#endif // CRYPTOPP_SIMECK_H
Classes for working with NameValuePairs.
Provides class member functions to key a block cipher.
Definition seckey.h:318
Provides a base implementation of Algorithm and SimpleKeyingInterface for block ciphers.
Definition seckey.h:306
Inherited by algorithms with fixed block size.
Definition seckey.h:41
Inherited by keyed algorithms with fixed key length.
Definition seckey.h:125
Inherited by algorithms with fixed number of rounds.
Definition seckey.h:53
Fixed size stack-based SecBlock.
Definition secblock.h:1246
Interface for retrieving values given their names.
Definition cryptlib.h:322
SIMECK block cipher transformation functions.
Definition simeck.h:66
Decryption transformation.
Definition simeck.h:90
Encryption transformation.
Definition simeck.h:80
SIMECK 32-bit block cipher.
Definition simeck.h:60
SIMECK block cipher transformation functions.
Definition simeck.h:116
Decryption transformation.
Definition simeck.h:144
Encryption transformation.
Definition simeck.h:130
SIMECK 64-bit block cipher.
Definition simeck.h:110
Library configuration file.
unsigned int word32
32-bit unsigned datatype
Definition config_int.h:62
Classes and functions for secure memory allocations.
Classes and functions for implementing secret key algorithms.
Provides Encryption and Decryption typedefs used by derived classes to implement a block cipher.
Definition seckey.h:399
BlockCipher Decryption
implements the BlockCipher interface
Definition seckey.h:403
BlockCipher Encryption
implements the BlockCipher interface
Definition seckey.h:401
SIMECK block cipher information.
Definition simeck.h:25
static const std::string StaticAlgorithmName()
The algorithm name.
Definition simeck.h:30
SIMECK block cipher information.
Definition simeck.h:40
static const std::string StaticAlgorithmName()
The algorithm name.
Definition simeck.h:45