亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? modes.h

?? 加密函數(shù)庫:包括多種加密解密算法,數(shù)字簽名,散列算法
?? H
字號:
#ifndef CRYPTOPP_MODES_H
#define CRYPTOPP_MODES_H

/*! \file
*/

#include "cryptlib.h"
#include "secblock.h"
#include "misc.h"
#include "strciphr.h"
#include "argnames.h"
#include "algparam.h"

NAMESPACE_BEGIN(CryptoPP)

//! Cipher mode documentation. See NIST SP 800-38A for definitions of these modes.

/*! Each class derived from this one defines two types, Encryption and Decryption, 
	both of which implement the SymmetricCipher interface.
	For each mode there are two classes, one of which is a template class,
	and the other one has a name that ends in "_ExternalCipher".
	The "external cipher" mode objects hold a reference to the underlying block cipher,
	instead of holding an instance of it. The reference must be passed in to the constructor.
	For the "cipher holder" classes, the CIPHER template parameter should be a class
	derived from BlockCipherDocumentation, for example DES or AES.
*/
struct CipherModeDocumentation : public SymmetricCipherDocumentation
{
};

class CipherModeBase : public SymmetricCipher
{
public:
	unsigned int MinKeyLength() const {return m_cipher->MinKeyLength();}
	unsigned int MaxKeyLength() const {return m_cipher->MaxKeyLength();}
	unsigned int DefaultKeyLength() const {return m_cipher->DefaultKeyLength();}
	unsigned int GetValidKeyLength(unsigned int n) const {return m_cipher->GetValidKeyLength(n);}
	bool IsValidKeyLength(unsigned int n) const {return m_cipher->IsValidKeyLength(n);}

	void SetKey(const byte *key, unsigned int length, const NameValuePairs &params = g_nullNameValuePairs);

	unsigned int OptimalDataAlignment() const {return BlockSize();}

	unsigned int IVSize() const {return BlockSize();}
	void GetNextIV(byte *IV);
	virtual IV_Requirement IVRequirement() const =0;

protected:
	inline unsigned int BlockSize() const {assert(m_register.size() > 0); return m_register.size();}
	void SetIV(const byte *iv);
	virtual void SetFeedbackSize(unsigned int feedbackSize)
	{
		if (!(feedbackSize == 0 || feedbackSize == BlockSize()))
			throw InvalidArgument("CipherModeBase: feedback size cannot be specified for this cipher mode");
	}
	virtual void ResizeBuffers()
	{
		m_register.New(m_cipher->BlockSize());
	}
	virtual void UncheckedSetKey(const NameValuePairs &params, const byte *key, unsigned int length) =0;

	BlockCipher *m_cipher;
	SecByteBlock m_register;
};

template <class POLICY_INTERFACE>
class ModePolicyCommonTemplate : public CipherModeBase, public POLICY_INTERFACE
{
	unsigned int GetAlignment() const {return m_cipher->BlockAlignment();}
	void CipherSetKey(const NameValuePairs &params, const byte *key, unsigned int length)
	{
		m_cipher->SetKey(key, length, params);
		ResizeBuffers();
		int feedbackSize = params.GetIntValueWithDefault(Name::FeedbackSize(), 0);
		SetFeedbackSize(feedbackSize);
		const byte *iv = params.GetValueWithDefault(Name::IV(), (const byte *)NULL);
		SetIV(iv);
	}
};

class CFB_ModePolicy : public ModePolicyCommonTemplate<CFB_CipherAbstractPolicy>
{
public:
	IV_Requirement IVRequirement() const {return RANDOM_IV;}

protected:
	unsigned int GetBytesPerIteration() const {return m_feedbackSize;}
	byte * GetRegisterBegin() {return m_register + BlockSize() - m_feedbackSize;}
	void TransformRegister()
	{
		m_cipher->ProcessBlock(m_register, m_temp);
		memmove(m_register, m_register+m_feedbackSize, BlockSize()-m_feedbackSize);
		memcpy(m_register+BlockSize()-m_feedbackSize, m_temp, m_feedbackSize);
	}
	void CipherResynchronize(const byte *iv)
	{
		memcpy(m_register, iv, BlockSize());
		TransformRegister();
	}
	void SetFeedbackSize(unsigned int feedbackSize)
	{
		if (feedbackSize > BlockSize())
			throw InvalidArgument("CFB_Mode: invalid feedback size");
		m_feedbackSize = feedbackSize ? feedbackSize : BlockSize();
	}
	void ResizeBuffers()
	{
		CipherModeBase::ResizeBuffers();
		m_temp.New(BlockSize());
	}

	SecByteBlock m_temp;
	unsigned int m_feedbackSize;
};

class OFB_ModePolicy : public ModePolicyCommonTemplate<AdditiveCipherAbstractPolicy>
{
	unsigned int GetBytesPerIteration() const {return BlockSize();}
	unsigned int GetIterationsToBuffer() const {return 1;}
	void WriteKeystream(byte *keystreamBuffer, unsigned int iterationCount)
	{
		assert(iterationCount == 1);
		m_cipher->ProcessBlock(keystreamBuffer);
	}
	void CipherResynchronize(byte *keystreamBuffer, const byte *iv)
	{
		memcpy(keystreamBuffer, iv, BlockSize());
	}
	bool IsRandomAccess() const {return false;}
	IV_Requirement IVRequirement() const {return STRUCTURED_IV;}
};

class CTR_ModePolicy : public ModePolicyCommonTemplate<AdditiveCipherAbstractPolicy>
{
	unsigned int GetBytesPerIteration() const {return BlockSize();}
	unsigned int GetIterationsToBuffer() const {return m_cipher->OptimalNumberOfParallelBlocks();}
	void WriteKeystream(byte *buffer, unsigned int iterationCount)
		{OperateKeystream(WRITE_KEYSTREAM, buffer, NULL, iterationCount);}
	bool CanOperateKeystream() const {return true;}
	void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, unsigned int iterationCount);
	void CipherResynchronize(byte *keystreamBuffer, const byte *iv);
	bool IsRandomAccess() const {return true;}
	void SeekToIteration(dword iterationCount);
	IV_Requirement IVRequirement() const {return STRUCTURED_IV;}

	inline void ProcessMultipleBlocks(byte *output, const byte *input, unsigned int n);

	SecByteBlock m_counterArray;
};

class BlockOrientedCipherModeBase : public CipherModeBase
{
public:
	void UncheckedSetKey(const NameValuePairs &params, const byte *key, unsigned int length);
	unsigned int MandatoryBlockSize() const {return BlockSize();}
	bool IsRandomAccess() const {return false;}
	bool IsSelfInverting() const {return false;}
	bool IsForwardTransformation() const {return m_cipher->IsForwardTransformation();}
	void Resynchronize(const byte *iv) {memcpy(m_register, iv, BlockSize());}
	void ProcessData(byte *outString, const byte *inString, unsigned int length);

protected:
	bool RequireAlignedInput() const {return true;}
	virtual void ProcessBlocks(byte *outString, const byte *inString, unsigned int numberOfBlocks) =0;
	void ResizeBuffers()
	{
		CipherModeBase::ResizeBuffers();
		m_buffer.New(BlockSize());
	}

	SecByteBlock m_buffer;
};

class ECB_OneWay : public BlockOrientedCipherModeBase
{
public:
	IV_Requirement IVRequirement() const {return NOT_RESYNCHRONIZABLE;}
	unsigned int OptimalBlockSize() const {return BlockSize() * m_cipher->OptimalNumberOfParallelBlocks();}
	void ProcessBlocks(byte *outString, const byte *inString, unsigned int numberOfBlocks)
		{m_cipher->ProcessAndXorMultipleBlocks(inString, NULL, outString, numberOfBlocks);}
};

class CBC_ModeBase : public BlockOrientedCipherModeBase
{
public:
	IV_Requirement IVRequirement() const {return UNPREDICTABLE_RANDOM_IV;}
	bool RequireAlignedInput() const {return false;}
	unsigned int MinLastBlockSize() const {return 0;}
};

class CBC_Encryption : public CBC_ModeBase
{
public:
	void ProcessBlocks(byte *outString, const byte *inString, unsigned int numberOfBlocks);
};

class CBC_CTS_Encryption : public CBC_Encryption
{
public:
	void SetStolenIV(byte *iv) {m_stolenIV = iv;}
	unsigned int MinLastBlockSize() const {return BlockSize()+1;}
	void ProcessLastBlock(byte *outString, const byte *inString, unsigned int length);

protected:
	void UncheckedSetKey(const NameValuePairs &params, const byte *key, unsigned int length)
	{
		CBC_Encryption::UncheckedSetKey(params, key, length);
		m_stolenIV = params.GetValueWithDefault(Name::StolenIV(), (byte *)NULL);
	}

	byte *m_stolenIV;
};

