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

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

?? secblock.h

?? 研讀AxCrypt對加解密的處理方法
?? H
字號:
// secblock.h - written and placed in the public domain by Wei Dai

#ifndef CRYPTOPP_SECBLOCK_H
#define CRYPTOPP_SECBLOCK_H

#include "config.h"
#include "misc.h"
#include <string.h>		// CodeWarrior doesn't have memory.h
#include <assert.h>

NAMESPACE_BEGIN(CryptoPP)

// ************** secure memory allocation ***************

template<class T>
class AllocatorBase
{
public:
	typedef T value_type;
	typedef size_t size_type;
#ifdef CRYPTOPP_MSVCRT6
	typedef ptrdiff_t difference_type;
#else
	typedef std::ptrdiff_t difference_type;
#endif
	typedef T * pointer;
	typedef const T * const_pointer;
	typedef T & reference;
	typedef const T & const_reference;

	pointer address(reference r) const {return (&r);}
	const_pointer address(const_reference r) const {return (&r); }
	void construct(pointer p, const T& val) {new (p) T(val);}
	void destroy(pointer p) {p->~T();}
	size_type max_size() const {return ~size_type(0)/sizeof(T);}	// switch to std::numeric_limits<T>::max later

protected:
	static void CheckSize(size_t n)
	{
		if (n > ~size_t(0) / sizeof(T))
			throw InvalidArgument("AllocatorBase: requested size would cause integer overflow");
	}
};

#define CRYPTOPP_INHERIT_ALLOCATOR_TYPES	\
typedef typename AllocatorBase<T>::value_type value_type;\
typedef typename AllocatorBase<T>::size_type size_type;\
typedef typename AllocatorBase<T>::difference_type difference_type;\
typedef typename AllocatorBase<T>::pointer pointer;\
typedef typename AllocatorBase<T>::const_pointer const_pointer;\
typedef typename AllocatorBase<T>::reference reference;\
typedef typename AllocatorBase<T>::const_reference const_reference;

template <class T, class A>
typename A::pointer StandardReallocate(A& a, T *p, typename A::size_type oldSize, typename A::size_type newSize, bool preserve)
{
	if (oldSize == newSize)
		return p;

	if (preserve)
	{
		A b;
		typename A::pointer newPointer = b.allocate(newSize, NULL);
		memcpy(newPointer, p, sizeof(T)*STDMIN(oldSize, newSize));
		a.deallocate(p, oldSize);
		std::swap(a, b);
		return newPointer;
	}
	else
	{
		a.deallocate(p, oldSize);
		return a.allocate(newSize, NULL);
	}
}

template <class T>
class AllocatorWithCleanup : public AllocatorBase<T>
{
public:
	CRYPTOPP_INHERIT_ALLOCATOR_TYPES

	pointer allocate(size_type n, const void * = NULL)
	{
		CheckSize(n);
		if (n == 0)
			return NULL;
		return new T[n];
	}

	void deallocate(void *p, size_type n)
	{
		memset(p, 0, n*sizeof(T));
		delete [] (T *)p;
	}

	pointer reallocate(T *p, size_type oldSize, size_type newSize, bool preserve)
	{
		return StandardReallocate(*this, p, oldSize, newSize, preserve);
	}

	// VS.NET STL enforces the policy of "All STL-compliant allocators have to provide a
	// template class member called rebind".
    template <class U> struct rebind { typedef AllocatorWithCleanup<U> other; };
};

CRYPTOPP_DLL_TEMPLATE_CLASS AllocatorWithCleanup<byte>;
CRYPTOPP_DLL_TEMPLATE_CLASS AllocatorWithCleanup<word16>;
CRYPTOPP_DLL_TEMPLATE_CLASS AllocatorWithCleanup<word32>;

template <class T>
class NullAllocator : public AllocatorBase<T>
{
public:
	CRYPTOPP_INHERIT_ALLOCATOR_TYPES

	pointer allocate(size_type n, const void * = NULL)
	{
		assert(false);
		return NULL;
	}

	void deallocate(void *p, size_type n)
	{
		assert(false);
	}

	size_type max_size() const {return 0;}
};

// This allocator can't be used with standard collections because
// they require that all objects of the same allocator type are equivalent.
// So this is for use with SecBlock only.
template <class T, size_t S, class A = NullAllocator<T> >
class FixedSizeAllocatorWithCleanup : public AllocatorBase<T>
{
public:
	CRYPTOPP_INHERIT_ALLOCATOR_TYPES

	FixedSizeAllocatorWithCleanup() : m_allocated(false) {}

	pointer allocate(size_type n)
	{
		if (n <= S && !m_allocated)
		{
			m_allocated = true;
			return m_array;
		}
		else
			return m_fallbackAllocator.allocate(n);
	}

