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

📄 3way.h

📁 一个DES,RSA,MD5,RC4等加密算法的源码
💻 H
字号:
#ifndef CRYPTOPP_THREEWAY_H
#define CRYPTOPP_THREEWAY_H

/** \file
*/

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

NAMESPACE_BEGIN(CryptoPP)

/// <a href="http://www.weidai.com/scan-mirror/cs.html#3-Way">3-Way</a>
class ThreeWayEncryption : public FixedBlockSize<12>, public FixedKeyLength<12>
{
public:
	enum {DEFAULT_ROUNDS=11};

	ThreeWayEncryption(const byte *userKey, unsigned int = 0, unsigned int rounds=DEFAULT_ROUNDS);
	~ThreeWayEncryption();

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

private:
	word32 k[3];
	unsigned int rounds;
	SecBlock<word32> rc;
};

/// <a href="http://www.weidai.com/scan-mirror/cs.html#3-Way">3-Way</a>
class ThreeWayDecryption : public FixedBlockSize<12>, public FixedKeyLength<12>
{
public:
	enum {DEFAULT_ROUNDS=11};

	ThreeWayDecryption(const byte *userKey, unsigned int = 0, unsigned int rounds=DEFAULT_ROUNDS);
	~ThreeWayDecryption();

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

private:
	word32 k[3];
	unsigned int rounds;
	SecBlock<word32> rc;
};

NAMESPACE_END

#endif

⌨️ 快捷键说明

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