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

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

?? gf2n.h

?? 加密函數庫:包括多種加密解密算法,數字簽名,散列算法
?? H
字號:
#ifndef CRYPTOPP_GF2N_H
#define CRYPTOPP_GF2N_H

/*! \file */

#include "cryptlib.h"
#include "secblock.h"
#include "misc.h"
#include "algebra.h"

#include <iosfwd>

NAMESPACE_BEGIN(CryptoPP)

//! Polynomial with Coefficients in GF(2)
/*!	\nosubgrouping */
class PolynomialMod2
{
public:
	//! \name ENUMS, EXCEPTIONS, and TYPEDEFS
	//@{
		//! divide by zero exception
		class DivideByZero : public Exception
		{
		public:
			DivideByZero() : Exception(OTHER_ERROR, "PolynomialMod2: division by zero") {}
		};

		typedef unsigned int RandomizationParameter;
	//@}

	//! \name CREATORS
	//@{
		//! creates the zero polynomial
		PolynomialMod2();
		//! copy constructor
		PolynomialMod2(const PolynomialMod2& t);

		//! convert from word
		/*! value should be encoded with the least significant bit as coefficient to x^0
			and most significant bit as coefficient to x^(WORD_BITS-1)
			bitLength denotes how much memory to allocate initially
		*/
		PolynomialMod2(word value, unsigned int bitLength=WORD_BITS);

		//! convert from big-endian byte array
		PolynomialMod2(const byte *encodedPoly, unsigned int byteCount)
			{Decode(encodedPoly, byteCount);}

		//! convert from big-endian form stored in a BufferedTransformation
		PolynomialMod2(BufferedTransformation &encodedPoly, unsigned int byteCount)
			{Decode(encodedPoly, byteCount);}

		//! create a random polynomial uniformly distributed over all polynomials with degree less than bitcount
		PolynomialMod2(RandomNumberGenerator &rng, unsigned int bitcount)
			{Randomize(rng, bitcount);}

		//! return x^i
		static PolynomialMod2 Monomial(unsigned i);
		//! return x^t0 + x^t1 + x^t2
		static PolynomialMod2 Trinomial(unsigned t0, unsigned t1, unsigned t2);
		//! return x^t0 + x^t1 + x^t2 + x^t3 + x^t4
		static PolynomialMod2 Pentanomial(unsigned t0, unsigned t1, unsigned t2, unsigned int t3, unsigned int t4);
		//! return x^(n-1) + ... + x + 1
		static PolynomialMod2 AllOnes(unsigned n);

		//!
		static const PolynomialMod2 &Zero();
		//!
		static const PolynomialMod2 &One();
	//@}

	//! \name ENCODE/DECODE
	//@{
		//! minimum number of bytes to encode this polynomial
		/*! MinEncodedSize of 0 is 1 */
		unsigned int MinEncodedSize() const {return STDMAX(1U, ByteCount());}

		//! encode in big-endian format
		/*! if outputLen < MinEncodedSize, the most significant bytes will be dropped
			if outputLen > MinEncodedSize, the most significant bytes will be padded
		*/
		unsigned int Encode(byte *output, unsigned int outputLen) const;
		//!
		unsigned int Encode(BufferedTransformation &bt, unsigned int outputLen) const;

		//!
		void Decode(const byte *input, unsigned int inputLen);
		//! 
		//* Precondition: bt.MaxRetrievable() >= inputLen
		void Decode(BufferedTransformation &bt, unsigned int inputLen);

		//! encode value as big-endian octet string
		void DEREncodeAsOctetString(BufferedTransformation &bt, unsigned int length) const;
		//! decode value as big-endian octet string
		void BERDecodeAsOctetString(BufferedTransformation &bt, unsigned int length);
	//@}

	//! \name ACCESSORS
	//@{
		//! number of significant bits = Degree() + 1
		unsigned int BitCount() const;
		//! number of significant bytes = ceiling(BitCount()/8)
		unsigned int ByteCount() const;
		//! number of significant words = ceiling(ByteCount()/sizeof(word))
		unsigned int WordCount() const;

		//! return the n-th bit, n=0 being the least significant bit
		bool GetBit(unsigned int n) const {return GetCoefficient(n)!=0;}
		//! return the n-th byte
		byte GetByte(unsigned int n) const;

		//! the zero polynomial will return a degree of -1
		signed int Degree() const {return BitCount()-1;}
		//! degree + 1
		unsigned int CoefficientCount() const {return BitCount();}
		//! return coefficient for x^i
		int GetCoefficient(unsigned int i) const
			{return (i/WORD_BITS < reg.size()) ? int(reg[i/WORD_BITS] >> (i % WORD_BITS)) & 1 : 0;}
		//! return coefficient for x^i
		int operator[](unsigned int i) const {return GetCoefficient(i);}

		//!
		bool IsZero() const {return !*this;}
		//!
		bool Equals(const PolynomialMod2 &rhs) const;
	//@}

	//! \name MANIPULATORS
	//@{
		//!
		PolynomialMod2&  operator=(const PolynomialMod2& t);
		//!
		PolynomialMod2&  operator&=(const PolynomialMod2& t);
		//!
		PolynomialMod2&  operator^=(const PolynomialMod2& t);
		//!
		PolynomialMod2&  operator+=(const PolynomialMod2& t) {return *this ^= t;}
		//!
		PolynomialMod2&  operator-=(const PolynomialMod2& t) {return *this ^= t;}
		//!
		PolynomialMod2&  operator*=(const PolynomialMod2& t);
		//!
		PolynomialMod2&  operator/=(const PolynomialMod2& t);
		//!
		PolynomialMod2&  operator%=(const PolynomialMod2& t);
		//!
		PolynomialMod2&  operator<<=(unsigned int);
		//!
		PolynomialMod2&  operator>>=(unsigned int);

		//!
		void Randomize(RandomNumberGenerator &rng, unsigned int bitcount);

		//!
		void SetBit(unsigned int i, int value = 1);
		//! set the n-th byte to value
		void SetByte(unsigned int n, byte value);

		//!
		void SetCoefficient(unsigned int i, int value) {SetBit(i, value);}

		//!
		void swap(PolynomialMod2 &a) {reg.swap(a.reg);}
	//@}

	//! \name UNARY OPERATORS
	//@{
		//!
		bool			operator!() const;
		//!
		PolynomialMod2	operator+() const {return *this;}
		//!
		PolynomialMod2	operator-() const {return *this;}
	//@}

	//! \name BINARY OPERATORS
	//@{
		//!
		PolynomialMod2 And(const PolynomialMod2 &b) const;
		//!
		PolynomialMod2 Xor(const PolynomialMod2 &b) const;
		//!
		PolynomialMod2 Plus(const PolynomialMod2 &b) const {return Xor(b);}
		//!
		PolynomialMod2 Minus(const PolynomialMod2 &b) const {return Xor(b);}
		//!
		PolynomialMod2 Times(const PolynomialMod2 &b) const;
		//!
		PolynomialMod2 DividedBy(const PolynomialMod2 &b) const;
		//!
		PolynomialMod2 Modulo(const PolynomialMod2 &b) const;

		//!
		PolynomialMod2 operator>>(unsigned int n) const;
		//!
		PolynomialMod2 operator<<(unsigned int n) const;
	//@}

	//! \name OTHER ARITHMETIC FUNCTIONS
	//@{
		//! sum modulo 2 of all coefficients
		unsigned int Parity() const;

		//! check for irreducibility
		bool IsIrreducible() const;

		//! is always zero since we're working modulo 2
		PolynomialMod2 Doubled() const {return Zero();}
		//!
		PolynomialMod2 Squared() const;

		//! only 1 is a unit
		bool IsUnit() const {return Equals(One());}
		//! return inverse if *this is a unit, otherwise return 0
		PolynomialMod2 MultiplicativeInverse() const {return IsUnit() ? One() : Zero();}

		//! greatest common divisor
		static PolynomialMod2 Gcd(const PolynomialMod2 &a, const PolynomialMod2 &n);
		//! calculate multiplicative inverse of *this mod n
		PolynomialMod2 InverseMod(const PolynomialMod2 &) const;

		//! calculate r and q such that (a == d*q + r) && (deg(r) < deg(d))
		static void Divide(PolynomialMod2 &r, PolynomialMod2 &q, const PolynomialMod2 &a, const PolynomialMod2 &d);
	//@}

	//! \name INPUT/OUTPUT
	//@{
		//!
		friend std::ostream& operator<<(std::ostream& out, const PolynomialMod2 &a);
	//@}

private:
	friend class GF2NT;

	SecWordBlock reg;
};

//! GF(2^n) with Polynomial Basis
class GF2NP : public QuotientRing<EuclideanDomainOf<PolynomialMod2> >
{
public:
	GF2NP(const PolynomialMod2 &modulus);

	virtual GF2NP * Clone() const {return new GF2NP(*this);}
	virtual void DEREncode(BufferedTransformation &bt) const
		{assert(false);}	// no ASN.1 syntax yet for general polynomial basis

	void DEREncodeElement(BufferedTransformation &out, const Element &a) const;
	void BERDecodeElement(BufferedTransformation &in, Element &a) const;

	bool Equal(const Element &a, const Element &b) const
		{assert(a.Degree() < m_modulus.Degree() && b.Degree() < m_modulus.Degree()); return a.Equals(b);}

	bool IsUnit(const Element &a) const
		{assert(a.Degree() < m_modulus.Degree()); return !!a;}

	unsigned int MaxElementBitLength() const
		{return m;}

	unsigned int MaxElementByteLength() const
		{return BitsToBytes(MaxElementBitLength());}

	Element SquareRoot(const Element &a) const;

	Element HalfTrace(const Element &a) const;

	// returns z such that z^2 + z == a
	Element SolveQuadraticEquation(const Element &a) const;

protected:
	unsigned int m;
};

//! GF(2^n) with Trinomial Basis
class GF2NT : public GF2NP
{
public:
	// polynomial modulus = x^t0 + x^t1 + x^t2, t0 > t1 > t2
	GF2NT(unsigned int t0, unsigned int t1, unsigned int t2);

	GF2NP * Clone() const {return new GF2NT(*this);}
	void DEREncode(BufferedTransformation &bt) const;

	const Element& Multiply(const Element &a, const Element &b) const;

	const Element& Square(const Element &a) const
		{return Reduced(a.Squared());}

	const Element& MultiplicativeInverse(const Element &a) const;

private:
	const Element& Reduced(const Element &a) const;

	unsigned int t0, t1;
	mutable PolynomialMod2 result;
};

//! GF(2^n) with Pentanomial Basis
class GF2NPP : public GF2NP
{
public:
	// polynomial modulus = x^t0 + x^t1 + x^t2 + x^t3 + x^t4, t0 > t1 > t2 > t3 > t4
	GF2NPP(unsigned int t0, unsigned int t1, unsigned int t2, unsigned int t3, unsigned int t4)
		: GF2NP(PolynomialMod2::Pentanomial(t0, t1, t2, t3, t4)), t0(t0), t1(t1), t2(t2), t3(t3) {}

	GF2NP * Clone() const {return new GF2NPP(*this);}
	void DEREncode(BufferedTransformation &bt) const;

private:
	unsigned int t0, t1, t2, t3;
};

// construct new GF2NP from the ASN.1 sequence Characteristic-two
GF2NP * BERDecodeGF2NP(BufferedTransformation &bt);

//!
inline bool operator==(const CryptoPP::PolynomialMod2 &a, const CryptoPP::PolynomialMod2 &b)
	{return a.Equals(b);}
//!
inline bool operator!=(const CryptoPP::PolynomialMod2 &a, const CryptoPP::PolynomialMod2 &b)
	{return !(a==b);}
//! compares degree
inline bool operator> (const CryptoPP::PolynomialMod2 &a, const CryptoPP::PolynomialMod2 &b)
	{return a.Degree() > b.Degree();}
//! compares degree
inline bool operator>=(const CryptoPP::PolynomialMod2 &a, const CryptoPP::PolynomialMod2 &b)
	{return a.Degree() >= b.Degree();}
//! compares degree
inline bool operator< (const CryptoPP::PolynomialMod2 &a, const CryptoPP::PolynomialMod2 &b)
	{return a.Degree() < b.Degree();}
