serpent.h

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

H
48
字号
#ifndef CRYPTOPP_SERPENT_H
#define CRYPTOPP_SERPENT_H

/** \file
*/

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

NAMESPACE_BEGIN(CryptoPP)

/// base class, do not use directly
class Serpent : public FixedBlockSize<16>, public VariableKeyLength<16, 1, 32>
{
protected:
	Serpent(const byte *userKey, unsigned int keylength);

	SecBlock<word32> l_key;
};

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

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

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

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

NAMESPACE_END

#endif

⌨️ 快捷键说明

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