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

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

?? filters.h

?? 加密函數庫:包括多種加密解密算法,數字簽名,散列算法
?? H
?? 第 1 頁 / 共 2 頁
字號:
#ifndef CRYPTOPP_FILTERS_H
#define CRYPTOPP_FILTERS_H

#include "simple.h"
#include "secblock.h"
#include "misc.h"
#include "smartptr.h"
#include "queue.h"
#include "algparam.h"

NAMESPACE_BEGIN(CryptoPP)

/// provides an implementation of BufferedTransformation's attachment interface
class Filter : public BufferedTransformation, public NotCopyable
{
public:
	Filter(BufferedTransformation *attachment);

	bool Attachable() {return true;}
	BufferedTransformation *AttachedTransformation();
	const BufferedTransformation *AttachedTransformation() const;
	void Detach(BufferedTransformation *newAttachment = NULL);

	unsigned int TransferTo2(BufferedTransformation &target, unsigned long &transferBytes, const std::string &channel=NULL_CHANNEL, bool blocking=true);
	unsigned int CopyRangeTo2(BufferedTransformation &target, unsigned long &begin, unsigned long end=ULONG_MAX, const std::string &channel=NULL_CHANNEL, bool blocking=true) const;

	void Initialize(const NameValuePairs &parameters=g_nullNameValuePairs, int propagation=-1);
	bool Flush(bool hardFlush, int propagation=-1, bool blocking=true);
	bool MessageSeriesEnd(int propagation=-1, bool blocking=true);

protected:
	virtual void NotifyAttachmentChange() {}
	virtual BufferedTransformation * NewDefaultAttachment() const;
	void Insert(Filter *nextFilter);	// insert filter after this one

	virtual bool ShouldPropagateMessageEnd() const {return true;}
	virtual bool ShouldPropagateMessageSeriesEnd() const {return true;}

	void PropagateInitialize(const NameValuePairs &parameters, int propagation, const std::string &channel=NULL_CHANNEL);

	unsigned int Output(int outputSite, const byte *inString, unsigned int length, int messageEnd, bool blocking, const std::string &channel=NULL_CHANNEL);
	bool OutputMessageEnd(int outputSite, int propagation, bool blocking, const std::string &channel=NULL_CHANNEL);
	bool OutputFlush(int outputSite, bool hardFlush, int propagation, bool blocking, const std::string &channel=NULL_CHANNEL);
	bool OutputMessageSeriesEnd(int outputSite, int propagation, bool blocking, const std::string &channel=NULL_CHANNEL);

private:
	member_ptr<BufferedTransformation> m_attachment;
	
protected:
	unsigned int m_inputPosition;
	int m_continueAt;
};

struct FilterPutSpaceHelper
{
	// desiredSize is how much to ask target, bufferSize is how much to allocate in m_tempSpace
	byte *HelpCreatePutSpace(BufferedTransformation &target, const std::string &channel, unsigned int minSize, unsigned int desiredSize, unsigned int &bufferSize)
	{
		assert(desiredSize >= minSize && bufferSize >= minSize);
		if (m_tempSpace.size() < minSize)
		{
			byte *result = target.ChannelCreatePutSpace(channel, desiredSize);
			if (desiredSize >= minSize)
			{
				bufferSize = desiredSize;
				return result;
			}
			m_tempSpace.New(bufferSize);
		}

		bufferSize = m_tempSpace.size();
		return m_tempSpace.begin();
	}
	byte *HelpCreatePutSpace(BufferedTransformation &target, const std::string &channel, unsigned int minSize)
		{return HelpCreatePutSpace(target, channel, minSize, minSize, minSize);}
	byte *HelpCreatePutSpace(BufferedTransformation &target, const std::string &channel, unsigned int minSize, unsigned int bufferSize)
		{return HelpCreatePutSpace(target, channel, minSize, minSize, bufferSize);}
	SecByteBlock m_tempSpace;
};

//! measure how many byte and messages pass through, also serves as valve
class MeterFilter : public Bufferless<Filter>
{
public:
	MeterFilter(BufferedTransformation *attachment=NULL, bool transparent=true)
		: Bufferless<Filter>(attachment), m_transparent(transparent) {ResetMeter();}

	void SetTransparent(bool transparent) {m_transparent = transparent;}
	void ResetMeter() {m_currentMessageBytes = m_totalBytes = m_currentSeriesMessages = m_totalMessages = m_totalMessageSeries = 0;}