//! compares degree
inline bool operator<=(const CryptoPP::PolynomialMod2 &a, const CryptoPP::PolynomialMod2 &b)
	{return a.Degree() <= b.Degree();}
//!
inline CryptoPP::PolynomialMod2 operator&(const CryptoPP::PolynomialMod2 &a, const CryptoPP::PolynomialMod2 &b) {return a.And(b);}
//!
inline CryptoPP::PolynomialMod2 operator^(const CryptoPP::PolynomialMod2 &a, const CryptoPP::PolynomialMod2 &b) {return a.Xor(b);}
//!
inline CryptoPP::PolynomialMod2 operator+(const CryptoPP::PolynomialMod2 &a, const CryptoPP::PolynomialMod2 &b) {return a.Plus(b);}
//!
inline CryptoPP::PolynomialMod2 operator-(const CryptoPP::PolynomialMod2 &a, const CryptoPP::PolynomialMod2 &b) {return a.Minus(b);}
//!
inline CryptoPP::PolynomialMod2 operator*(const CryptoPP::PolynomialMod2 &a, const CryptoPP::PolynomialMod2 &b) {return a.Times(b);}
//!
inline CryptoPP::PolynomialMod2 operator/(const CryptoPP::PolynomialMod2 &a, const CryptoPP::PolynomialMod2 &b) {return a.DividedBy(b);}
//!
inline CryptoPP::PolynomialMod2 operator%(const CryptoPP::PolynomialMod2 &a, const CryptoPP::PolynomialMod2 &b) {return a.Modulo(b);}

NAMESPACE_END

NAMESPACE_BEGIN(std)
template<> inline void swap(CryptoPP::PolynomialMod2 &a, CryptoPP::PolynomialMod2 &b)
{
	a.swap(b);
}
NAMESPACE_END

