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

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

?? strciphr.h

?? 研讀AxCrypt對加解密的處理方法
?? 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 SymmetricCipherFinal\<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, SymmetricCipherFinal 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"
#include "argnames.h"

NAMESPACE_BEGIN(CryptoPP)

template <class POLICY_INTERFACE, class BASE = Empty>
class CRYPTOPP_NO_VTABLE 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 CRYPTOPP_DLL CRYPTOPP_NO_VTABLE 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(lword 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 CRYPTOPP_NO_VTABLE 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 CRYPTOPP_NO_VTABLE 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 this->GetPolicy().GetBytesPerIteration();}
	unsigned int GetOptimalNextBlockSize() const {return this->m_leftOver;}
	unsigned int OptimalDataAlignment() const {return this->GetPolicy().GetAlignment();}
	bool IsSelfInverting() const {return true;}
	bool IsForwardTransformation() const {return true;}
	bool IsRandomAccess() const {return this->GetPolicy().IsRandomAccess();}
	void Seek(lword position);

	typedef typename BASE::PolicyInterface PolicyInterface;

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

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

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

	SecByteBlock m_buffer;
	unsigned int m_leftOver;
};

CRYPTOPP_DLL_TEMPLATE_CLASS TwoBases<SymmetricCipher, RandomNumberGenerator>;
CRYPTOPP_DLL_TEMPLATE_CLASS AbstractPolicyHolder<AdditiveCipherAbstractPolicy, TwoBases<SymmetricCipher, RandomNumberGenerator> >;
CRYPTOPP_DLL_TEMPLATE_CLASS AdditiveCipherTemplate<>;

class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CFB_CipherAbstractPolicy
{
public:
	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 CRYPTOPP_NO_VTABLE 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() {this->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 CRYPTOPP_NO_VTABLE 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 this->GetPolicy().GetBytesPerIteration();}
	unsigned int GetOptimalNextBlockSize() const {return m_leftOver;}
	unsigned int OptimalDataAlignment() const {return this->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, const byte *iv);

	unsigned int m_leftOver;
};

template <class BASE = AbstractPolicyHolder<CFB_CipherAbstractPolicy, SymmetricCipher> >
class CRYPTOPP_NO_VTABLE 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 CRYPTOPP_NO_VTABLE 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 CFB_RequireFullDataBlocks : public BASE
{
public:
	unsigned int MandatoryBlockSize() const {return this->OptimalBlockSize();}
};

// for Darwin
CRYPTOPP_DLL_TEMPLATE_CLASS CFB_CipherTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, SymmetricCipher> >;
CRYPTOPP_DLL_TEMPLATE_CLASS CFB_EncryptionTemplate<>;
CRYPTOPP_DLL_TEMPLATE_CLASS CFB_DecryptionTemplate<>;

//! _
template <class BASE, class INFO = BASE>
class SymmetricCipherFinal : public AlgorithmImpl<SimpleKeyingInterfaceImpl<BASE, INFO>, INFO>
{
public:
 	SymmetricCipherFinal() {}
	SymmetricCipherFinal(const byte *key)
		{SetKey(key, this->DEFAULT_KEYLENGTH);}
	SymmetricCipherFinal(const byte *key, unsigned int length)
		{SetKey(key, length);}
	SymmetricCipherFinal(const byte *key, unsigned int length, const byte *iv)
		{this->SetKeyWithIV(key, length, iv);}

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

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

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

	if (this->IsResynchronizable())
		policy.CipherResynchronize(m_buffer, iv);
}

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

	if (this->IsResynchronizable())
		policy.CipherResynchronize(iv);

	m_leftOver = policy.GetBytesPerIteration();
}

NAMESPACE_END

#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲综合色婷婷| 97se亚洲国产综合自在线 | 99热这里都是精品| 欧美体内she精高潮| 久久久99久久精品欧美| 亚洲综合999| 国产伦精一区二区三区| 欧美色精品天天在线观看视频| 精品粉嫩超白一线天av| 亚洲伊人伊色伊影伊综合网| 国产精品69毛片高清亚洲| 欧美久久免费观看| 综合激情成人伊人| 国产精品原创巨作av| 日韩三级中文字幕| 亚洲妇女屁股眼交7| av不卡免费在线观看| 精品粉嫩超白一线天av| 五月天激情小说综合| 色一情一乱一乱一91av| 国产精品女人毛片| 国产成人99久久亚洲综合精品| 欧美一级精品在线| 青青草97国产精品免费观看| 欧美亚洲日本一区| 一区二区三区在线观看动漫| 91丨porny丨中文| 自拍偷拍欧美精品| 91在线视频免费91| 亚洲日本一区二区| 91视视频在线观看入口直接观看www | 麻豆精品一区二区三区| 欧美在线免费观看亚洲| 一区二区三区欧美激情| 91香蕉视频污| 亚洲欧美影音先锋| 91蝌蚪porny| 亚洲欧美一区二区三区久本道91 | 久久精品99久久久| 日韩免费性生活视频播放| 日本最新不卡在线| 日韩欧美成人激情| 国产激情一区二区三区桃花岛亚洲| 26uuu亚洲综合色欧美| 国产福利91精品一区| 国产精品视频一区二区三区不卡| 成人av资源下载| 亚洲日本va在线观看| 欧美亚洲国产一区在线观看网站| 一区二区三区日韩欧美| 51精品视频一区二区三区| 欧美日韩国产一级| 亚洲成人av一区二区三区| 欧美日韩的一区二区| 蜜臀av一区二区三区| 精品久久久久久久久久久久久久久久久 | 中文字幕av一区二区三区免费看 | 国产盗摄一区二区| 亚洲欧美日韩久久| 欧美日韩亚洲综合一区| 美女高潮久久久| 久久综合给合久久狠狠狠97色69| 国产91色综合久久免费分享| 亚洲视频一区在线| 欧美日韩午夜精品| 国产一区二区精品久久99| 成人欧美一区二区三区视频网页| 欧美日韩国产欧美日美国产精品| 精品一区二区三区不卡| 亚洲欧美综合色| 日韩精品中文字幕在线不卡尤物| 粉嫩13p一区二区三区| 亚洲成人资源在线| 国产性做久久久久久| 欧美日韩久久久| 粉嫩av一区二区三区在线播放| 亚洲国产裸拍裸体视频在线观看乱了| 日韩一区二区免费在线电影| 一本久久精品一区二区| 久久99久久精品| 一区二区视频免费在线观看| 26uuu亚洲| 欧美日韩国产电影| 成人免费高清视频| 久久69国产一区二区蜜臀| 一区二区成人在线| 国产亚洲精品超碰| 69堂成人精品免费视频| 99久久er热在这里只有精品66| 毛片一区二区三区| 亚洲一区二区三区中文字幕在线| 久久久青草青青国产亚洲免观| 欧美日本国产视频| 色综合天天综合色综合av| 国产精品99久| 精品在线免费视频| 日韩经典一区二区| 亚洲黄色性网站| 国产精品久久综合| 久久精品视频免费观看| 日韩一区二区免费高清| 91搞黄在线观看| 99久久久免费精品国产一区二区| 国产精品亚洲成人| 国产一区三区三区| 久久福利资源站| 日本亚洲最大的色成网站www| 夜夜嗨av一区二区三区中文字幕| 国产精品久久久久aaaa樱花| 久久久久久久精| 久久久777精品电影网影网 | 国产成人高清视频| 久久国内精品视频| 麻豆精品国产传媒mv男同| 日韩在线a电影| 日日夜夜免费精品| 天天色综合成人网| 日韩**一区毛片| 久久精品国产网站| 精品一区二区免费看| 久草中文综合在线| 国产一区在线不卡| 成人教育av在线| 99riav一区二区三区| 一本色道久久综合亚洲精品按摩| 欧洲色大大久久| 欧美老女人在线| 欧美精品一区在线观看| 欧美激情一区三区| 一区二区三区精品| 日韩成人免费在线| 国产精品中文字幕一区二区三区| 成人av在线资源网站| 日本大香伊一区二区三区| 欧美日韩精品一区二区三区| 日韩一区二区三区视频在线| 久久久精品免费观看| 中文字幕一区二区三| 一区二区三区精品久久久| 性欧美大战久久久久久久久| 免费一级欧美片在线观看| 韩国在线一区二区| 99精品欧美一区二区三区小说| 欧美亚洲综合在线| 日韩午夜三级在线| 国产日产亚洲精品系列| 亚洲免费观看高清完整版在线观看熊 | 精品日韩一区二区| 中文字幕欧美日韩一区| 亚洲日本免费电影| 奇米精品一区二区三区四区| 国产999精品久久久久久绿帽| 99国产精品视频免费观看| 欧美日韩国产片| 国产精品无人区| 人禽交欧美网站| 懂色一区二区三区免费观看| 欧美亚洲国产怡红院影院| 亚洲精品一区二区三区蜜桃下载| 中文字幕字幕中文在线中不卡视频| 亚洲bt欧美bt精品777| 国产一区二区免费在线| 欧美日韩免费观看一区三区| 国产午夜精品久久久久久久| 五月天一区二区| 成人福利视频网站| 欧美成人vr18sexvr| 亚洲卡通欧美制服中文| 韩国精品久久久| 69久久99精品久久久久婷婷| 国产精品三级在线观看| 麻豆视频一区二区| 在线看不卡av| 国产精品女主播av| 久久99在线观看| 欧美日韩aaa| 亚洲欧美国产毛片在线| 国内精品自线一区二区三区视频| 欧美午夜一区二区三区| 国产精品久久久久婷婷| 国产综合久久久久久鬼色| 日韩色在线观看| 青青草原综合久久大伊人精品优势| 色综合视频一区二区三区高清| 久久久不卡网国产精品一区| 精品无人区卡一卡二卡三乱码免费卡| 日本韩国欧美国产| 中文字幕在线播放不卡一区| 国产福利不卡视频| 久久精品在线观看| 国产一区二区精品久久| 久久综合久久鬼色中文字| 老司机精品视频一区二区三区| 欧美浪妇xxxx高跟鞋交| 午夜成人在线视频| 欧美日本高清视频在线观看| 日韩精品乱码免费| 日韩午夜小视频| 精品一区二区免费视频| 久久女同精品一区二区|