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

📄 rc5.h

📁 300种常用加解密算法的源码C++实现。
💻 H
字号:
#ifndef CRYPTOPP_RC5_H
#define CRYPTOPP_RC5_H

#include "cryptlib.h"
#include "misc.h"

NAMESPACE_BEGIN(CryptoPP)

class RC5Base : public BlockTransformation
{
public:
	typedef word32 RC5_WORD;

	// values of KEYLENGTH and ROUNDS are defaults only
	enum {KEYLENGTH=16, BLOCKSIZE = sizeof(RC5_WORD)*2, ROUNDS=12};  // == 8
	unsigned int BlockSize() const {return BLOCKSIZE;}

protected:
	RC5Base(const byte *key, unsigned int keyLen, unsigned int rounds);

	const unsigned int r;       // number of rounds
	SecBlock<RC5_WORD> sTable;  // expanded key table
};

class RC5Encryption : public RC5Base
{
public:
	RC5Encryption(const byte *key, unsigned int keyLen=KEYLENGTH, unsigned int rounds=ROUNDS)
		: RC5Base(key, keyLen, rounds) {}

	void ProcessBlock(byte * inoutBlock) const
		{RC5Encryption::ProcessBlock(inoutBlock, inoutBlock);}
	void ProcessBlock(const byte *inBlock, byte * outBlock) const;
};

class RC5Decryption : public RC5Base
{
public:
	RC5Decryption(const byte *key, unsigned int keyLen=KEYLENGTH, unsigned int rounds=ROUNDS)
		: RC5Base(key, keyLen, rounds) {}

	void ProcessBlock(byte * inoutBlock) const
		{RC5Decryption::ProcessBlock(inoutBlock, inoutBlock);}
	void ProcessBlock(const byte *inBlock, byte * outBlock) const;
};

NAMESPACE_END

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -