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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? strciphr.h

?? 加密函數庫:包括多種加密解密算法,數字簽名,散列算法
?? H
字號:
/*! \file
 	This file contains helper classes for implementing stream ciphers.

	All this infrastructure may look very complex compared to what's in Crypto++ 4.x,
	but stream ciphers implementations now support a lot of new functionality,
	including better performance (minimizing copying), resetting of keys and IVs, and methods to
	query which features are supported by a cipher.

	Here's an explanation of these classes. The word "policy" is used here to mean a class with a
	set of methods that must be implemented by individual stream cipher implementations.
	This is usually much simpler than the full stream cipher API, which is implemented by
	either AdditiveCipherTemplate or CFB_CipherTemplate using the policy. So for example, an
	implementation of SEAL only needs to implement the AdditiveCipherAbstractPolicy interface
	(since it's an additive cipher, i.e., it xors a keystream into the plaintext).
	See this line in seal.h:

	typedef SymmetricCipherFinalTemplate<ConcretePolicyHolder<SEAL_Policy<B>, AdditiveCipherTemplate<> > > Encryption;

	AdditiveCipherTemplate and CFB_CipherTemplate are designed so that they don't need
	to take a policy class as a template parameter (although this is allowed), so that
	their code is not duplicated for each new cipher. Instead they each
	get a reference to an abstract policy interface by calling AccessPolicy() on itself, so
	AccessPolicy() must be overriden to return the actual policy reference. This is done
	by the ConceretePolicyHolder class. Finally, SymmetricCipherFinalTemplate implements the constructors and
	other functions that must be implemented by the most derived class.
*/

#ifndef CRYPTOPP_STRCIPHR_H
#define CRYPTOPP_STRCIPHR_H

#include "seckey.h"
#include "secblock.h"

NAMESPACE_BEGIN(CryptoPP)

template <class POLICY_INTERFACE, class BASE = Empty>
class AbstractPolicyHolder : public BASE
{
public:
	typedef POLICY_INTERFACE PolicyInterface;

protected:
	virtual const POLICY_INTERFACE & GetPolicy() const =0;
	virtual POLICY_INTERFACE & AccessPolicy() =0;
};

template <class POLICY, class BASE, class POLICY_INTERFACE = CPP_TYPENAME BASE::PolicyInterface>
class ConcretePolicyHolder : public BASE, protected POLICY
{
protected:
	const POLICY_INTERFACE & GetPolicy() const {return *this;}
	POLICY_INTERFACE & AccessPolicy() {return *this;}
};

enum KeystreamOperation {WRITE_KEYSTREAM, XOR_KEYSTREAM, XOR_KEYSTREAM_INPLACE};

struct AdditiveCipherAbstractPolicy
{
	virtual unsigned int GetAlignment() const =0;
	virtual unsigned int GetBytesPerIteration() const =0;
	virtual unsigned int GetIterationsToBuffer() const =0;
	virtual void WriteKeystream(byte *keystreamBuffer, unsigned int iterationCount) =0;
	virtual bool CanOperateKeystream() const {return false;}
	virtual void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, unsigned int iterationCount) {assert(false);}
	virtual void CipherSetKey(const NameValuePairs &params, const byte *key, unsigned int length) =0;
	virtual void CipherResynchronize(byte *keystreamBuffer, const byte *iv) {throw NotImplemented("StreamTransformation: this object doesn't support resynchronization");}
	virtual bool IsRandomAccess() const =0;
	virtual void SeekToIteration(dword iterationCount) {assert(!IsRandomAccess()); throw NotImplemented("StreamTransformation: this object doesn't support random access");}
};

template <typename WT, unsigned int W, unsigned int X = 1, class BASE = AdditiveCipherAbstractPolicy>
struct AdditiveCipherConcretePolicy : public BASE
{
	typedef WT WordType;

	unsigned int GetAlignment() const {return sizeof(WordType);}
	unsigned int GetBytesPerIteration() const {return sizeof(WordType) * W;}
	unsigned int GetIterationsToBuffer() const {return X;}
	void WriteKeystream(byte *buffer, unsigned int iterationCount)
		{OperateKeystream(WRITE_KEYSTREAM, buffer, NULL, iterationCount);}
	bool CanOperateKeystream() const {return true;}
	virtual void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, unsigned int iterationCount) =0;

	template <class B>
	struct KeystreamOutput
	{
		KeystreamOutput(KeystreamOperation operation, byte *output, const byte *input)
			: m_operation(operation), m_output(output), m_input(input) {}

		inline KeystreamOutput & operator()(WordType keystreamWord)
		{
			assert(IsAligned<WordType>(m_input));
			assert(IsAligned<WordType>(m_output));

			if (!NativeByteOrderIs(B::ToEnum()))
				keystreamWord = ByteReverse(keystreamWord);

			if (m_operation == WRITE_KEYSTREAM)
				*(WordType*)m_output = keystreamWord;
			else if (m_operation == XOR_KEYSTREAM)
			{
				*(WordType*)m_output = keystreamWord ^ *(WordType*)m_input;
				m_input += sizeof(WordType);
			}
			else if (m_operation == XOR_KEYSTREAM_INPLACE)
				*(WordType*)m_output ^= keystreamWord;

			m_output += sizeof(WordType);

			return *this;
		}

		KeystreamOperation m_operation;
		byte *m_output;
		const byte *m_input;
	};
};

template <class BASE = AbstractPolicyHolder<AdditiveCipherAbstractPolicy, TwoBases<SymmetricCipher, RandomNumberGenerator> > >
class AdditiveCipherTemplate : public BASE
{
public:
    byte GenerateByte();
    void ProcessData(byte *outString, const byte *inString, unsigned int length);
	void Resynchronize(const byte *iv);
	unsigned int OptimalBlockSize() const {return GetPolicy().GetBytesPerIteration();}
	unsigned int GetOptimalNextBlockSize() const {return m_leftOver;}
	unsigned int OptimalDataAlignment() const {return GetPolicy().GetAlignment();}
	bool IsSelfInverting() const {return true;}
	bool IsForwardTransformation() const {return true;}
	bool IsRandomAccess() const {return GetPolicy().IsRandomAccess();}
	void Seek(dword position);

	typedef typename BASE::PolicyInterface PolicyInterface;

protected:
	void UncheckedSetKey(const NameValuePairs &params, const byte *key, unsigned int length);

	unsigned int GetBufferByteSize(const PolicyInterface &policy) const {return policy.GetBytesPerIteration() * policy.GetIterationsToBuffer();}

	inline byte * KeystreamBufferBegin() {return m_buffer.data();}
	inline byte * KeystreamBufferEnd() {return (m_buffer.data() + m_buffer.size());}

	SecByteBlock m_buffer;
	unsigned int m_leftOver;
};

struct CFB_CipherAbstractPolicy
{
	virtual unsigned int GetAlignment() const =0;
	virtual unsigned int GetBytesPerIteration() const =0;
	virtual byte * GetRegisterBegin() =0;
	virtual void TransformRegister() =0;
	virtual bool CanIterate() const {return false;}
	virtual void Iterate(byte *output, const byte *input, CipherDir dir, unsigned int iterationCount) {assert(false);}
	virtual void CipherSetKey(const NameValuePairs &params, const byte *key, unsigned int length) =0;
	virtual void CipherResynchronize(const byte *iv) {throw NotImplemented("StreamTransformation: this object doesn't support resynchronization");}
};

template <typename WT, unsigned int W, class BASE = CFB_CipherAbstractPolicy>
struct CFB_CipherConcretePolicy : public BASE
{
	typedef WT WordType;

	unsigned int GetAlignment() const {return sizeof(WordType);}
	unsigned int GetBytesPerIteration() const {return sizeof(WordType) * W;}
	bool CanIterate() const {return true;}
	void TransformRegister() {Iterate(NULL, NULL, ENCRYPTION, 1);}

	template <class B>
	struct RegisterOutput
	{
		RegisterOutput(byte *output, const byte *input, CipherDir dir)
			: m_output(output), m_input(input), m_dir(dir) {}

		inline RegisterOutput& operator()(WordType &registerWord)
		{
			assert(IsAligned<WordType>(m_output));
			assert(IsAligned<WordType>(m_input));

			if (!NativeByteOrderIs(B::ToEnum()))
				registerWord = ByteReverse(registerWord);

			if (m_dir == ENCRYPTION)
			{
				WordType ct = *(const WordType *)m_input ^ registerWord;
				registerWord = ct;
				*(WordType*)m_output = ct;
				m_input += sizeof(WordType);
				m_output += sizeof(WordType);
			}
			else
			{
				WordType ct = *(const WordType *)m_input;
				*(WordType*)m_output = registerWord ^ ct;
				registerWord = ct;
				m_input += sizeof(WordType);
				m_output += sizeof(WordType);
			}

			// registerWord is left unreversed so it can be xor-ed with further input

			return *this;
		}

		byte *m_output;
		const byte *m_input;
		CipherDir m_dir;
	};
};

template <class BASE>
class CFB_CipherTemplate : public BASE
{
public:
	void ProcessData(byte *outString, const byte *inString, unsigned int length);
	void Resynchronize(const byte *iv);
	unsigned int OptimalBlockSize() const {return GetPolicy().GetBytesPerIteration();}
	unsigned int GetOptimalNextBlockSize() const {return m_leftOver;}
	unsigned int OptimalDataAlignment() const {return GetPolicy().GetAlignment();}
	bool IsRandomAccess() const {return false;}
	bool IsSelfInverting() const {return false;}

	typedef typename BASE::PolicyInterface PolicyInterface;

protected:
	virtual void CombineMessageAndShiftRegister(byte *output, byte *reg, const byte *message, unsigned int length) =0;

	void UncheckedSetKey(const NameValuePairs &params, const byte *key, unsigned int length);

	unsigned int m_leftOver;
};

template <class BASE = AbstractPolicyHolder<CFB_CipherAbstractPolicy, SymmetricCipher> >
class CFB_EncryptionTemplate : public CFB_CipherTemplate<BASE>
{
	bool IsForwardTransformation() const {return true;}
	void CombineMessageAndShiftRegister(byte *output, byte *reg, const byte *message, unsigned int length);
};

template <class BASE = AbstractPolicyHolder<CFB_CipherAbstractPolicy, SymmetricCipher> >
class CFB_DecryptionTemplate : public CFB_CipherTemplate<BASE>
{
	bool IsForwardTransformation() const {return false;}
	void CombineMessageAndShiftRegister(byte *output, byte *reg, const byte *message, unsigned int length);
};

template <class BASE, class INFO = BASE>
class SymmetricCipherFinalTemplate : public AlgorithmImpl<SimpleKeyingInterfaceImpl<BASE, INFO>, INFO>
{
public:
 	SymmetricCipherFinalTemplate() {}
	SymmetricCipherFinalTemplate(const byte *key)
		{SetKey(key, DEFAULT_KEYLENGTH);}
	SymmetricCipherFinalTemplate(const byte *key, unsigned int length)
		{SetKey(key, length);}
	SymmetricCipherFinalTemplate(const byte *key, unsigned int length, const byte *iv)
		{SetKey(key, length); Resynchronize(iv);}

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

	Clonable * Clone() const {return static_cast<SymmetricCipher *>(new SymmetricCipherFinalTemplate<BASE, INFO>(*this));}
};

template <class S>
void AdditiveCipherTemplate<S>::UncheckedSetKey(const NameValuePairs &params, const byte *key, unsigned int length)
{
	PolicyInterface &policy = AccessPolicy();
	policy.CipherSetKey(params, key, length);
	m_buffer.New(GetBufferByteSize(policy));
	m_leftOver = 0;
}

template <class BASE>
void CFB_CipherTemplate<BASE>::UncheckedSetKey(const NameValuePairs &params, const byte *key, unsigned int length)
{
	PolicyInterface &policy = AccessPolicy();
	policy.CipherSetKey(params, key, length);
	m_leftOver = policy.GetBytesPerIteration();
}

NAMESPACE_END