	unsigned long GetCurrentMessageBytes() const {return m_currentMessageBytes;}
	unsigned long GetTotalBytes() {return m_totalBytes;}
	unsigned int GetCurrentSeriesMessages() {return m_currentSeriesMessages;}
	unsigned int GetTotalMessages() {return m_totalMessages;}
	unsigned int GetTotalMessageSeries() {return m_totalMessageSeries;}

	unsigned int Put2(const byte *begin, unsigned int length, int messageEnd, bool blocking);
	bool IsolatedMessageSeriesEnd(bool blocking);

private:
	bool ShouldPropagateMessageEnd() const {return m_transparent;}
	bool ShouldPropagateMessageSeriesEnd() const {return m_transparent;}

	bool m_transparent;
	unsigned long m_currentMessageBytes, m_totalBytes;
	unsigned int m_currentSeriesMessages, m_totalMessages, m_totalMessageSeries;
};

//! .
class TransparentFilter : public MeterFilter
{
public:
	TransparentFilter(BufferedTransformation *attachment=NULL) : MeterFilter(attachment, true) {}
};

//! .
class OpaqueFilter : public MeterFilter
{
public:
	OpaqueFilter(BufferedTransformation *attachment=NULL) : MeterFilter(attachment, false) {}
};

/*! FilterWithBufferedInput divides up the input stream into
	a first block, a number of middle blocks, and a last block.
	First and last blocks are optional, and middle blocks may
	be a stream instead (i.e. blockSize == 1).
*/
class FilterWithBufferedInput : public Filter
{
public:
	FilterWithBufferedInput(BufferedTransformation *attachment);
	//! firstSize and lastSize may be 0, blockSize must be at least 1
	FilterWithBufferedInput(unsigned int firstSize, unsigned int blockSize, unsigned int lastSize, BufferedTransformation *attachment);

	void IsolatedInitialize(const NameValuePairs &parameters);
	unsigned int Put2(const byte *inString, unsigned int length, int messageEnd, bool blocking)
	{
		return PutMaybeModifiable(const_cast<byte *>(inString), length, messageEnd, blocking, false);
	}
	unsigned int PutModifiable2(byte *inString, unsigned int length, int messageEnd, bool blocking)
	{
		return PutMaybeModifiable(inString, length, messageEnd, blocking, true);
	}
	/*! calls ForceNextPut() if hardFlush is true */
	bool IsolatedFlush(bool hardFlush, bool blocking);

	/*! The input buffer may contain more than blockSize bytes if lastSize != 0.
		ForceNextPut() forces a call to NextPut() if this is the case.
	*/
	void ForceNextPut();

protected:
	bool DidFirstPut() {return m_firstInputDone;}

	virtual void InitializeDerivedAndReturnNewSizes(const NameValuePairs &parameters, unsigned int &firstSize, unsigned int &blockSize, unsigned int &lastSize)
		{InitializeDerived(parameters);}
	virtual void InitializeDerived(const NameValuePairs &parameters) {}
	// FirstPut() is called if (firstSize != 0 and totalLength >= firstSize)
	// or (firstSize == 0 and (totalLength > 0 or a MessageEnd() is received))
	virtual void FirstPut(const byte *inString) =0;
	// NextPut() is called if totalLength >= firstSize+blockSize+lastSize
	virtual void NextPutSingle(const byte *inString) {assert(false);}
	// Same as NextPut() except length can be a multiple of blockSize
	// Either NextPut() or NextPutMultiple() must be overriden
	virtual void NextPutMultiple(const byte *inString, unsigned int length);
	// Same as NextPutMultiple(), but inString can be modified
	virtual void NextPutModifiable(byte *inString, unsigned int length)
		{NextPutMultiple(inString, length);}
	// LastPut() is always called
	// if totalLength < firstSize then length == totalLength
	// else if totalLength <= firstSize+lastSize then length == totalLength-firstSize
	// else lastSize <= length < lastSize+blockSize
	virtual void LastPut(const byte *inString, unsigned int length) =0;
	virtual void FlushDerived() {}

private:
	unsigned int PutMaybeModifiable(byte *begin, unsigned int length, int messageEnd, bool blocking, bool modifiable);
	void NextPutMaybeModifiable(byte *inString, unsigned int length, bool modifiable)
	{
		if (modifiable) NextPutModifiable(inString, length);
		else NextPutMultiple(inString, length);
	}

	// This function should no longer be used, put this here to cause a compiler error
	// if someone tries to override NextPut().
	virtual int NextPut(const byte *inString, unsigned int length) {assert(false); return 0;}