	pointer allocate(size_type n, const void *hint)
	{
		if (n <= S && !m_allocated)
		{
			m_allocated = true;
			return m_array;
		}
		else
			return m_fallbackAllocator.allocate(n, hint);
	}

	void deallocate(void *p, size_type n)
	{
		if (p == m_array)
		{
			assert(n <= S);
			assert(m_allocated);
			m_allocated = false;
			memset(p, 0, n*sizeof(T));
		}
		else
			m_fallbackAllocator.deallocate(p, n);
	}

	pointer reallocate(pointer p, size_type oldSize, size_type newSize, bool preserve)
	{
		if (p == m_array && newSize <= S)
		{
			assert(oldSize <= S);
			if (oldSize > newSize)
				memset(p + newSize, 0, (oldSize-newSize)*sizeof(T));
			return p;
		}

		pointer newPointer = allocate(newSize, NULL);
		if (preserve)
			memcpy(newPointer, p, sizeof(T)*STDMIN(oldSize, newSize));
		deallocate(p, oldSize);
		return newPointer;
	}

	size_type max_size() const {return STDMAX(m_fallbackAllocator.max_size(), S);}

private:
	T m_array[S];
	A m_fallbackAllocator;
	bool m_allocated;
};

//! a block of memory allocated using A
template <class T, class A = AllocatorWithCleanup<T> >
class SecBlock
{
public:
    explicit SecBlock(unsigned int size=0)
		: m_size(size) {m_ptr = m_alloc.allocate(size, NULL);}
	SecBlock(const SecBlock<T, A> &t)
		: m_size(t.m_size) {m_ptr = m_alloc.allocate(m_size, NULL); memcpy(m_ptr, t.m_ptr, m_size*sizeof(T));}
	SecBlock(const T *t, unsigned int len)
		: m_size(len)
	{
		m_ptr = m_alloc.allocate(len, NULL);
		if (t == NULL)
			memset(m_ptr, 0, len*sizeof(T));
		else
			memcpy(m_ptr, t, len*sizeof(T));
	}

	~SecBlock()
		{m_alloc.deallocate(m_ptr, m_size);}

	operator const void *() const
		{return m_ptr;}
	operator void *()
		{return m_ptr;}
#if defined(__GNUC__) && __GNUC__ < 3	// reduce warnings
	operator const void *()
		{return m_ptr;}
#endif

	operator const T *() const
		{return m_ptr;}
	operator T *()
		{return m_ptr;}
#if defined(__GNUC__) && __GNUC__ < 3	// reduce warnings
	operator const T *()
		{return m_ptr;}
#endif

	template <typename I>
	T *operator +(I offset)
		{return m_ptr+offset;}

	template <typename I>
	const T *operator +(I offset) const
		{return m_ptr+offset;}

	template <typename I>
	T& operator[](I index)
		{assert(index >= 0 && (unsigned int)index < m_size); return m_ptr[index];}

	template <typename I>
	const T& operator[](I index) const
		{assert(index >= 0 && (unsigned int)index < m_size); return m_ptr[index];}

	typedef typename A::value_type value_type;
	typedef typename A::pointer iterator;
	typedef typename A::const_pointer const_iterator;
	typedef typename A::size_type size_type;

	iterator begin()
		{return m_ptr;}
	const_iterator begin() const
		{return m_ptr;}
	iterator end()
		{return m_ptr+m_size;}
	const_iterator end() const
		{return m_ptr+m_size;}

	typename A::pointer data() {return m_ptr;}
	typename A::const_pointer data() const {return m_ptr;}

	size_type size() const {return m_size;}
	bool empty() const {return m_size == 0;}

	void Assign(const T *t, unsigned int len)
	{
		New(len);
		memcpy(m_ptr, t, len*sizeof(T));
	}

	void Assign(const SecBlock<T, A> &t)
	{
		New(t.m_size);
		memcpy(m_ptr, t.m_ptr, m_size*sizeof(T));
	}

	SecBlock& operator=(const SecBlock<T, A> &t)
	{
		Assign(t);
		return *this;
	}

	bool operator==(const SecBlock<T, A> &t) const
	{
		return m_size == t.m_size && memcmp(m_ptr, t.m_ptr, m_size*sizeof(T)) == 0;
	}

	bool operator!=(const SecBlock<T, A> &t) const
	{
		return !operator==(t);
	}

	void New(unsigned int newSize)
	{
		m_ptr = m_alloc.reallocate(m_ptr, m_size, newSize, false);
		m_size = newSize;
	}

	void CleanNew(unsigned int newSize)
	{
		New(newSize);
		memset(m_ptr, 0, m_size*sizeof(T));
	}

