mars.h
来自「加密算法 Test Driver for Crypto++, a C++ Cl」· C头文件 代码 · 共 48 行
H
48 行
#ifndef CRYPTOPP_MARS_H
#define CRYPTOPP_MARS_H
#include "cryptlib.h"
#include "misc.h"
NAMESPACE_BEGIN(CryptoPP)
class MARS : public BlockTransformation
{
public:
enum {KEYLENGTH=16, BLOCKSIZE=16};
unsigned int BlockSize() const {return BLOCKSIZE;}
protected:
MARS(const byte *userKey, unsigned int keylength);
static const word32 Sbox[512];
SecBlock<word32> EK;
};
class MARSEncryption : public MARS
{
public:
MARSEncryption(const byte *userKey, unsigned int keylength=KEYLENGTH)
: MARS(userKey, keylength) {}
void ProcessBlock(const byte *inBlock, byte * outBlock) const;
void ProcessBlock(byte * inoutBlock) const
{MARSEncryption::ProcessBlock(inoutBlock, inoutBlock);}
};
class MARSDecryption : public MARS
{
public:
MARSDecryption(const byte *userKey, unsigned int keylength=KEYLENGTH)
: MARS(userKey, keylength) {}
void ProcessBlock(const byte *inBlock, byte * outBlock) const;
void ProcessBlock(byte * inoutBlock) const
{MARSDecryption::ProcessBlock(inoutBlock, inoutBlock);}
};
NAMESPACE_END
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?