#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区高清不卡| 一区二区三区资源| 日韩精品一区在线| 欧美一级在线免费| 91精品国产一区二区人妖| 欧美三级日韩三级国产三级| 欧美私人免费视频| 欧美高清dvd| 日韩一区二区三区免费观看| 欧美一区二区不卡视频| 精品久久国产字幕高潮| 久久综合色一综合色88| 国产视频一区不卡| 国产精品私人自拍| 亚洲摸摸操操av| 亚洲成人免费在线| 免费高清成人在线| 久久 天天综合| 国产xxx精品视频大全| 成人99免费视频| 91福利资源站| 欧美熟乱第一页| 中文字幕佐山爱一区二区免费| 国产精品乱人伦中文| 亚洲精选视频在线| 亚洲成人午夜影院| 青青草精品视频| 国产真实乱子伦精品视频| 国产成人精品免费一区二区| 不卡视频一二三四| 91成人看片片| 9191成人精品久久| 久久久久久久久久久久久女国产乱| 欧美激情一区二区三区全黄| 日韩伦理av电影| 视频一区二区三区中文字幕| 精品一区二区三区的国产在线播放| 国产精品77777竹菊影视小说| 91视频国产观看| 在线不卡一区二区| 国产日韩欧美精品综合| 亚洲国产精品自拍| 精品一区二区免费看| www.亚洲在线| 欧美一区二区私人影院日本| 日本一区二区综合亚洲| 亚洲国产sm捆绑调教视频| 国产真实精品久久二三区| 91麻豆精东视频| 欧美一级午夜免费电影| 中文字幕亚洲精品在线观看 | 久久97超碰色| 91麻豆自制传媒国产之光| 欧美一区二区三区免费| 国产精品久久毛片a| 视频在线观看一区二区三区| 懂色av一区二区三区免费看| 欧美丰满一区二区免费视频| 国产日韩欧美a| 亚洲成人av福利| 不卡av在线网| 欧美岛国在线观看| 亚洲一区二区三区三| 国产一区福利在线| 欧美人与z0zoxxxx视频| 国产精品福利影院| 激情综合网天天干| 欧美日本韩国一区二区三区视频| 中文字幕欧美一区| 国产成人在线免费观看| 91精品在线免费观看| 一区二区在线观看免费 | 欧美在线啊v一区| 国产拍揄自揄精品视频麻豆| 日精品一区二区三区| 91麻豆免费观看| 国产精品区一区二区三区| 麻豆精品一区二区三区| 欧美日韩综合一区| 亚洲视频1区2区| 国产成人免费在线| 欧美大胆人体bbbb| 亚洲国产视频一区二区| 97久久精品人人做人人爽50路| 日韩欧美在线观看一区二区三区| 一区二区三区在线观看欧美| 国产ts人妖一区二区| 精品国产自在久精品国产| 亚洲国产美国国产综合一区二区| av在线综合网| 国产亚洲福利社区一区| 毛片av中文字幕一区二区| 欧美日韩免费在线视频| 亚洲精品第1页| 91免费观看在线| 国产精品久久久久久久第一福利 | 久久99国产精品久久| 日韩欧美一级精品久久| 亚洲在线观看免费| 国产精品成人一区二区三区夜夜夜| 色综合激情五月| 国产成人啪免费观看软件| 欧美顶级少妇做爰| 欧美军同video69gay| 国产盗摄一区二区三区| 国产精品污www在线观看| 中文字幕一区免费在线观看| 国产成人免费在线视频| 日本一区二区三区国色天香 | 一区二区三区av电影 | 久久99久久99精品免视看婷婷| 91精品国产综合久久久久久 | 精品国产成人系列| 国产精品综合久久| 亚洲一二三四在线| 精品99一区二区| 91黄色免费版| 国产精品综合在线视频| 一区二区三区中文在线观看| 欧美日韩国产一级片| 风流少妇一区二区| 日韩精品电影在线| 中文字幕日本不卡| 久久久电影一区二区三区| 一本大道久久a久久综合婷婷 | 免费成人在线观看| 中文字幕国产精品一区二区| 久久综合色综合88| 亚洲国产精品ⅴa在线观看| 99视频在线观看一区三区| 国产精品免费丝袜| 91精品国产综合久久福利软件| 成人一区二区三区| 国产乱码一区二区三区| 在线视频一区二区免费| 26uuu亚洲综合色| 国产精品久久毛片a| 91浏览器在线视频| 亚洲成人手机在线| 日韩一区二区在线看片| 国产麻豆成人精品| 综合久久久久综合| 欧美日韩不卡在线| 国产精一区二区三区| 最新欧美精品一区二区三区| 欧美肥妇毛茸茸| 91 com成人网| 欧美在线不卡视频| 欧美中文字幕一区二区三区| av福利精品导航| jizzjizzjizz欧美| 99国产一区二区三精品乱码| 国产成人免费在线观看| 国产成人久久精品77777最新版本| 日韩中文字幕区一区有砖一区 | 一级女性全黄久久生活片免费| 中文子幕无线码一区tr| 亚洲色图一区二区三区| 一区二区三区四区在线免费观看| 一区二区三区四区五区视频在线观看| 国产嫩草影院久久久久| 国产精品久久久久久久久图文区| 久久精品视频一区二区| 国产精品久久看| 三级久久三级久久久| 久久精工是国产品牌吗| 国产精品一区三区| 色综合久久综合网97色综合| 欧美揉bbbbb揉bbbbb| 日韩欧美中文字幕公布| 久久精品人人爽人人爽| 激情深爱一区二区| 懂色av一区二区夜夜嗨| 国产丝袜美腿一区二区三区| 亚洲摸摸操操av| 国产精品免费久久久久| 综合久久久久久| 国模大尺度一区二区三区| 色婷婷综合在线| 丝袜美腿成人在线| 国产精品久久毛片av大全日韩| 国v精品久久久网| 欧美精品一区二区蜜臀亚洲| 日本道免费精品一区二区三区| 国内精品写真在线观看| 亚洲va天堂va国产va久| 亚洲精品日韩一| 一区在线观看视频| 国产欧美一二三区| 精品国产麻豆免费人成网站| 欧美日本一区二区三区四区| 国产69精品久久久久毛片 | 欧美三片在线视频观看| 国产日韩欧美a| 国产一区二区三区免费播放| 制服.丝袜.亚洲.另类.中文| 亚洲综合区在线| 一本到不卡精品视频在线观看| 亚洲人成小说网站色在线| 国产aⅴ综合色|