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

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

?? filters.cpp

?? 研讀AxCrypt對加解密的處理方法
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
// filters.cpp - written and placed in the public domain by Wei Dai

#include "pch.h"

#ifndef CRYPTOPP_IMPORTS

#include "filters.h"
#include "mqueue.h"
#include "fltrimpl.h"
#include "argnames.h"
#include <memory>
#include <functional>

NAMESPACE_BEGIN(CryptoPP)

Filter::Filter(BufferedTransformation *attachment)
	: m_attachment(attachment), m_continueAt(0)
{
}

BufferedTransformation * Filter::NewDefaultAttachment() const
{
	return new MessageQueue;
}

BufferedTransformation * Filter::AttachedTransformation()
{
	if (m_attachment.get() == NULL)
		m_attachment.reset(NewDefaultAttachment());
	return m_attachment.get();
}

const BufferedTransformation *Filter::AttachedTransformation() const
{
	if (m_attachment.get() == NULL)
		const_cast<Filter *>(this)->m_attachment.reset(NewDefaultAttachment());
	return m_attachment.get();
}

void Filter::Detach(BufferedTransformation *newOut)
{
	m_attachment.reset(newOut);
}

void Filter::Insert(Filter *filter)
{
	filter->m_attachment.reset(m_attachment.release());
	m_attachment.reset(filter);
}

unsigned int Filter::CopyRangeTo2(BufferedTransformation &target, unsigned long &begin, unsigned long end, const std::string &channel, bool blocking) const
{
	return AttachedTransformation()->CopyRangeTo2(target, begin, end, channel, blocking);
}

unsigned int Filter::TransferTo2(BufferedTransformation &target, unsigned long &transferBytes, const std::string &channel, bool blocking)
{
	return AttachedTransformation()->TransferTo2(target, transferBytes, channel, blocking);
}

void Filter::Initialize(const NameValuePairs &parameters, int propagation)
{
	m_continueAt = 0;
	IsolatedInitialize(parameters);
	PropagateInitialize(parameters, propagation);
}

bool Filter::Flush(bool hardFlush, int propagation, bool blocking)
{
	switch (m_continueAt)
	{
	case 0:
		if (IsolatedFlush(hardFlush, blocking))
			return true;
	case 1:
		if (OutputFlush(1, hardFlush, propagation, blocking))
			return true;
	}
	return false;
}

bool Filter::MessageSeriesEnd(int propagation, bool blocking)
{
	switch (m_continueAt)
	{
	case 0:
		if (IsolatedMessageSeriesEnd(blocking))
			return true;
	case 1:
		if (ShouldPropagateMessageSeriesEnd() && OutputMessageSeriesEnd(1, propagation, blocking))
			return true;
	}
	return false;
}

void Filter::PropagateInitialize(const NameValuePairs &parameters, int propagation)
{
	if (propagation)
		AttachedTransformation()->Initialize(parameters, propagation-1);
}

unsigned int Filter::OutputModifiable(int outputSite, byte *inString, unsigned int length, int messageEnd, bool blocking, const std::string &channel)
{
	if (messageEnd)
		messageEnd--;
	unsigned int result = AttachedTransformation()->PutModifiable2(inString, length, messageEnd, blocking);
	m_continueAt = result ? outputSite : 0;
	return result;
}

unsigned int Filter::Output(int outputSite, const byte *inString, unsigned int length, int messageEnd, bool blocking, const std::string &channel)
{
	if (messageEnd)
		messageEnd--;
	unsigned int result = AttachedTransformation()->Put2(inString, length, messageEnd, blocking);
	m_continueAt = result ? outputSite : 0;
	return result;
}

bool Filter::OutputFlush(int outputSite, bool hardFlush, int propagation, bool blocking, const std::string &channel)
{
	if (propagation && AttachedTransformation()->ChannelFlush(channel, hardFlush, propagation-1, blocking))
	{
		m_continueAt = outputSite;
		return true;
	}
	m_continueAt = 0;
	return false;
}

bool Filter::OutputMessageSeriesEnd(int outputSite, int propagation, bool blocking, const std::string &channel)
{
	if (propagation && AttachedTransformation()->ChannelMessageSeriesEnd(channel, propagation-1, blocking))
	{
		m_continueAt = outputSite;
		return true;
	}
	m_continueAt = 0;
	return false;
}

// *************************************************************

unsigned int MeterFilter::Put2(const byte *begin, unsigned int length, int messageEnd, bool blocking)
{
	if (m_transparent)
	{
		FILTER_BEGIN;
		m_currentMessageBytes += length;
		m_totalBytes += length;

		if (messageEnd)
		{
			m_currentMessageBytes = 0;
			m_currentSeriesMessages++;
			m_totalMessages++;
		}

		FILTER_OUTPUT(1, begin, length, messageEnd);
		FILTER_END_NO_MESSAGE_END;
	}
	return 0;
}

unsigned int MeterFilter::PutModifiable2(byte *begin, unsigned int length, int messageEnd, bool blocking)
{
	if (m_transparent)
	{
		FILTER_BEGIN;
		m_currentMessageBytes += length;
		m_totalBytes += length;

		if (messageEnd)
		{
			m_currentMessageBytes = 0;
			m_currentSeriesMessages++;
			m_totalMessages++;
		}
		
		FILTER_OUTPUT_MODIFIABLE(1, begin, length, messageEnd);
		FILTER_END_NO_MESSAGE_END;
	}
	return 0;
}

bool MeterFilter::IsolatedMessageSeriesEnd(bool blocking)
{
	m_currentMessageBytes = 0;
	m_currentSeriesMessages = 0;
	m_totalMessageSeries++;
	return false;
}

// *************************************************************

void FilterWithBufferedInput::BlockQueue::ResetQueue(unsigned int blockSize, unsigned int maxBlocks)
{
	m_buffer.New(blockSize * maxBlocks);
	m_blockSize = blockSize;
	m_maxBlocks = maxBlocks;
	m_size = 0;
	m_begin = m_buffer;
}

byte *FilterWithBufferedInput::BlockQueue::GetBlock()
{
	if (m_size >= m_blockSize)
	{
		byte *ptr = m_begin;
		if ((m_begin+=m_blockSize) == m_buffer.end())
			m_begin = m_buffer;
		m_size -= m_blockSize;
		return ptr;
	}
	else
		return NULL;
}

byte *FilterWithBufferedInput::BlockQueue::GetContigousBlocks(unsigned int &numberOfBytes)
{
	numberOfBytes = STDMIN(numberOfBytes, STDMIN((unsigned int)(m_buffer.end()-m_begin), m_size));
	byte *ptr = m_begin;
	m_begin += numberOfBytes;
	m_size -= numberOfBytes;
	if (m_size == 0 || m_begin == m_buffer.end())
		m_begin = m_buffer;
	return ptr;
}

unsigned int FilterWithBufferedInput::BlockQueue::GetAll(byte *outString)
{
	unsigned int size = m_size;
	unsigned int numberOfBytes = m_maxBlocks*m_blockSize;
	const byte *ptr = GetContigousBlocks(numberOfBytes);
	memcpy(outString, ptr, numberOfBytes);
	memcpy(outString+numberOfBytes, m_begin, m_size);
	m_size = 0;
	return size;
}

void FilterWithBufferedInput::BlockQueue::Put(const byte *inString, unsigned int length)
{
	assert(m_size + length <= m_buffer.size());
	byte *end = (m_size < (unsigned int)(m_buffer.end()-m_begin)) ? m_begin + m_size : m_begin + m_size - m_buffer.size();
	unsigned int len = STDMIN(length, (unsigned int)(m_buffer.end()-end));
	memcpy(end, inString, len);
	if (len < length)
		memcpy(m_buffer, inString+len, length-len);
	m_size += length;
}

FilterWithBufferedInput::FilterWithBufferedInput(BufferedTransformation *attachment)
	: Filter(attachment)
{
}

FilterWithBufferedInput::FilterWithBufferedInput(unsigned int firstSize, unsigned int blockSize, unsigned int lastSize, BufferedTransformation *attachment)
	: Filter(attachment), m_firstSize(firstSize), m_blockSize(blockSize), m_lastSize(lastSize)
	, m_firstInputDone(false)
{
	if (m_firstSize < 0 || m_blockSize < 1 || m_lastSize < 0)
		throw InvalidArgument("FilterWithBufferedInput: invalid buffer size");

	m_queue.ResetQueue(1, m_firstSize);
}