	class BlockQueue
	{
	public:
		void ResetQueue(unsigned int blockSize, unsigned int maxBlocks);
		byte *GetBlock();
		byte *GetContigousBlocks(unsigned int &numberOfBytes);
		unsigned int GetAll(byte *outString);
		void Put(const byte *inString, unsigned int length);
		unsigned int CurrentSize() const {return m_size;}
		unsigned int MaxSize() const {return m_buffer.size();}

	private:
		SecByteBlock m_buffer;
		unsigned int m_blockSize, m_maxBlocks, m_size;
		byte *m_begin;
	};

	unsigned int m_firstSize, m_blockSize, m_lastSize;
	bool m_firstInputDone;
	BlockQueue m_queue;
};

//! .
class FilterWithInputQueue : public Filter
{
public:
	FilterWithInputQueue(BufferedTransformation *attachment) : Filter(attachment) {}
	unsigned int Put2(const byte *inString, unsigned int length, int messageEnd, bool blocking)
	{
		if (!blocking)
			throw BlockingInputOnly("FilterWithInputQueue");
		
		m_inQueue.Put(inString, length);
		if (messageEnd)
		{
			IsolatedMessageEnd(blocking);
			Output(0, NULL, 0, messageEnd, blocking);
		}
		return 0;
	}

protected:
	virtual bool IsolatedMessageEnd(bool blocking) =0;
	void IsolatedInitialize(const NameValuePairs &parameters) {m_inQueue.Clear();}

	ByteQueue m_inQueue;
};

//! Filter Wrapper for StreamTransformation
class StreamTransformationFilter : public FilterWithBufferedInput, private FilterPutSpaceHelper
{
public:
	enum BlockPaddingScheme {NO_PADDING, ZEROS_PADDING, PKCS_PADDING, ONE_AND_ZEROS_PADDING, DEFAULT_PADDING};
	/*! DEFAULT_PADDING means PKCS_PADDING if c.MandatoryBlockSize() > 1 && c.MinLastBlockSize() == 0 (e.g. ECB or CBC mode),
		otherwise NO_PADDING (OFB, CFB, CTR, CBC-CTS modes) */
	StreamTransformationFilter(StreamTransformation &c, BufferedTransformation *attachment = NULL, BlockPaddingScheme padding = DEFAULT_PADDING);

	void FirstPut(const byte *inString);
	void NextPutMultiple(const byte *inString, unsigned int length);
	void NextPutModifiable(byte *inString, unsigned int length);
	void LastPut(const byte *inString, unsigned int length);
//	byte * CreatePutSpace(unsigned int &size);

protected:
	static unsigned int LastBlockSize(StreamTransformation &c, BlockPaddingScheme padding);

	StreamTransformation &m_cipher;
	BlockPaddingScheme m_padding;
	unsigned int m_optimalBufferSize;
};

#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY
typedef StreamTransformationFilter StreamCipherFilter;
#endif

//! Filter Wrapper for HashTransformation
class HashFilter : public Bufferless<Filter>, private FilterPutSpaceHelper
{
public:
	HashFilter(HashTransformation &hm, BufferedTransformation *attachment = NULL, bool putMessage=false)
		: Bufferless<Filter>(attachment), m_hashModule(hm), m_putMessage(putMessage) {}

	void IsolatedInitialize(const NameValuePairs &parameters);
	unsigned int Put2(const byte *begin, unsigned int length, int messageEnd, bool blocking);

	byte * CreatePutSpace(unsigned int &size) {return m_hashModule.CreateUpdateSpace(size);}

private:
	HashTransformation &m_hashModule;
	bool m_putMessage;
	byte *m_space;
};

//! Filter Wrapper for HashTransformation
class HashVerificationFilter : public FilterWithBufferedInput
{
public:
	class HashVerificationFailed : public Exception
	{
	public:
		HashVerificationFailed()
			: Exception(DATA_INTEGRITY_CHECK_FAILED, "HashVerifier: message hash not valid") {}
	};

	enum Flags {HASH_AT_BEGIN=1, PUT_MESSAGE=2, PUT_HASH=4, PUT_RESULT=8, THROW_EXCEPTION=16, DEFAULT_FLAGS = HASH_AT_BEGIN | PUT_RESULT};
	HashVerificationFilter(HashTransformation &hm, BufferedTransformation *attachment = NULL, word32 flags = DEFAULT_FLAGS);

	bool GetLastResult() const {return m_verified;}

protected:
	void InitializeDerivedAndReturnNewSizes(const NameValuePairs &parameters, unsigned int &firstSize, unsigned int &blockSize, unsigned int &lastSize);
	void FirstPut(const byte *inString);
	void NextPutMultiple(const byte *inString, unsigned int length);
	void LastPut(const byte *inString, unsigned int length);

private:
	static inline unsigned int FirstSize(word32 flags, HashTransformation &hm) {return flags & HASH_AT_BEGIN ? hm.DigestSize() : 0;}
	static inline unsigned int LastSize(word32 flags, HashTransformation &hm) {return flags & HASH_AT_BEGIN ? 0 : hm.DigestSize();}

	HashTransformation &m_hashModule;
	word32 m_flags;
	SecByteBlock m_expectedHash;
	bool m_verified;
};

typedef HashVerificationFilter HashVerifier;	// for backwards compatibility

//! Filter Wrapper for PK_Signer
class SignerFilter : public Unflushable<Filter>
{
public:
	SignerFilter(RandomNumberGenerator &rng, const PK_Signer &signer, BufferedTransformation *attachment = NULL, bool putMessage=false)
		: Unflushable<Filter>(attachment), m_rng(rng), m_signer(signer), m_messageAccumulator(signer.NewSignatureAccumulator()), m_putMessage(putMessage) {}

	void IsolatedInitialize(const NameValuePairs &parameters);
	unsigned int Put2(const byte *begin, unsigned int length, int messageEnd, bool blocking);

private:
	RandomNumberGenerator &m_rng;
	const PK_Signer	&m_signer;
	member_ptr<PK_MessageAccumulator> m_messageAccumulator;
	bool m_putMessage;
	SecByteBlock m_buf;
};

//! Filter Wrapper for PK_Verifier
class SignatureVerificationFilter : public FilterWithBufferedInput
{
public:
	class SignatureVerificationFailed : public Exception
	{
	public:
		SignatureVerificationFailed()
			: Exception(DATA_INTEGRITY_CHECK_FAILED, "VerifierFilter: digital signature not valid") {}
	};

	enum Flags {SIGNATURE_AT_BEGIN=1, PUT_MESSAGE=2, PUT_SIGNATURE=4, PUT_RESULT=8, THROW_EXCEPTION=16, DEFAULT_FLAGS = SIGNATURE_AT_BEGIN | PUT_RESULT};
	SignatureVerificationFilter(const PK_Verifier &verifier, BufferedTransformation *attachment = NULL, word32 flags = DEFAULT_FLAGS);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品三级在线看| 精品视频一区三区九区| 久久无码av三级| 国产精品一区二区无线| 国产视频一区二区三区在线观看| 国产乱色国产精品免费视频| 国产精品网站一区| 色综合久久99| 青青草原综合久久大伊人精品优势| 欧美成人福利视频| 成人中文字幕电影| 亚洲最快最全在线视频| 欧美一区二区三区免费| 懂色av一区二区三区蜜臀| 亚洲色图色小说| 51精品国自产在线| 国产成人免费网站| 亚洲蜜臀av乱码久久精品蜜桃| 欧美日韩一区二区三区不卡| 欧美96一区二区免费视频| 久久久久久久久岛国免费| 91免费国产视频网站| 日本最新不卡在线| 日本一区二区电影| 91麻豆精品国产综合久久久久久| 极品少妇一区二区三区精品视频| 国产精品久久久久aaaa樱花| 欧美日韩成人综合天天影院| 国产美女视频91| 亚洲一区二区三区视频在线| 久久亚洲捆绑美女| 日本韩国视频一区二区| 国模大尺度一区二区三区| 艳妇臀荡乳欲伦亚洲一区| 久久久精品国产99久久精品芒果| 欧洲一区二区三区在线| 国产经典欧美精品| 图片区日韩欧美亚洲| 中文天堂在线一区| 欧美一区永久视频免费观看| av亚洲精华国产精华精华| 麻豆一区二区在线| 亚洲韩国一区二区三区| 中文字幕一区二区日韩精品绯色| 日韩欧美中文一区| 91黄色免费观看| 懂色av一区二区在线播放| 蜜臀久久久99精品久久久久久| 亚洲裸体xxx| 国产精品久久久久久久浪潮网站| 精品三级在线观看| 欧美人妇做爰xxxⅹ性高电影| 波多野结衣亚洲一区| 国内精品自线一区二区三区视频| 亚洲bt欧美bt精品| 亚洲精品国产a| 中文字幕永久在线不卡| 久久精品视频免费| 日韩精品影音先锋| 日韩一区二区影院| 7777精品伊人久久久大香线蕉完整版 | 91日韩在线专区| 国产精品99精品久久免费| 日韩精品乱码免费| 亚洲国产一区视频| 亚洲欧美另类图片小说| 国产精品免费aⅴ片在线观看| 精品国产乱码久久久久久牛牛| 欧美日韩三级一区二区| 欧美视频在线一区二区三区| 色丁香久综合在线久综合在线观看| 高清不卡在线观看| 国产白丝精品91爽爽久久| 国产成人午夜高潮毛片| 国产一区二区毛片| 国产精品资源站在线| 国内精品在线播放| 国产精品香蕉一区二区三区| 国产成人亚洲综合色影视| 国产毛片精品视频| 成人综合婷婷国产精品久久蜜臀| 国产不卡高清在线观看视频| 不卡欧美aaaaa| 色综合久久久久久久久| 欧美日韩一级片在线观看| 91麻豆精品国产91久久久久久| 91精品国产综合久久福利软件| 91精品国产欧美一区二区成人| 日韩一卡二卡三卡四卡| 精品国产制服丝袜高跟| 国产午夜精品久久| 亚洲日穴在线视频| 亚洲国产成人av| 看片的网站亚洲| 国产高清无密码一区二区三区| 成人爽a毛片一区二区免费| 99久久精品情趣| 欧美日韩久久久| 日韩免费在线观看| 国产精品天天摸av网| 一区二区三区鲁丝不卡| 欧美a级理论片| 成人性视频网站| 欧美图区在线视频| 精品国产人成亚洲区| 国产精品视频你懂的| 亚洲国产欧美日韩另类综合| 蜜桃视频一区二区三区| 成人网在线播放| 欧美亚洲自拍偷拍| 欧美变态tickling挠脚心| 18欧美乱大交hd1984| 日韩精品色哟哟| 成人一区二区三区中文字幕| 欧美日韩一二区| 国产日韩欧美a| 五月婷婷久久综合| av电影在线观看不卡| 欧美一级免费观看| 国产精品夫妻自拍| 久久电影网站中文字幕| 色婷婷久久久久swag精品| 欧美电视剧免费观看| 国产精品国产精品国产专区不蜜| 天天av天天翘天天综合网色鬼国产| 国产麻豆一精品一av一免费| 欧美亚洲一区三区| 欧美国产精品专区| 美女视频第一区二区三区免费观看网站| 成人午夜私人影院| 欧美一区二区三区四区在线观看 | 99精品视频在线观看| 日韩欧美色综合网站| 亚洲一区二区三区四区不卡| 国产成人aaa| 日韩欧美电影一二三| 亚洲自拍欧美精品| av一二三不卡影片| 欧美国产日本视频| 黄色成人免费在线| 欧美一三区三区四区免费在线看| 亚洲欧美电影一区二区| 成人黄色网址在线观看| 久久久三级国产网站| 午夜精品在线看| 91成人免费网站| 最新国产成人在线观看| 成人性生交大片免费看中文网站| 欧美一区二区播放| 午夜国产不卡在线观看视频| 91丨porny丨国产| 国产精品久久三| 成人av网站在线观看| 国产午夜精品久久久久久久| 精品一区二区免费视频| 日韩欧美一区中文| 日产国产欧美视频一区精品| 欧美日韩不卡一区二区| 一区二区三区日韩欧美精品| 99久精品国产| 亚洲欧洲av在线| 99久久精品费精品国产一区二区| 久久久国产午夜精品| 国产精品一区二区果冻传媒| 精品国产一区二区三区忘忧草| 蜜臀av一区二区在线免费观看| 在线不卡的av| 日韩va欧美va亚洲va久久| 欧美一区二区三区免费视频 | 国产成人亚洲综合色影视| 久久新电视剧免费观看| 国产精品一区二区无线| 欧美激情在线免费观看| 成人av影院在线| 亚洲精品国产成人久久av盗摄| 91欧美一区二区| 一区二区三区久久| 666欧美在线视频| 久久精品免费观看| 国产女人水真多18毛片18精品视频 | 日韩一区欧美二区| 欧美videossexotv100| 韩国一区二区三区| 国产精品国产a级| 日本精品视频一区二区三区| 亚洲第一成年网| 精品久久久久久最新网址| 国产乱对白刺激视频不卡| 综合色中文字幕| 欧美色综合网站| 久久福利视频一区二区| 中文字幕av一区二区三区免费看 | 欧美二区三区91| 国内久久婷婷综合| 亚洲欧洲99久久| 正在播放一区二区| 国产成人精品影院| 亚洲综合在线电影| 精品国产成人系列| 色视频成人在线观看免|