File indexing completed on 2025-01-18 09:55:09
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef CRYPTOPP_SIMECK_H
0013 #define CRYPTOPP_SIMECK_H
0014
0015 #include "config.h"
0016 #include "seckey.h"
0017 #include "secblock.h"
0018 #include "algparam.h"
0019
0020 NAMESPACE_BEGIN(CryptoPP)
0021
0022
0023
0024 struct SIMECK32_Info : public FixedBlockSize<4>, public FixedKeyLength<8>, public FixedRounds<32>
0025 {
0026
0027
0028
0029
0030 static const std::string StaticAlgorithmName()
0031 {
0032
0033 return "SIMECK-32";
0034 }
0035 };
0036
0037
0038
0039 struct SIMECK64_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public FixedRounds<44>
0040 {
0041
0042
0043
0044
0045 static const std::string StaticAlgorithmName()
0046 {
0047
0048 return "SIMECK-64";
0049 }
0050 };
0051
0052
0053
0054
0055
0056
0057
0058
0059 class CRYPTOPP_NO_VTABLE SIMECK32 : public SIMECK32_Info, public BlockCipherDocumentation
0060 {
0061 public:
0062
0063
0064
0065 class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<SIMECK32_Info>
0066 {
0067 protected:
0068 void UncheckedSetKey(const byte *userKey, unsigned int keyLength, const NameValuePairs ¶ms);
0069 std::string AlgorithmProvider() const;
0070
0071 FixedSizeSecBlock<word16, ROUNDS> m_rk;
0072 mutable FixedSizeSecBlock<word16, 5> m_t;
0073 };
0074
0075
0076
0077
0078
0079 class CRYPTOPP_NO_VTABLE Enc : public Base
0080 {
0081 public:
0082 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
0083 };
0084
0085
0086
0087
0088
0089 class CRYPTOPP_NO_VTABLE Dec : public Base
0090 {
0091 public:
0092 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
0093 };
0094
0095 typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
0096 typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
0097 };
0098
0099 typedef SIMECK32::Encryption SIMECK32Encryption;
0100 typedef SIMECK32::Decryption SIMECK32Decryption;
0101
0102
0103
0104
0105
0106
0107
0108
0109 class CRYPTOPP_NO_VTABLE SIMECK64 : public SIMECK64_Info, public BlockCipherDocumentation
0110 {
0111 public:
0112
0113
0114
0115 class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<SIMECK64_Info>
0116 {
0117 protected:
0118 void UncheckedSetKey(const byte *userKey, unsigned int keyLength, const NameValuePairs ¶ms);
0119 std::string AlgorithmProvider() const;
0120
0121 FixedSizeSecBlock<word32, ROUNDS> m_rk;
0122 mutable FixedSizeSecBlock<word32, 5> m_t;
0123 };
0124
0125
0126
0127
0128
0129 class CRYPTOPP_NO_VTABLE Enc : public Base
0130 {
0131 public:
0132 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
0133
0134 #if CRYPTOPP_SIMECK_ADVANCED_PROCESS_BLOCKS
0135 size_t AdvancedProcessBlocks(const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const;
0136 #endif
0137 };
0138
0139
0140
0141
0142
0143 class CRYPTOPP_NO_VTABLE Dec : public Base
0144 {
0145 public:
0146 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
0147
0148 #if CRYPTOPP_SIMECK_ADVANCED_PROCESS_BLOCKS
0149 size_t AdvancedProcessBlocks(const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const;
0150 #endif
0151 };
0152
0153 typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
0154 typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
0155 };
0156
0157 typedef SIMECK64::Encryption SIMECK64Encryption;
0158 typedef SIMECK64::Decryption SIMECK64Decryption;
0159
0160 NAMESPACE_END
0161
0162 #endif