	void Grow(unsigned int newSize)
	{
		if (newSize > m_size)
		{
			m_ptr = m_alloc.reallocate(m_ptr, m_size, newSize, true);
			m_size = newSize;
		}
	}

	void CleanGrow(unsigned int newSize)
	{
		if (newSize > m_size)
		{
			m_ptr = m_alloc.reallocate(m_ptr, m_size, newSize, true);
			memset(m_ptr+m_size, 0, (newSize-m_size)*sizeof(T));
			m_size = newSize;
		}
	}

	void resize(unsigned int newSize)
	{
		m_ptr = m_alloc.reallocate(m_ptr, m_size, newSize, true);
		m_size = newSize;
	}

	void swap(SecBlock<T, A> &b)
	{
		std::swap(m_alloc, b.m_alloc);
		std::swap(m_size, b.m_size);
		std::swap(m_ptr, b.m_ptr);
	}

//private:
	A m_alloc;
	unsigned int m_size;
	T *m_ptr;
};

typedef SecBlock<byte> SecByteBlock;
typedef SecBlock<word> SecWordBlock;

template <class T, unsigned int S, class A = FixedSizeAllocatorWithCleanup<T, S> >
class FixedSizeSecBlock : public SecBlock<T, A>
{
public:
	explicit FixedSizeSecBlock() : SecBlock<T, A>(S) {}
};

template <class T, unsigned int S, class A = FixedSizeAllocatorWithCleanup<T, S, AllocatorWithCleanup<T> > >
class SecBlockWithHint : public SecBlock<T, A>
{
public:
	explicit SecBlockWithHint(unsigned int size) : SecBlock<T, A>(size) {}
};

template<class T, class U>
inline bool operator==(const CryptoPP::AllocatorWithCleanup<T>&, const CryptoPP::AllocatorWithCleanup<U>&) {return (true);}
template<class T, class U>
inline bool operator!=(const CryptoPP::AllocatorWithCleanup<T>&, const CryptoPP::AllocatorWithCleanup<U>&) {return (false);}

NAMESPACE_END

NAMESPACE_BEGIN(std)
template <class T, class A>
inline void swap(CryptoPP::SecBlock<T, A> &a, CryptoPP::SecBlock<T, A> &b)
{
	a.swap(b);
}

#if defined(_STLPORT_VERSION) && !defined(_STLP_MEMBER_TEMPLATE_CLASSES)
template <class _Tp1, class _Tp2>
inline CryptoPP::AllocatorWithCleanup<_Tp2>&
__stl_alloc_rebind(CryptoPP::AllocatorWithCleanup<_Tp1>& __a, const _Tp2*)
{
	return (CryptoPP::AllocatorWithCleanup<_Tp2>&)(__a);
}
#endif

NAMESPACE_END

