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

📄 gost.h

📁 这是一些使用c语言编程的 相关技巧和编程经验的书籍
💻 H
字号:
#ifndef CRYPTOPP_GOST_H
#define CRYPTOPP_GOST_H

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

NAMESPACE_BEGIN(CryptoPP)

class GOST : public BlockTransformation
{
public:
	GOST(const byte *userKey, CipherDir);

	enum {KEYLENGTH=32, BLOCKSIZE=8};
	unsigned int BlockSize() const {return BLOCKSIZE;}

protected:
	static void PrecalculateSTable();

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

	SecBlock<word32> key;
};

class GOSTEncryption : public GOST
{
public:
	GOSTEncryption(const byte * userKey)
		: GOST (userKey, ENCRYPTION) {}

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

class GOSTDecryption : public GOST
{
public:
	GOSTDecryption(const byte * userKey)
		: 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -