File indexing completed on 2025-01-18 09:55:04
0001
0002
0003
0004
0005
0006
0007 #ifndef CRYPTOPP_MARS_H
0008 #define CRYPTOPP_MARS_H
0009
0010 #include "seckey.h"
0011 #include "secblock.h"
0012
0013 NAMESPACE_BEGIN(CryptoPP)
0014
0015
0016
0017 struct MARS_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 56, 8>
0018 {
0019 CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "MARS";}
0020 };
0021
0022
0023
0024
0025 class MARS : public MARS_Info, public BlockCipherDocumentation
0026 {
0027 class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<MARS_Info>
0028 {
0029 public:
0030 void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms);
0031
0032 protected:
0033 static const word32 Sbox[512];
0034
0035 FixedSizeSecBlock<word32, 40> m_k;
0036 };
0037
0038 class CRYPTOPP_NO_VTABLE Enc : public Base
0039 {
0040 public:
0041 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
0042 };
0043
0044 class CRYPTOPP_NO_VTABLE Dec : public Base
0045 {
0046 public:
0047 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
0048 };
0049
0050 public:
0051 typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
0052 typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
0053 };
0054
0055 typedef MARS::Encryption MARSEncryption;
0056 typedef MARS::Decryption MARSDecryption;
0057
0058 NAMESPACE_END
0059
0060 #endif