⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rc2.h

📁 300中加密方法
💻 H
字号:
#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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -