亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
国产电影一区在线| 五月开心婷婷久久| 精品成人在线观看| 欧美一区二区黄色| 欧美一区二区三区四区视频| 欧美日精品一区视频| 色香色香欲天天天影视综合网| 国产乱码精品一区二区三区忘忧草| 日本成人超碰在线观看| 亚洲成在人线在线播放| 亚洲国产欧美日韩另类综合| 亚洲一区在线观看免费观看电影高清| 最近中文字幕一区二区三区| 国产精品久久午夜| 国产精品国产三级国产aⅴ原创 | 久久精品亚洲麻豆av一区二区| 欧美电影免费观看高清完整版在线 | 91久久香蕉国产日韩欧美9色| 99免费精品在线| 色婷婷亚洲精品| 欧美午夜一区二区三区| 678五月天丁香亚洲综合网| 欧美日韩电影在线播放| 欧美一区二区三区不卡| 精品乱码亚洲一区二区不卡| 精品精品国产高清a毛片牛牛| 久久综合九色综合欧美98| 国产精品天干天干在线综合| 亚洲免费色视频| 亚洲成人动漫av| 久久精品国产亚洲a| 成人永久看片免费视频天堂| 色综合中文字幕国产 | 成人性生交大片免费看中文 | 中文字幕精品一区| 亚洲欧美激情在线| 日韩精品乱码免费| 国产成人一区在线| 色噜噜狠狠色综合欧洲selulu| 欧美日韩精品免费观看视频| 日韩精品一区国产麻豆| 欧美国产精品一区| 性做久久久久久| 国产精品一区二区果冻传媒| 91黄色免费网站| 日韩精品一区二区三区四区 | 中文字幕一区二区三区乱码在线| 亚洲一区二区三区精品在线| 久久成人免费日本黄色| 99久久久久久| 精品少妇一区二区三区免费观看| 国产精品网站导航| 美女视频黄免费的久久| 色婷婷综合激情| 国产偷v国产偷v亚洲高清| 亚洲国产cao| av电影在线观看一区| 日韩精品自拍偷拍| 亚洲高清视频的网址| 成人福利视频在线| 日韩免费视频线观看| 午夜影院在线观看欧美| 99久久国产综合色|国产精品| 日韩一区二区电影网| 一区二区三区精品视频| 99这里只有精品| 久久亚洲捆绑美女| 老司机精品视频导航| 欧美日韩视频在线第一区 | 99re6这里只有精品视频在线观看 99re8在线精品视频免费播放 | 欧美系列在线观看| 亚洲欧美日韩系列| caoporn国产精品| 中文字幕欧美区| 国产高清成人在线| 久久久亚洲高清| 国产一区二区免费在线| 日韩欧美一区二区不卡| 日韩国产欧美在线播放| 欧美日韩精品一区二区三区四区 | 91美女视频网站| ●精品国产综合乱码久久久久| 国产高清无密码一区二区三区| 337p日本欧洲亚洲大胆精品| 日本欧美一区二区| 91精品欧美福利在线观看| 轻轻草成人在线| 日韩网站在线看片你懂的| 秋霞国产午夜精品免费视频| 日韩午夜在线影院| 国产自产2019最新不卡| 久久综合九色综合欧美就去吻| 国产一区二区在线观看视频| 久久精品免视看| 成人a区在线观看| 中文字幕在线免费不卡| 91福利区一区二区三区| 亚洲成人免费视频| 制服丝袜激情欧洲亚洲| 九九**精品视频免费播放| 久久婷婷久久一区二区三区| 成人涩涩免费视频| 一区二区三区视频在线观看| 欧美性猛片xxxx免费看久爱| 天堂一区二区在线| www成人在线观看| 99re6这里只有精品视频在线观看| 亚洲美女视频一区| 91精品婷婷国产综合久久竹菊| 极品瑜伽女神91| 欧美高清在线一区| 欧美日韩中文另类| 国产乱码精品一区二区三区忘忧草| 日韩一区日韩二区| 3d动漫精品啪啪| 成人18视频在线播放| 亚洲图片欧美色图| 久久久久久黄色| 欧洲人成人精品| 极品少妇xxxx精品少妇| 亚洲欧洲日本在线| 精品免费一区二区三区| 色婷婷精品久久二区二区蜜臂av | 日韩欧美国产一二三区| 成人精品高清在线| 日本视频一区二区| 亚洲精品国产高清久久伦理二区| 日韩欧美综合一区| 欧美午夜精品电影| eeuss影院一区二区三区| 久久99精品国产麻豆不卡| 国产精品久久久久天堂| 欧美一区午夜精品| 日本韩国欧美在线| 国产成人福利片| 久久99精品国产.久久久久| 亚洲愉拍自拍另类高清精品| 国产日韩综合av| 日韩美女在线视频| 91精品国产综合久久久久久久| 99久久伊人久久99| 国产大陆精品国产| 国产在线一区二区综合免费视频| 亚洲一区二区三区国产| 中文字幕在线不卡一区二区三区| 精品国一区二区三区| 91麻豆精品国产91久久久更新时间| 99精品一区二区| av在线综合网| 国产不卡视频一区二区三区| 蜜臀av性久久久久蜜臀aⅴ四虎| 亚洲一区在线电影| 亚洲精品视频在线观看网站| 一区在线中文字幕| 国产精品网站导航| 国产精品欧美经典| 国产精品免费久久久久| 久久久91精品国产一区二区三区| 欧美一级理论性理论a| 欧美嫩在线观看| 欧美电影在哪看比较好| 欧美精品自拍偷拍| 91麻豆精品91久久久久久清纯| 欧美日韩国产精选| 欧美精品国产精品| 欧美一区二区视频在线观看2020 | 日韩一区二区三区电影| 欧美一区二区三区四区视频| 欧美一区二区三区播放老司机| 欧美高清精品3d| 91精品国产黑色紧身裤美女| 日韩亚洲欧美一区| 久久精品视频在线看| 亚洲国产精品黑人久久久| 成人欧美一区二区三区小说| 自拍偷拍亚洲欧美日韩| 亚洲已满18点击进入久久| 日日夜夜精品免费视频| 蜜臀91精品一区二区三区 | 久久九九久久九九| 中文字幕不卡一区| 一区二区三区在线高清| 日日夜夜免费精品| 风流少妇一区二区| 欧洲一区二区三区在线| 日韩欧美成人一区二区| 国产精品久久久久久久久久免费看 | 7777精品伊人久久久大香线蕉的| 欧美成人a∨高清免费观看| 国产日韩av一区| 亚洲影视在线观看| 国产美女一区二区三区| 色噜噜狠狠色综合中国| 精品国精品国产尤物美女| 亚洲欧洲成人精品av97| 蜜臀久久久99精品久久久久久| 国产精品夜夜嗨| 欧美综合色免费| 国产欧美日韩视频一区二区| 一区av在线播放|