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

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

?? secblock.h

?? 提供rsa、 des、 md5等加密和hash算法
?? 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一区二区三区免费野_久草精品视频
91在线国产福利| 亚洲自拍与偷拍| 亚洲欧美日韩一区| 日本不卡123| eeuss鲁片一区二区三区| 欧美日韩亚洲综合一区| 久久精品免费在线观看| 亚洲午夜三级在线| 国产盗摄一区二区| 欧美一区二区三区在线观看视频| 中文字幕乱码亚洲精品一区 | av一区二区三区四区| 欧美日韩国产综合视频在线观看| 久久久精品天堂| 日韩 欧美一区二区三区| 色婷婷久久久综合中文字幕 | 久久久99免费| 强制捆绑调教一区二区| 在线精品视频一区二区| 中文字幕av在线一区二区三区| 免费成人av资源网| 在线观看国产日韩| 亚洲美女少妇撒尿| 成人av一区二区三区| 久久免费国产精品 | 一区二区三区电影在线播| 成人精品高清在线| 一区二区三区日韩欧美精品| 国产精品自拍一区| 久久嫩草精品久久久精品| 热久久国产精品| 制服丝袜中文字幕亚洲| 亚洲第一电影网| 日本高清免费不卡视频| 亚洲精品视频在线| 91影院在线观看| 亚洲人精品午夜| kk眼镜猥琐国模调教系列一区二区| 日韩色在线观看| 玖玖九九国产精品| 久久综合九色欧美综合狠狠| 久久99国产精品尤物| 精品剧情在线观看| 国产成人精品综合在线观看| 国产午夜精品在线观看| 成人妖精视频yjsp地址| 日本一区二区免费在线观看视频 | 色婷婷精品久久二区二区蜜臂av| 国产精品久久久久婷婷| 91麻豆福利精品推荐| 一区二区三区四区乱视频| 欧美日韩日日骚| 久久99精品久久只有精品| 久久精品夜色噜噜亚洲aⅴ| 高清在线成人网| 亚洲精品少妇30p| 欧美日韩五月天| 极品美女销魂一区二区三区| 久久嫩草精品久久久精品一| 99热99精品| 亚洲成av人片一区二区| 精品国产免费视频| 不卡av在线免费观看| 亚洲高清免费视频| 337p日本欧洲亚洲大胆精品| 高清久久久久久| 午夜av区久久| 国产欧美日韩久久| 欧美日韩亚州综合| 国产成a人无v码亚洲福利| 亚洲欧洲av另类| 欧美成人一区二区三区片免费 | 成av人片一区二区| 亚洲成在人线免费| 一区二区三区在线免费观看| 欧美军同video69gay| 国产精品影视天天线| 亚洲综合久久久久| 久久久久久久久97黄色工厂| 欧美亚洲尤物久久| 国产jizzjizz一区二区| 亚洲mv大片欧洲mv大片精品| 久久久久国产精品麻豆ai换脸 | 国产精品看片你懂得| 欧美电影一区二区三区| 成人性生交大片免费看中文| 日韩激情一二三区| 亚洲视频在线一区| 久久精品夜色噜噜亚洲a∨| 欧美日韩另类一区| 91同城在线观看| 粉嫩久久99精品久久久久久夜| 日韩不卡一二三区| 亚洲另类一区二区| 欧美极品xxx| 26uuu国产电影一区二区| 欧美三级三级三级| 色成人在线视频| 99久久er热在这里只有精品15 | 肉肉av福利一精品导航| 亚洲三级在线播放| 国产精品麻豆欧美日韩ww| 欧美成人乱码一区二区三区| 欧美乱熟臀69xxxxxx| 日本道在线观看一区二区| 成人av免费在线| 国产成人自拍网| 久久66热re国产| 日本大胆欧美人术艺术动态| 国产91在线观看| 国内精品久久久久影院色| 琪琪一区二区三区| 六月丁香婷婷久久| 美国欧美日韩国产在线播放| 日韩黄色在线观看| 日本大胆欧美人术艺术动态| 亚洲一区二区精品3399| 亚洲国产日产av| 五月婷婷另类国产| 日本在线不卡视频| 蜜臀久久99精品久久久画质超高清| 亚洲成人综合在线| 日韩高清一区二区| 九九视频精品免费| 国产精品亚洲人在线观看| 福利一区二区在线观看| 成人av网站免费| 日本道在线观看一区二区| 欧美色倩网站大全免费| 91精品国产综合久久香蕉的特点| 91精品久久久久久久91蜜桃| 精品裸体舞一区二区三区| 久久久亚洲精品一区二区三区| 国产亚洲一区二区三区四区| 国产精品久久午夜| 一区二区不卡在线视频 午夜欧美不卡在 | 高清不卡在线观看av| www.成人在线| 欧美主播一区二区三区| 日韩网站在线看片你懂的| 日本一区二区免费在线观看视频| 国产精品你懂的在线欣赏| 亚洲永久精品国产| 蜜桃av噜噜一区| 国产91在线观看| 欧美日韩大陆一区二区| 欧美精品一区二区三区高清aⅴ| 亚洲国产精品成人久久综合一区| 亚洲色图在线播放| 免费一区二区视频| a亚洲天堂av| 日韩欧美亚洲国产另类| 中文在线一区二区| 日日夜夜精品视频免费| 国产99精品视频| 欧美美女视频在线观看| 国产精品美女久久福利网站| 午夜精品久久久久久久久| 国产·精品毛片| 91精品视频网| 自拍av一区二区三区| 免费成人在线视频观看| 99精品视频在线观看免费| 日韩视频免费观看高清完整版在线观看 | 久久超碰97中文字幕| 91蜜桃免费观看视频| 欧美大黄免费观看| 一区二区三区精品在线观看| 国产在线视视频有精品| 欧美在线一二三| 国产欧美日韩视频一区二区| 亚洲国产精品一区二区www | 久久久久久久久久久久久女国产乱| 一区二区免费在线| 国产寡妇亲子伦一区二区| 欧美日韩成人在线| 亚洲日本va在线观看| 国产精品99久久久久久久vr| 欧美日韩三级一区二区| 亚洲视频在线一区| 岛国精品在线播放| 精品国产一区二区三区不卡| 亚洲精品一区在线观看| 欧美电视剧免费观看| 亚洲国产aⅴ成人精品无吗| 成人蜜臀av电影| 欧美精品一区二区三区高清aⅴ| 天堂影院一区二区| 欧美日韩亚洲高清一区二区| 亚洲欧美区自拍先锋| 成人性生交大片免费看在线播放| 精品乱人伦小说| 久久精品国产77777蜜臀| 欧美精品一级二级三级| 亚洲午夜免费电影| 欧美视频一二三区| 亚洲在线观看免费视频| 欧美中文字幕一区二区三区亚洲| 国产精品不卡一区二区三区| 高清久久久久久|