idea.h

来自「C++实现的数字签名DSA算法」· C头文件 代码 · 共 55 行

H
55
字号
#ifndef CRYPTOPP_IDEA_H
#define CRYPTOPP_IDEA_H

/** \file
*/

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

NAMESPACE_BEGIN(CryptoPP)

/// base class, do not use directly
class IDEA : public FixedBlockSize<8>, public FixedKeyLength<16>
{
public:
	IDEA(const byte *userKey, CipherDir dir);

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

private:
	void EnKey(const byte *);
	void DeKey();
	SecBlock<word> key;

#ifdef IDEA_LARGECACHE
	static inline void LookupMUL(word &a, word b);
	void LookupKeyLogs();
	static void BuildLogTables();
	static bool tablesBuilt;
	static word16 log[0x10000], antilog[0x10000];
#endif
};

/// <a href="http://www.weidai.com/scan-mirror/cs.html#IDEA">IDEA</a>
class IDEAEncryption : public IDEA
{
public:
	IDEAEncryption(const byte * userKey, unsigned int = 0)
		: IDEA (userKey, ENCRYPTION) {}
};

/// <a href="http://www.weidai.com/scan-mirror/cs.html#IDEA">IDEA</a>
class IDEADecryption : public IDEA
{
public:
	IDEADecryption(const byte * userKey, unsigned int = 0)
		: IDEA (userKey, DECRYPTION) {}
};

NAMESPACE_END

#endif

⌨️ 快捷键说明

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