void FilterWithBufferedInput::IsolatedInitialize(const NameValuePairs &parameters)
{
	InitializeDerivedAndReturnNewSizes(parameters, m_firstSize, m_blockSize, m_lastSize);
	if (m_firstSize < 0 || m_blockSize < 1 || m_lastSize < 0)
		throw InvalidArgument("FilterWithBufferedInput: invalid buffer size");
	m_queue.ResetQueue(1, m_firstSize);
	m_firstInputDone = false;
}

bool FilterWithBufferedInput::IsolatedFlush(bool hardFlush, bool blocking)
{
	if (!blocking)
		throw BlockingInputOnly("FilterWithBufferedInput");
	
	if (hardFlush)
		ForceNextPut();
	FlushDerived();
	
	return false;
}

unsigned int FilterWithBufferedInput::PutMaybeModifiable(byte *inString, unsigned int length, int messageEnd, bool blocking, bool modifiable)
{
	if (!blocking)
		throw BlockingInputOnly("FilterWithBufferedInput");

	if (length != 0)
	{
		unsigned int newLength = m_queue.CurrentSize() + length;

		if (!m_firstInputDone && newLength >= m_firstSize)
		{
			unsigned int len = m_firstSize - m_queue.CurrentSize();
			m_queue.Put(inString, len);
			FirstPut(m_queue.GetContigousBlocks(m_firstSize));
			assert(m_queue.CurrentSize() == 0);
			m_queue.ResetQueue(m_blockSize, (2*m_blockSize+m_lastSize-2)/m_blockSize);

			inString += len;
			newLength -= m_firstSize;
			m_firstInputDone = true;
		}

		if (m_firstInputDone)
		{
			if (m_blockSize == 1)
			{
				while (newLength > m_lastSize && m_queue.CurrentSize() > 0)
				{
					unsigned int len = newLength - m_lastSize;
					byte *ptr = m_queue.GetContigousBlocks(len);
					NextPutModifiable(ptr, len);
					newLength -= len;
				}

				if (newLength > m_lastSize)
				{
					unsigned int len = newLength - m_lastSize;
					NextPutMaybeModifiable(inString, len, modifiable);
					inString += len;
					newLength -= len;
				}
			}
			else
			{
				while (newLength >= m_blockSize + m_lastSize && m_queue.CurrentSize() >= m_blockSize)
				{
					NextPutModifiable(m_queue.GetBlock(), m_blockSize);
					newLength -= m_blockSize;
				}

				if (newLength >= m_blockSize + m_lastSize && m_queue.CurrentSize() > 0)
				{
					assert(m_queue.CurrentSize() < m_blockSize);
					unsigned int len = m_blockSize - m_queue.CurrentSize();
					m_queue.Put(inString, len);
					inString += len;
					NextPutModifiable(m_queue.GetBlock(), m_blockSize);
					newLength -= m_blockSize;
				}

				if (newLength >= m_blockSize + m_lastSize)
				{
					unsigned int len = RoundDownToMultipleOf(newLength - m_lastSize, m_blockSize);
					NextPutMaybeModifiable(inString, len, modifiable);
					inString += len;
					newLength -= len;
				}
			}
		}

		m_queue.Put(inString, newLength - m_queue.CurrentSize());
	}

	if (messageEnd)
	{
		if (!m_firstInputDone && m_firstSize==0)
			FirstPut(NULL);

		SecByteBlock temp(m_queue.CurrentSize());
		m_queue.GetAll(temp);
		LastPut(temp, temp.size());

		m_firstInputDone = false;
		m_queue.ResetQueue(1, m_firstSize);

		Output(1, NULL, 0, messageEnd, blocking);
	}
	return 0;
}

void FilterWithBufferedInput::ForceNextPut()
{
	if (!m_firstInputDone)
		return;
	
	if (m_blockSize > 1)
	{
		while (m_queue.CurrentSize() >= m_blockSize)
			NextPutModifiable(m_queue.GetBlock(), m_blockSize);
	}
	else
	{
		unsigned int len;
		while ((len = m_queue.CurrentSize()) > 0)
			NextPutModifiable(m_queue.GetContigousBlocks(len), len);
	}
}

void FilterWithBufferedInput::NextPutMultiple(const byte *inString, unsigned int length)
{
	assert(m_blockSize > 1);	// m_blockSize = 1 should always override this function
	while (length > 0)
	{
		assert(length >= m_blockSize);
		NextPutSingle(inString);
		inString += m_blockSize;
		length -= m_blockSize;
	}
}

// *************************************************************

void Redirector::Initialize(const NameValuePairs &parameters, int propagation)
{
	m_target = parameters.GetValueWithDefault("RedirectionTargetPointer", (BufferedTransformation*)NULL);
	m_behavior = parameters.GetIntValueWithDefault("RedirectionBehavior", PASS_EVERYTHING);

	if (m_target && GetPassSignals())
		m_target->Initialize(parameters, propagation);
}

// *************************************************************

ProxyFilter::ProxyFilter(BufferedTransformation *filter, unsigned int firstSize, unsigned int lastSize, BufferedTransformation *attachment)
	: FilterWithBufferedInput(firstSize, 1, lastSize, attachment), m_filter(filter)
{
	if (m_filter.get())
		m_filter->Attach(new OutputProxy(*this, false));
}

bool ProxyFilter::IsolatedFlush(bool hardFlush, bool blocking)
{
	return m_filter.get() ? m_filter->Flush(hardFlush, -1, blocking) : false;
}

void ProxyFilter::SetFilter(Filter *filter)
{
	m_filter.reset(filter);
	if (filter)
	{
		OutputProxy *proxy;
		std::auto_ptr<OutputProxy> temp(proxy = new OutputProxy(*this, false));
		m_filter->TransferAllTo(*proxy);
		m_filter->Attach(temp.release());
	}
}

void ProxyFilter::NextPutMultiple(const byte *s, unsigned int len)
{
	if (m_filter.get())
		m_filter->Put(s, len);
}

void ProxyFilter::NextPutModifiable(byte *s, unsigned int len)
{
	if (m_filter.get())
		m_filter->PutModifiable(s, len);
}

// *************************************************************

unsigned int ArraySink::Put2(const byte *begin, unsigned int length, int messageEnd, bool blocking)
{
	memcpy(m_buf+m_total, begin, STDMIN(length, SaturatingSubtract(m_size, m_total)));
	m_total += length;
	return 0;
}

