⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 filters.cpp

📁 各种加密算法的集合
💻 CPP
字号:
#include "pch.h" 
#include "filters.h" 
#include "queue.h" 
#include <memory> 
 
NAMESPACE_BEGIN(CryptoPP) 
 
Filter::Filter(BufferedTransformation *outQ) 
	: outQueue(outQ ? outQ : new ByteQueue)  
{ 
} 
 
Filter::Filter(const Filter &source) 
	: outQueue(new ByteQueue) 
{ 
} 
 
void Filter::Detach(BufferedTransformation *newOut) 
{ 
	std::auto_ptr<BufferedTransformation> out(newOut ? newOut : new ByteQueue); 
	outQueue->Close(); 
	outQueue->TransferTo(*out); 
	outQueue.reset(out.release()); 
} 
 
void Filter::Attach(BufferedTransformation *newOut) 
{ 
	if (outQueue->Attachable()) 
		outQueue->Attach(newOut); 
	else 
		Detach(newOut); 
} 
 
void StreamCipherFilter::Put(const byte *inString, unsigned int length) 
{ 
	SecByteBlock temp(length); 
	cipher.ProcessString(temp, inString, length); 
	outQueue->Put(temp, length); 
} 
 
void HashFilter::InputFinished() 
{ 
	SecByteBlock buf(hash.DigestSize()); 
	hash.Final(buf); 
	outQueue->Put(buf, hash.DigestSize()); 
} 
 
BufferedTransformation *Insert(const byte *in, unsigned int length, BufferedTransformation *outQueue) 
{ 
	outQueue->Put(in, length); 
	return outQueue; 
} 
 
unsigned int Extract(Source *source, byte *out, unsigned int length) 
{ 
	while (source->MaxRetrieveable() < length && source->Pump(1)); 
	return source->Get(out, length); 
} 
 
NAMESPACE_END 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -