3way.h

来自「300种加密解密算法 希望能够对需要的人有所帮助」· C头文件 代码 · 共 52 行

H
52
字号
#ifndef CRYPTOPP_THREEWAY_H
#define CRYPTOPP_THREEWAY_H

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

NAMESPACE_BEGIN(CryptoPP)

class ThreeWayEncryption : public BlockTransformation
{
public:
	enum {KEYLENGTH=12, BLOCKSIZE=12, ROUNDS=11};

	ThreeWayEncryption(const byte *userKey, unsigned rounds=ROUNDS);
	~ThreeWayEncryption();

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

	unsigned int BlockSize() const {return BLOCKSIZE;}

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

class ThreeWayDecryption : public BlockTransformation
{
public:
	enum {KEYLENGTH=12, BLOCKSIZE=12, ROUNDS=11};

	ThreeWayDecryption(const byte *userKey, unsigned rounds=ROUNDS);
	~ThreeWayDecryption();

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

	unsigned int BlockSize() const {return BLOCKSIZE;}

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

NAMESPACE_END

#endif

⌨️ 快捷键说明

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