byte * ArraySink::CreatePutSpace(unsigned int &size)
{
	size = m_size - m_total;
	return m_buf + m_total;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91理论电影在线观看| 亚洲三级视频在线观看| 视频一区视频二区在线观看| 欧美系列在线观看| 五月婷婷综合网| 日韩三级高清在线| 国产成人在线网站| 亚洲摸摸操操av| 欧美视频一区在线观看| 蜜臀91精品一区二区三区| 精品国精品国产尤物美女| 国产.精品.日韩.另类.中文.在线.播放| 91论坛在线播放| 五月婷婷激情综合网| 久久久噜噜噜久久人人看| 99精品视频一区| 性做久久久久久免费观看| 精品国产百合女同互慰| jlzzjlzz亚洲日本少妇| 丝袜诱惑制服诱惑色一区在线观看 | 色综合天天天天做夜夜夜夜做| 中文字幕一区日韩精品欧美| 欧美日韩国产123区| 国产美女精品在线| 一区二区在线观看不卡| 欧美一区二区视频在线观看2020 | 日韩精品视频网站| 亚洲国产精品t66y| 欧美男同性恋视频网站| 高清beeg欧美| 五月天精品一区二区三区| 欧美高清在线一区| 91精品国产手机| 91一区二区在线观看| 九九精品一区二区| 一二三四社区欧美黄| 久久你懂得1024| 欧美日韩mp4| 9i看片成人免费高清| 麻豆免费精品视频| 亚洲成人av免费| 综合在线观看色| 日韩欧美亚洲国产另类| 91蝌蚪porny成人天涯| 狠狠狠色丁香婷婷综合久久五月| 一区二区三区在线观看国产| 久久午夜电影网| 欧美一级在线视频| 在线观看日韩av先锋影音电影院| 国产一区二区三区电影在线观看| 午夜视频在线观看一区二区 | 3d成人h动漫网站入口| 国产91富婆露脸刺激对白| 日韩av一级电影| 又紧又大又爽精品一区二区| 欧美国产日本视频| 欧美大胆人体bbbb| 欧美日韩免费电影| 色综合天天综合网天天狠天天| 国产精品1024| 国产在线一区观看| 免费一级片91| 日韩国产精品大片| 亚洲成av人片在线观看无码| 亚洲激情成人在线| 亚洲色图制服诱惑| 中文字幕在线视频一区| 久久久亚洲精品石原莉奈| 精品日韩一区二区| 7777精品伊人久久久大香线蕉| 欧美在线免费观看亚洲| 91黄色免费版| 欧美亚洲一区二区在线观看| 在线欧美一区二区| 在线观看不卡视频| 在线免费观看成人短视频| 99久久精品一区| 91网址在线看| 91麻豆免费在线观看| 色呦呦一区二区三区| 色综合久久综合中文综合网| 日本韩国欧美一区| 欧美性受xxxx黑人xyx| 欧美专区日韩专区| 欧美日韩中文一区| 欧美人伦禁忌dvd放荡欲情| 91.麻豆视频| 日韩欧美成人一区| 2020国产成人综合网| 国产精品女同一区二区三区| 中文字幕高清不卡| 亚洲色图视频免费播放| 一区二区三区在线视频观看| 亚洲成精国产精品女| 日韩精品成人一区二区在线| 卡一卡二国产精品 | 在线免费精品视频| 在线91免费看| 久久久精品国产免大香伊| 欧美国产精品久久| 依依成人综合视频| 日本不卡免费在线视频| 国产美女视频一区| 91美女蜜桃在线| 7777精品久久久大香线蕉 | 欧美国产精品中文字幕| 亚洲欧美日韩国产综合| 午夜精品久久久久久久| 国内精品在线播放| 91亚洲资源网| 日韩午夜av电影| 国产亚洲欧美在线| 伊人一区二区三区| 蜜桃视频在线观看一区| a在线欧美一区| 欧美卡1卡2卡| 国产午夜精品一区二区三区四区| 亚洲欧美日韩国产中文在线| 美女国产一区二区三区| 成人免费av在线| 欧美卡1卡2卡| 自拍偷拍亚洲激情| 久久精品国产久精国产| 91在线码无精品| 26uuu精品一区二区| 一个色综合av| 国产一区二区三区最好精华液| 色综合天天综合| 国产三级精品三级在线专区| 亚洲高清免费一级二级三级| 国产老妇另类xxxxx| 欧美三级韩国三级日本三斤| 国产亚洲1区2区3区| 午夜视频在线观看一区二区三区| 成人一区二区三区视频在线观看| 欧美日本在线一区| 中文字幕日韩av资源站| 激情成人综合网| 欧美日本韩国一区二区三区视频| 国产精品美女久久久久av爽李琼 | 麻豆中文一区二区| 欧美性一区二区| 亚洲天堂a在线| 粉嫩欧美一区二区三区高清影视| 69堂亚洲精品首页| 一区二区三区四区乱视频| 国产一区二区三区在线观看免费视频| 午夜久久久久久电影| 成人午夜短视频| 亚洲免费观看视频| 色偷偷久久人人79超碰人人澡| 日韩欧美一级在线播放| 蜜臀av性久久久久蜜臀av麻豆 | 91丝袜国产在线播放| 久久久九九九九| 韩国欧美国产一区| 国产精品你懂的| 97精品久久久午夜一区二区三区| 一级日本不卡的影视| 欧美一区二区三级| 日韩一区二区在线看片| 亚洲高清视频的网址| 在线亚洲免费视频| 亚洲激情五月婷婷| 99r精品视频| 亚洲天堂2016| 色悠悠久久综合| 亚洲综合一区在线| 欧美中文字幕久久| 亚洲国产欧美在线| 欧美美女喷水视频| 亚洲va欧美va国产va天堂影院| 欧美一a一片一级一片| 一区二区三区国产| 色婷婷香蕉在线一区二区| 亚洲综合av网| 欧美日韩精品一区二区| 日韩精品视频网站| 日韩欧美国产麻豆| 国产真实乱对白精彩久久| 久久精品视频在线免费观看| 国产69精品久久99不卡| 亚洲少妇屁股交4| 欧美日韩黄色一区二区| 日本三级亚洲精品| 精品国产欧美一区二区| 国产高清亚洲一区| 成人欧美一区二区三区白人 | 欧美成人免费网站| 国产电影一区在线| 亚洲黄色在线视频| 欧美一区二区三区免费视频| 久久99国产精品麻豆| 国产精品美女一区二区三区| 91免费版在线| 理论电影国产精品| 中文字幕五月欧美| 欧美午夜精品一区二区蜜桃| 蜜桃久久av一区| 国产精品免费aⅴ片在线观看|