#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久99精品免费观看| 美国毛片一区二区三区| 日本视频中文字幕一区二区三区| 国内精品第一页| 911精品国产一区二区在线| 欧美精品一区二| 日韩精品久久理论片| 91视频免费播放| 中文乱码免费一区二区| 日本aⅴ免费视频一区二区三区| 色婷婷av一区| 亚洲免费观看高清完整版在线 | 国产片一区二区| 奇米四色…亚洲| 欧美日韩精品免费观看视频| 国产精品免费aⅴ片在线观看| 精品亚洲国内自在自线福利| 欧美精品视频www在线观看| 亚洲欧美日韩精品久久久久| av在线不卡电影| 国产精品系列在线| av电影在线观看一区| 中文字幕av一区二区三区免费看 | 精品欧美乱码久久久久久1区2区| 亚洲永久精品大片| 色94色欧美sute亚洲线路二| 亚洲欧美中日韩| 91免费视频网址| 亚洲美女少妇撒尿| 欧美三级欧美一级| 视频一区二区中文字幕| 51精品秘密在线观看| 日韩精品亚洲专区| 日韩欧美不卡一区| 九九视频精品免费| 久久看人人爽人人| a在线欧美一区| 亚洲品质自拍视频| 欧美精品第一页| 免费看黄色91| 国产偷国产偷精品高清尤物| 成人久久久精品乱码一区二区三区| 久久久久久久久久久久电影| 国产91精品一区二区麻豆亚洲| 国产精品网曝门| 色国产精品一区在线观看| 亚洲国产精品一区二区尤物区| 91麻豆精品国产91久久久更新时间| 免费在线观看一区二区三区| 欧美刺激脚交jootjob| 国产成人免费视频| 亚洲一区二区精品3399| 日韩一区二区免费在线电影| 国产不卡在线一区| 亚洲一区二区视频在线观看| 欧美一级二级三级蜜桃| 国产91精品露脸国语对白| 一区二区三区91| 欧美变态口味重另类| 懂色av一区二区三区免费观看| 亚洲主播在线播放| 欧美大白屁股肥臀xxxxxx| 国产一区二区三区四| 亚洲视频一区在线| 日韩欧美不卡一区| 在线精品视频小说1| 久久国产三级精品| 亚洲乱码中文字幕| 精品第一国产综合精品aⅴ| 97久久超碰精品国产| 蜜桃久久精品一区二区| 亚洲欧洲综合另类在线 | 欧美日韩一区二区三区在线看| 麻豆国产91在线播放| **性色生活片久久毛片| 欧美一区二区在线视频| 91色porny在线视频| 国产一区二区三区不卡在线观看 | 欧美大片一区二区| 欧美视频一区二区在线观看| 国产精品一二二区| 日本欧美加勒比视频| 亚洲麻豆国产自偷在线| 久久久精品免费免费| 欧美一激情一区二区三区| 色久综合一二码| zzijzzij亚洲日本少妇熟睡| 美女网站色91| 日韩国产欧美在线播放| 亚洲女性喷水在线观看一区| 欧美国产日本视频| 337p粉嫩大胆色噜噜噜噜亚洲| 欧美调教femdomvk| 91丨porny丨蝌蚪视频| 国产精一区二区三区| 蜜臀av一区二区在线免费观看 | 亚洲欧美日韩国产另类专区| 久久久欧美精品sm网站 | 欧美一三区三区四区免费在线看| 色婷婷香蕉在线一区二区| av电影在线观看完整版一区二区| 国产很黄免费观看久久| 麻豆91在线看| 另类的小说在线视频另类成人小视频在线 | 国产91精品一区二区麻豆网站| 麻豆成人综合网| 蜜桃久久久久久久| 捆绑紧缚一区二区三区视频| 日韩av中文在线观看| 琪琪一区二区三区| 麻豆国产欧美一区二区三区| 全国精品久久少妇| 蜜臀av亚洲一区中文字幕| 日韩成人dvd| 激情小说欧美图片| 国产寡妇亲子伦一区二区| 国产成人av电影免费在线观看| 国产精品一区专区| 成人国产一区二区三区精品| 丁香激情综合国产| 欧美日韩国产一区二区三区地区| 91亚洲精品久久久蜜桃| 色中色一区二区| 欧美精品日韩综合在线| 欧美一区二区久久久| 久久综合色婷婷| 国产精品视频看| 一区二区三区美女| 免费久久99精品国产| 国产乱淫av一区二区三区| av动漫一区二区| 91精品欧美一区二区三区综合在 | 一区二区欧美视频| 日韩在线卡一卡二| 国产精品亚洲一区二区三区妖精| 成人av电影免费在线播放| 在线观看国产一区二区| 欧美一区二区成人| 中文天堂在线一区| 五月婷婷久久综合| 国产成a人无v码亚洲福利| 日本道色综合久久| 日韩精品专区在线影院观看| 中文子幕无线码一区tr| 亚洲成人自拍网| 懂色av一区二区三区免费观看| 欧美私模裸体表演在线观看| 精品精品欲导航| 亚洲激情图片小说视频| 看国产成人h片视频| 91网站最新地址| 欧美成人免费网站| 亚洲激情图片一区| 国产成人精品免费| 欧美丰满少妇xxxxx高潮对白| 国产性天天综合网| 日韩电影一二三区| 91麻豆.com| 久久精品一区二区三区不卡| 亚洲午夜电影在线观看| 成人激情文学综合网| 欧美变态tickle挠乳网站| 亚洲一区在线播放| 9l国产精品久久久久麻豆| 日韩网站在线看片你懂的| 亚洲专区一二三| av电影在线观看完整版一区二区| 欧美一级爆毛片| 天天免费综合色| 91成人网在线| 国产精品视频第一区| 国产一区二区视频在线播放| 欧美一区二区三区免费视频| 亚洲综合激情另类小说区| 成人免费三级在线| 久久久亚洲精华液精华液精华液| 日韩精品国产精品| 欧美视频在线一区二区三区| 亚洲欧洲美洲综合色网| 国产福利不卡视频| 久久亚洲综合色| 精品亚洲免费视频| 欧美va日韩va| 美女www一区二区| 欧美一区二区三区的| 人人爽香蕉精品| 日韩一区二区精品| 免费人成在线不卡| 日韩欧美色综合| 精品一区二区免费| 久久一二三国产| 国产老肥熟一区二区三区| 久久夜色精品国产欧美乱极品| 精彩视频一区二区三区| 精品国产乱码久久久久久老虎| 国产一区免费电影| 久久久久久久网| 成人妖精视频yjsp地址| 国产精品视频一二三区| 91一区一区三区|