rc2.h
来自「300种常用加解密算法的源码C++实现。」· C头文件 代码 · 共 48 行
H
48 行
#ifndef CRYPTOPP_RC2_H
#define CRYPTOPP_RC2_H
#include "cryptlib.h"
#include "misc.h"
NAMESPACE_BEGIN(CryptoPP)
class RC2Base : public BlockTransformation
{
public:
// values of KEYLENGTH is defaults only
enum {KEYLENGTH=16, BLOCKSIZE=8, ROUNDS=18};
unsigned int BlockSize() const {return BLOCKSIZE;}
protected:
// max keyLen is 128, max effectiveLen is 1024
RC2Base(const byte *key, unsigned int keyLen, unsigned int effectiveLen);
SecBlock<word16> K; // expanded key table
};
class RC2Encryption : public RC2Base
{
public:
RC2Encryption(const byte *key, unsigned int keyLen=KEYLENGTH, unsigned int effectiveLen=1024)
: RC2Base(key, keyLen, effectiveLen) {}
void ProcessBlock(byte * inoutBlock) const
{RC2Encryption::ProcessBlock(inoutBlock, inoutBlock);}
void ProcessBlock(const byte *inBlock, byte * outBlock) const;
};
class RC2Decryption : public RC2Base
{
public:
RC2Decryption(const byte *key, unsigned int keyLen=KEYLENGTH, unsigned int effectiveLen=1024)
: RC2Base(key, keyLen, effectiveLen) {}
void ProcessBlock(byte * inoutBlock) const
{RC2Decryption::ProcessBlock(inoutBlock, inoutBlock);}
void ProcessBlock(const byte *inBlock, byte * outBlock) const;
};
NAMESPACE_END
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?