class CBC_Decryption : public CBC_ModeBase
{
public:
	void ProcessBlocks(byte *outString, const byte *inString, unsigned int numberOfBlocks);
	
protected:
	void ResizeBuffers()
	{
		BlockOrientedCipherModeBase::ResizeBuffers();
		m_temp.New(BlockSize());
	}
	SecByteBlock m_temp;
};

class CBC_CTS_Decryption : public CBC_Decryption
{
public:
	unsigned int MinLastBlockSize() const {return BlockSize()+1;}
	void ProcessLastBlock(byte *outString, const byte *inString, unsigned int length);
};

//! .
template <class CIPHER, class BASE>
class CipherModeFinalTemplate_CipherHolder : public ObjectHolder<CIPHER>, public BASE
{
public:
	CipherModeFinalTemplate_CipherHolder()
	{
		m_cipher = &m_object;
		ResizeBuffers();
	}
	CipherModeFinalTemplate_CipherHolder(const byte *key, unsigned int length)
	{
		m_cipher = &m_object;
		SetKey(key, length);
	}
	CipherModeFinalTemplate_CipherHolder(const byte *key, unsigned int length, const byte *iv, int feedbackSize = 0)
	{
		m_cipher = &m_object;
		SetKey(key, length, MakeParameters("IV", iv)("FeedbackSize", feedbackSize));
	}
};

//! .
template <class BASE>
class CipherModeFinalTemplate_ExternalCipher : public BASE
{
public:
	CipherModeFinalTemplate_ExternalCipher(BlockCipher &cipher, const byte *iv = NULL, int feedbackSize = 0)
	{
		m_cipher = &cipher;
		ResizeBuffers();
		SetFeedbackSize(feedbackSize);
		SetIV(iv);
	}
};

//! CFB mode
template <class CIPHER>
struct CFB_Mode : public CipherModeDocumentation
{
	typedef CipherModeFinalTemplate_CipherHolder<CPP_TYPENAME CIPHER::Encryption, ConcretePolicyHolder<Empty, CFB_EncryptionTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, CFB_ModePolicy> > > > Encryption;
	typedef CipherModeFinalTemplate_CipherHolder<CPP_TYPENAME CIPHER::Encryption, ConcretePolicyHolder<Empty, CFB_DecryptionTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, CFB_ModePolicy> > > > Decryption;
};

//! CFB mode, external cipher
struct CFB_Mode_ExternalCipher : public CipherModeDocumentation
{
	typedef CipherModeFinalTemplate_ExternalCipher<ConcretePolicyHolder<Empty, CFB_EncryptionTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, CFB_ModePolicy> > > > Encryption;
	typedef CipherModeFinalTemplate_ExternalCipher<ConcretePolicyHolder<Empty, CFB_DecryptionTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, CFB_ModePolicy> > > > Decryption;
};

//! OFB mode
template <class CIPHER>
struct OFB_Mode : public CipherModeDocumentation
{
	typedef CipherModeFinalTemplate_CipherHolder<CPP_TYPENAME CIPHER::Encryption, ConcretePolicyHolder<Empty, AdditiveCipherTemplate<AbstractPolicyHolder<AdditiveCipherAbstractPolicy, OFB_ModePolicy> > > > Encryption;
	typedef Encryption Decryption;
};

//! OFB mode, external cipher
struct OFB_Mode_ExternalCipher : public CipherModeDocumentation
{
	typedef CipherModeFinalTemplate_ExternalCipher<ConcretePolicyHolder<Empty, AdditiveCipherTemplate<AbstractPolicyHolder<AdditiveCipherAbstractPolicy, OFB_ModePolicy> > > > Encryption;
	typedef Encryption Decryption;
};

//! CTR mode
template <class CIPHER>
struct CTR_Mode : public CipherModeDocumentation
{
	typedef CipherModeFinalTemplate_CipherHolder<CPP_TYPENAME CIPHER::Encryption, ConcretePolicyHolder<Empty, AdditiveCipherTemplate<AbstractPolicyHolder<AdditiveCipherAbstractPolicy, CTR_ModePolicy> > > > Encryption;
	typedef Encryption Decryption;
};

//! CTR mode, external cipher
struct CTR_Mode_ExternalCipher : public CipherModeDocumentation
{
	typedef CipherModeFinalTemplate_ExternalCipher<ConcretePolicyHolder<Empty, AdditiveCipherTemplate<AbstractPolicyHolder<AdditiveCipherAbstractPolicy, CTR_ModePolicy> > > > Encryption;
	typedef Encryption Decryption;
};

//! ECB mode
template <class CIPHER>
struct ECB_Mode : public CipherModeDocumentation
{
	typedef CipherModeFinalTemplate_CipherHolder<CPP_TYPENAME CIPHER::Encryption, ECB_OneWay> Encryption;
	typedef CipherModeFinalTemplate_CipherHolder<CPP_TYPENAME CIPHER::Decryption, ECB_OneWay> Decryption;
};

//! ECB mode, external cipher
struct ECB_Mode_ExternalCipher : public CipherModeDocumentation
{
	typedef CipherModeFinalTemplate_ExternalCipher<ECB_OneWay> Encryption;
	typedef Encryption Decryption;
};

//! CBC mode
template <class CIPHER>
struct CBC_Mode : public CipherModeDocumentation
{
	typedef CipherModeFinalTemplate_CipherHolder<CPP_TYPENAME CIPHER::Encryption, CBC_Encryption> Encryption;
	typedef CipherModeFinalTemplate_CipherHolder<CPP_TYPENAME CIPHER::Decryption, CBC_Decryption> Decryption;
};

//! CBC mode, external cipher
struct CBC_Mode_ExternalCipher : public CipherModeDocumentation
{
	typedef CipherModeFinalTemplate_ExternalCipher<CBC_Encryption> Encryption;
	typedef CipherModeFinalTemplate_ExternalCipher<CBC_Decryption> Decryption;
};

//! CBC mode with ciphertext stealing
template <class CIPHER>
struct CBC_CTS_Mode : public CipherModeDocumentation
{
	typedef CipherModeFinalTemplate_CipherHolder<CPP_TYPENAME CIPHER::Encryption, CBC_CTS_Encryption> Encryption;
	typedef CipherModeFinalTemplate_CipherHolder<CPP_TYPENAME CIPHER::Decryption, CBC_CTS_Decryption> Decryption;
};

//! CBC mode with ciphertext stealing, external cipher
struct CBC_CTS_Mode_ExternalCipher : public CipherModeDocumentation
{
	typedef CipherModeFinalTemplate_ExternalCipher<CBC_CTS_Encryption> Encryption;
	typedef CipherModeFinalTemplate_ExternalCipher<CBC_CTS_Decryption> Decryption;
};

#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY
typedef CFB_Mode_ExternalCipher::Encryption CFBEncryption;
typedef CFB_Mode_ExternalCipher::Decryption CFBDecryption;
typedef OFB_Mode_ExternalCipher::Encryption OFB;
typedef CTR_Mode_ExternalCipher::Encryption CounterMode;
#endif

NAMESPACE_END

#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美视频一区二| 9久草视频在线视频精品| 制服丝袜成人动漫| 日本欧美在线观看| 精品对白一区国产伦| 国产成人精品一区二区三区四区| 国产精品无遮挡| 欧洲国内综合视频| 美国三级日本三级久久99| 国产清纯白嫩初高生在线观看91 | 日韩一区日韩二区| 在线观看日韩高清av| 日韩精品免费视频人成| 久久亚洲一级片| 99久久久无码国产精品| 午夜激情久久久| 久久蜜臀中文字幕| 在线观看欧美黄色| 久久精品国产久精国产爱| 国产精品天干天干在线综合| 欧美在线影院一区二区| 久久99九九99精品| 亚洲女同女同女同女同女同69| 欧美放荡的少妇| 国产大陆精品国产| 亚洲二区视频在线| 日本一区二区三区视频视频| 欧美日韩亚州综合| 粉嫩av一区二区三区| 亚洲成人黄色影院| 国产精品麻豆网站| 欧美一级生活片| 91视频com| 国产精品99久久久久久久女警| 亚洲综合男人的天堂| 久久精品男人天堂av| 欧美喷潮久久久xxxxx| bt欧美亚洲午夜电影天堂| 免费在线观看一区| 亚洲精品综合在线| 国产偷国产偷亚洲高清人白洁 | 亚洲成人免费观看| 中文文精品字幕一区二区| 欧美精品乱码久久久久久 | 亚洲福利一区二区| 日本一区二区三区在线观看| 日韩欧美一区在线| 欧美日韩视频一区二区| 91在线视频18| 国产成人精品一区二| 狠狠色丁香婷综合久久| 日韩经典一区二区| 亚洲一区中文在线| 亚洲免费伊人电影| 中文字幕在线观看一区二区| 久久久久亚洲综合| 精品福利一二区| 欧美r级电影在线观看| 91麻豆精品国产91久久久久久| 日本电影亚洲天堂一区| 91在线免费看| 99在线视频精品| 99久久免费国产| 91在线视频播放地址| 91视频xxxx| 欧美怡红院视频| 欧美日韩一区在线| 欧美日韩精品一区二区天天拍小说| 色屁屁一区二区| 欧美在线一区二区| 欧美日韩二区三区| 91精品国产91久久久久久一区二区 | 国产高清一区日本| 国产成人av自拍| 国产suv一区二区三区88区| 国产成人综合自拍| 成人黄色小视频| av午夜一区麻豆| 色婷婷亚洲综合| 欧美视频一区二区| 这里只有精品免费| 日韩女优视频免费观看| 欧美精品一区二区在线播放| 国产丝袜欧美中文另类| 国产精品福利电影一区二区三区四区| 欧美经典一区二区三区| 中文字幕一区视频| 亚洲一卡二卡三卡四卡无卡久久| 亚洲3atv精品一区二区三区| 奇米影视在线99精品| 国内精品伊人久久久久av影院 | 欧美午夜精品理论片a级按摩| 精品视频一区三区九区| 日韩视频免费观看高清完整版在线观看 | 在线观看视频一区| 欧美精品在线观看一区二区| 精品国产乱码久久| 17c精品麻豆一区二区免费| 亚洲第一主播视频| 激情综合网天天干| 成人高清视频在线| 欧美高清dvd| 久久久不卡网国产精品二区| 亚洲色图第一区| 三级亚洲高清视频| 高清免费成人av| 欧美在线免费观看视频| 欧美精品一区二区三区很污很色的 | 视频在线在亚洲| 国产综合色精品一区二区三区| 不卡av在线免费观看| 欧美浪妇xxxx高跟鞋交| 国产日本欧洲亚洲| 午夜精品一区在线观看| 成人免费视频视频在线观看免费| 欧美日本在线观看| 国产精品人妖ts系列视频| 日韩高清在线一区| 不卡大黄网站免费看| 日韩精品一区在线观看| 亚洲精品日韩一| 国产精品18久久久久久久网站| 欧美日精品一区视频| 国产精品久久毛片| 久久99国产精品麻豆| 欧美日韩成人综合| 亚洲人吸女人奶水| 国产乱码精品一品二品| 欧美年轻男男videosbes| 国产精品久久久久久久午夜片| 日韩精品一二区| 色哟哟国产精品免费观看| 久久久99久久精品欧美| 青青国产91久久久久久| 欧美午夜在线一二页| 国产精品卡一卡二卡三| 国产高清不卡一区| 精品美女一区二区| 午夜国产不卡在线观看视频| 91麻豆.com| 中文字幕制服丝袜一区二区三区 | 国产精品国产a级| 国产一区91精品张津瑜| 欧美一区二区网站| 亚洲最色的网站| 色综合久久综合| 中文字幕在线观看不卡视频| 国产乱码精品一区二区三区忘忧草| 91精品国产91久久综合桃花| 亚洲一区二区三区在线看| 色狠狠综合天天综合综合| 成人欧美一区二区三区黑人麻豆 | 国产成人自拍在线| 日韩欧美一区二区免费| 日韩中文字幕av电影| 欧美群妇大交群的观看方式| 亚洲午夜精品久久久久久久久| 91麻豆视频网站| 亚洲丝袜美腿综合| 91猫先生在线| 一区二区激情视频| 在线精品视频小说1| 亚洲成人动漫精品| 欧美高清视频在线高清观看mv色露露十八| 一区二区三区四区中文字幕| 色婷婷国产精品综合在线观看| 亚洲情趣在线观看| 欧美中文字幕一区| 日韩一区欧美二区| 欧美电视剧免费观看| 国产一区二区中文字幕| 中文字幕免费观看一区| 成人免费视频caoporn| 亚洲视频在线一区二区| 色噜噜狠狠一区二区三区果冻| 一区二区三区中文字幕电影| 欧美图区在线视频| 免费看日韩精品| 久久久久国色av免费看影院| 成人综合婷婷国产精品久久免费| 亚洲欧洲精品一区二区三区 | 欧美一区二区久久| 久久国产精品99久久久久久老狼| 久久夜色精品一区| www.99精品| 天堂va蜜桃一区二区三区| 欧美成人精品福利| 成人中文字幕在线| 一个色综合av| 欧美tickling网站挠脚心| 成人综合婷婷国产精品久久蜜臀| 亚洲精品视频在线| 日韩一区二区电影网| 成人免费高清在线| 香港成人在线视频| 久久精品网站免费观看| 欧美亚洲国产一区在线观看网站| 蜜臀va亚洲va欧美va天堂| 中文文精品字幕一区二区| 欧美日韩在线播放三区|