gost.h

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

H
53
字号
#ifndef CRYPTOPP_GOST_H
#define CRYPTOPP_GOST_H

/** \file
*/

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

NAMESPACE_BEGIN(CryptoPP)

/// base class, do not use directly
class GOST : public FixedBlockSize<8>, public FixedKeyLength<32>
{
protected:
	GOST(const byte *userKey, CipherDir);
	static void PrecalculateSTable();

	static const byte sBox[8][16];
	static bool sTableCalculated;
	static word32 sTable[4][256];

	SecBlock<word32> key;
};

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

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

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

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

NAMESPACE_END

#endif

⌨️ 快捷键说明

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