#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美国产在线观看| 欧美日本一区二区三区四区| 久久久久久久综合日本| 国精产品一区一区三区mba视频| 日韩一级视频免费观看在线| 爽好多水快深点欧美视频| 在线不卡a资源高清| 日本 国产 欧美色综合| 日韩三级伦理片妻子的秘密按摩| 麻豆精品视频在线| 久久久亚洲精华液精华液精华液| 国产凹凸在线观看一区二区| 中文字幕成人av| 91久久精品国产91性色tv| 亚洲v精品v日韩v欧美v专区| 欧美一区二区三区在线观看视频 | 欧美日韩亚洲综合一区二区三区| 亚洲图片有声小说| 欧美一级在线视频| 国产精品一区久久久久| 中文字幕日韩一区二区| 欧美三级蜜桃2在线观看| 美女精品一区二区| 国产日韩欧美精品电影三级在线| 99久久国产综合精品色伊| 午夜激情综合网| 欧美国产丝袜视频| 欧美在线视频不卡| 久久99久久99精品免视看婷婷| 国产精品日日摸夜夜摸av| 色婷婷一区二区三区四区| 天堂精品中文字幕在线| 国产亚洲美州欧州综合国| 91丨porny丨最新| 美国三级日本三级久久99| 国产精品女主播在线观看| 欧美伦理电影网| 成人小视频在线观看| 成人福利视频在线看| 亚洲一区二区三区四区五区中文| 日韩欧美一区二区视频| 不卡在线观看av| 男男成人高潮片免费网站| 国产精品国产三级国产aⅴ入口| 欧美日韩高清影院| bt欧美亚洲午夜电影天堂| 日本免费新一区视频| 亚洲男同1069视频| 久久亚洲捆绑美女| 欧美日韩日本视频| 不卡的电影网站| 狠狠色综合播放一区二区| 一区二区三区在线播| 国产欧美日韩在线观看| 欧美一区二区三区在线视频| 在线视频欧美精品| www.久久久久久久久| 精品一区二区三区免费视频| 亚洲成人综合在线| 亚洲人成小说网站色在线| 久久久久久久久久美女| 欧美一级二级三级蜜桃| 欧美日韩激情一区| 91久久精品网| 99国产精品国产精品久久| 国产成人综合亚洲网站| 美女任你摸久久 | 久久亚洲影视婷婷| 日韩视频国产视频| 欧美美女喷水视频| 欧洲精品视频在线观看| 91精品办公室少妇高潮对白| 成人性视频网站| 高清在线成人网| 国产毛片精品视频| 久久99九九99精品| 经典三级在线一区| 精久久久久久久久久久| 久久精品国产秦先生| 美女性感视频久久| 精品一区二区在线免费观看| 麻豆久久久久久| 久久不见久久见免费视频1| 理论电影国产精品| 狠狠v欧美v日韩v亚洲ⅴ| 久久99日本精品| 国产一区二区伦理| 国产一区三区三区| 国产精品18久久久久久久久| 国产精品538一区二区在线| 国产成人午夜视频| yourporn久久国产精品| 91网页版在线| 欧美另类videos死尸| 制服丝袜av成人在线看| 日韩欧美区一区二| 久久久久久久久久久黄色| 国产欧美一区二区三区在线看蜜臀| 国产日本亚洲高清| 最新中文字幕一区二区三区| 一个色在线综合| 琪琪一区二区三区| 黄网站免费久久| 99精品热视频| 欧美日韩高清一区二区三区| 欧美一区二区视频在线观看2022| 精品人在线二区三区| 国产精品久久久久久久浪潮网站| 亚洲欧美激情插| 日韩不卡一区二区三区| 精品中文字幕一区二区小辣椒| 国产精品1区二区.| 欧美亚洲国产bt| wwwwxxxxx欧美| 国产91丝袜在线播放九色| 色婷婷综合中文久久一本| 91麻豆精品国产自产在线观看一区| 精品国产乱子伦一区| 国产精品免费久久| 日日摸夜夜添夜夜添国产精品 | 欧美日韩午夜影院| 欧美精品一区二区三| 中文字幕永久在线不卡| 日韩av不卡在线观看| 成人视屏免费看| 制服.丝袜.亚洲.中文.综合| 国产精品久久久久天堂| 天天影视涩香欲综合网| 成人手机电影网| 日韩欧美国产一区二区在线播放 | 久久久久久久久一| 亚洲小说春色综合另类电影| 国产一区视频导航| 欧美疯狂做受xxxx富婆| 国产精品国产自产拍在线| 蜜芽一区二区三区| 色播五月激情综合网| 日韩精品在线看片z| 亚洲激情成人在线| 高清视频一区二区| 日韩一级免费观看| 亚洲在线视频免费观看| 丁香六月综合激情| 欧美年轻男男videosbes| 国产精品美女久久久久久| 激情综合色播激情啊| 在线观看精品一区| 国产精品福利av| 国产一区二区三区黄视频 | 欧美大片国产精品| 亚洲高清在线视频| 91女厕偷拍女厕偷拍高清| 久久影院视频免费| 麻豆精品一区二区综合av| 91官网在线免费观看| 国产精品国产自产拍高清av王其| 久久福利资源站| 日韩一本二本av| 日本va欧美va欧美va精品| 欧美亚洲高清一区| 亚洲天堂免费看| 国产98色在线|日韩| 国产日韩精品一区二区浪潮av | 在线精品视频一区二区三四| 国产精品视频第一区| 国产v日产∨综合v精品视频| 精品国产亚洲一区二区三区在线观看| 亚洲综合自拍偷拍| 91一区二区三区在线播放| 国产精品久久看| 91在线免费看| 一区二区三区高清在线| 色噜噜狠狠色综合中国| 国产精品久久久久永久免费观看| 国产精品羞羞答答xxdd| 国产精品久久久久久久岛一牛影视| 1024成人网| 99国产精品99久久久久久| 中文字幕一区二区三区不卡在线| 国产福利一区二区| 国产欧美一区二区精品久导航| 国产乱一区二区| 国产午夜精品一区二区三区嫩草| 国产永久精品大片wwwapp| 国产偷v国产偷v亚洲高清| 国产成人精品免费在线| 国产日韩欧美精品综合| 激情亚洲综合在线| 久久久激情视频| 成人免费观看视频| 亚洲激情成人在线| 在线综合亚洲欧美在线视频 | 日韩av二区在线播放| 日韩午夜在线观看| 狠狠狠色丁香婷婷综合激情| 国产日韩欧美麻豆| 97超碰欧美中文字幕| 亚洲线精品一区二区三区八戒| 51精品秘密在线观看| 国产精品一区二区在线观看不卡 |