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

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

?? bigint.cpp

?? rsa加密算法的vc實現
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
BigInt TableModBase[25];//for modlue multie
BigInt PreTable[16];
//constructor
BigInt::BigInt()
{
	head = new intNode();
	positive = true;
}

//disconstuctor
BigInt::~BigInt()
{
}

//set the number to 0
void BigInt::setZero()
{
	intNode* temp;
	while(head->next != NULL)
	{
		temp = head;
		head = head->next;
		delete temp;
	}
	positive = true;
	head -> num = 0;
}
//load the number at the base of ten
void BigInt::loadDEC(const char* str, const int length)
{
	unsigned int temp = 0;
	unsigned int base = MAXDEC;
	
	setZero();

	int i = 0;
	if(str[i] == '-')
	{
		positive = false;
		++i;
	}

	for(; i < length; ++i)
	{
		temp *= 10;
		temp += ((unsigned int) (str[i] - '0'));
		if((i + 1) % 9 == 0)
		{
			*this = *this * base;
			*this += temp;
			temp = 0;
		}
	}
	base = (unsigned int)pow(10, (length % 9));
	*this = * this * base;
	*this += temp;
}

//load the number at the base of 16
void BigInt::loadHEX(const char* str, const int length)
{
	unsigned int temp = 0;
	unsigned char t;
	
	setZero();

	int i = 0;
	if(str[i] == '-')
	{
		positive = false;
		++i;
	}

	for(; i < length; ++i)
	{
		temp <<= 4;
		t = (unsigned char) str[i];
		temp |= hdigit(t);
		if((i + 1) % 8 == 0)
		{
			*this <<= 32;
			*this += temp;
			temp = 0;
		}
	}
	*this <<= (length % 8) * 4;
	*this += temp;
}

//convert the string to big number
void BigInt::loadSTR(const char* str, const int length)
{
	unsigned int temp = 0;

	setZero();

	int i = 0;
	int mi = 1;
	if(str[0] == '-')
	{
		positive = false;
		++i;
		mi = 0;

	}
	for(; i < length ; ++i)
	{
		temp <<= 8;
		temp |= (unsigned int)str[i];
		if( (i +mi) % 4 == 0)
		{
			*this <<= 32;
			*this += temp;
			temp = 0;
		}
	}
	* this <<= (length % 4) * 8;
	*this += temp;
}

//output the number at the base ten
char* BigInt::outputDEC(int& length)
{
	unsigned int temp;
	unsigned int base = MAXDEC;
	int i;
	unsigned char c = '0';
	stack s;//the stack to store the charactors

	BigInt a;

	a.copy(*this);
	unsigned char* ch;
	if(a.BIlisZero())
	{
		ch = new unsigned char[1];
		ch[0] = '0';
		length = 1;
		return (char*)ch;
	}
	while(! a.BIlisZero())
	{
		temp = a % base;
		a = a / base;
		for(i = 0; i < 9; ++i)
		{
			c = (unsigned char)((temp % 10) + ((unsigned int)'0'));
			s.push(c);
			temp /= 10;
		}
	}//convent the number at the base of ten to charactors and store the in the stack

	c = '0';
	while(c == '0')
		s.pop(c);

	length = s.getLength() + 1;
	i = 0;
	if(!positive)
		++length;
	ch = new unsigned char[length];

	if(!positive)
	{
		++i;
		ch[0] = '-';
	}
	for(; i < length; ++i)
	{
		ch[i] = c;
		s.pop(c);
	}//pop the characors and put the in the characotors

	return (char*)ch;
}
//output the number at the base of 16
char* BigInt::outputHEX(int& length)
{
	unsigned int temp;
	BigInt a;
	a.copy(*this);
	stack s;
	unsigned char c = '0';
	int i;

	unsigned char* ch;
	if(a.BIlisZero())
	{
		ch = new unsigned char[1];
		ch[0] = '0';
		length = 1;
		return (char*)ch;
	}

	while(!a.BIlisZero())
	{
		temp = a.getLast32Bit();
		a >>= 32;

		for(i = 0; i < 8; ++i)
		{
			c = HArray[temp & 0xF];
			s.push(c);
			temp >>= 4;
		}
	}//convent the number at the base of 16 to charactors and store the in the stack

	c = '0';
	while(c == '0')
		s.pop(c);

	length = s.getLength() + 1;
	i = 0;
	if(!positive)
		++length;
	ch = new unsigned char[length];

	if(!positive)
	{
		++i;
		ch[0] = '-';
	}
	for(; i < length; ++i)
	{
		ch[i] = c;
		s.pop(c);
	}//pop the characors and put the in the characotors

	return (char*)ch;
}
//output the number at form of ASCII 
char* BigInt::outputSTR(int& length)
{
	unsigned int temp;
	BigInt a;
	a.copy(*this);
	stack s;
	unsigned char c;
	int i;
	unsigned char* ch;
	if(a.BIlisZero())
	{
		ch = new unsigned char [1];
		ch[0] = 0;
		length = 1;
		return (char*)ch;
	}

	while(! a.BIlisZero())
	{
		temp = a.getLast32Bit();
		a >>= 32;
		for(i = 0; i < 4; ++i)
		{
			c = (unsigned char)(temp & 0xFF);
			s.push(c);
			temp >>= 8;
		}
	}//convent the number at the base of 16 to charactors and store the in the stack
	c = 0;
	while(c == 0)
		s.pop(c);

	length = s.getLength() + 1;
	ch = new unsigned char[length];

	for(i = 0; i < length; ++i)
	{
		ch[i] = c;
		s.pop(c);
	}//pop the characors and put the in the characotors

	return (char*)ch;
}
//reload the operator +
BigInt BigInt::operator + (const BigInt& p) const
{
	BigInt temp;

	if((positive && p.positive) || ((!positive) && (!p.positive)))
	{
		add(p, temp);
		temp.positive = positive;
	}
	else
	{
		if( BICompareABS(p) > 0)
		{
			minuse(p,temp);
			temp.positive = positive;
		}
		else
		{
			if( BICompareABS(p) == 0)
				temp.setZero();
			else
			{
				p.minuse(*this,temp);
				temp.positive = ! positive;
			}
		}//end of second else
	}//end of first else
	return temp;
}
//reload the operator + 
BigInt BigInt::operator + (const unsigned int& p) const
{
	BigInt temp;

	if(positive)
	{
		add(p, temp);
		temp.positive = true;
	}
	else
	{
		temp.setZero();

		if( BICompareABS(p) > 0)
		{
			minuse(p, temp);
			temp.positive = false;
		}

		if(BICompareABS(p) < 0)
		{
			temp.head -> num = p - head->num;
			temp.positive = true;
		}
	}
	return temp;
}

BigInt BigInt::operator - (const BigInt& p) const
{
	BigInt temp;

	if((positive && (!p.positive)) || ((!positive) && p.positive))
	{
		add(p, temp);
		temp.positive = positive;
	}
	else
	{
		if( BICompareABS(p) > 0)
		{
			minuse(p,temp);
			temp.positive = positive;
		}
		else
		{
			if( BICompareABS(p) == 0)
				temp.setZero();
			else
			{
				p.minuse(*this,temp);
				temp.positive = ! positive;
			}
		}//end of second else
	}//end of first else

	return temp;
}

BigInt BigInt::operator - (const unsigned int& p) const
{
	BigInt temp;

	if(!positive)
	{
		add(p, temp);
		temp.positive = false;
	}
	else
	{
		temp.setZero();

		if( BICompareABS(p) > 0)
		{
			minuse(p, temp);
			temp.positive = true;
		}

		if(BICompareABS(p) < 0)
		{
			temp.head->num = p - head->num;
			temp.positive = false;
		}
	}
	return temp;
}

BigInt BigInt::operator * (const unsigned int& p) const
{
	BigInt bin;

	unsigned int high = 0;
	unsigned int low = 0;
	intNode* temp = head;
	intNode* t1 = bin.head;
	intNode* t2 = bin.head;

	while(temp != NULL)
	{
		multi(p, temp->num, high, low);
		t1->num += low;
		if(t1->num < low)
			++high;
		t1->next = new intNode;
		t2 = t1;
		t1 = t1->next;
		t1->num = high;

		temp = temp->next;
	}

	if(t1->num == 0)
	{
		delete t1;
		t2->next = NULL;
	}

	bin.positive = positive;

	return bin;
}

BigInt BigInt::operator * (const BigInt& p) const
{
	BigInt bin;

	unsigned int high = 0;
	unsigned int low = 0;
	unsigned int carry = 0;

	intNode* temp1 = head;
	intNode* temp2 = p.head;
	intNode* t1 = bin.head;
	intNode* t2 = bin.head;
	intNode* t3 = bin.head;

	bin.positive = (positive && p.positive) || ((! positive) && (! p.positive));

	while(temp1 != NULL)
	{
		t2 = t1;
		temp2 = p.head;
		while(temp2 != NULL)
		{
			multi(temp1->num, temp2->num, high, low);
			t2->num += carry;
			if(t2->num < carry)
				carry = 1;
			else
				carry = 0;
			t2->num += low;
			if(t2->num < low)
				++carry;
			carry += high;
			if(t2->next == NULL)
			{
				t3 = t2;
				t2->next = new intNode;
			}
			t2 = t2->next;
			temp2 = temp2->next;
		}
		t2->num = carry;
		carry = 0;
		temp1 = temp1 -> next;
		t1 = t1->next;
	}
	if(t2->num == 0)
	{
		delete t2;
		t3->next = NULL;
	}

	return bin;
}

BigInt BigInt::operator / (const BigInt& p)
{
	BigInt d;
	BigInt r;

	r = BIdivision(p, d);
	r.positive = (positive && p.positive) || ((!positive) && (!p.positive));

	d.clear();
	return r;
}

BigInt BigInt::operator / (const unsigned int& p)
{
	BigInt d;
	BigInt r;
	BigInt pp;
	pp = p;

	r.positive = positive;
	r = BIdivision(pp, d);

	d.clear();
	pp.clear();

	return r;
}

BigInt BigInt::operator % (const BigInt& p) const
{
	BigInt a, mb;
	BigInt temp;

	a.copy(*this);

	a.positive = (p.positive && positive) || ((!p.positive) && (!positive));

	if(a.BICompareABS(p) > 0)
	{
		mb.copy(p);
		a.MakeClose(mb);
		while(a.BICompareABS(mb) > 0)
			mb <<= 1;
		
		while(a.BICompareABS(p) > 0)
		{
			while(a.BICompareABS(mb) < 0)
			mb >>= 1;
			temp = a - mb;
			a.copy(temp);
		}
	}
	if(a.BICompareABS(p) == 0)
		a.setZero();

	mb.clear();
	temp.clear();
	return a;
}

unsigned int BigInt::operator % (const unsigned int& p) const
{
	BigInt mb;
	mb = p;
	BigInt a;
	a = (*this) % mb;

	unsigned int temp;
	temp = a.head->num;

	mb.clear();
	a.clear();

	return temp;
}

bool BigInt::operator > (const BigInt& p) const
{
	if(positive && (!p.positive))
		return true;
	if((!positive) && p.positive)
		return false;

	if(positive && (BICompareABS(p) > 0))
		return true;
	if(!positive && (BICompareABS(p) < 0))
		return true;

	return false;
}
bool BigInt::operator > (const unsigned int p) const
{
	if(! positive)
		return false;

	if(BICompareABS(p) > 0)
		return true;

	return false;
}

bool BigInt::operator == (const BigInt& p) const
{
	if(positive &&(! p.positive))
		return false;
	return (BICompareABS(p) == 0);
}

bool BigInt::operator != (const BigInt& p) const
{
	if(positive && (! p.positive))
		return true;
	return (BICompareABS(p) != 0);
}

BigInt& BigInt::operator <<= (int iBit)
{
	if(BIlisZero())
		return *this;

	int block = 0;
	intNode* t1 = head;
	intNode* t2 = head;

	block = iBit / 32;
	for(int i = 0; i < block; ++i)
	{
		t2 = new intNode(head);
		head = t2;
	}

	iBit %= 32;
	if(iBit == 0)
		return *this;

	unsigned int carry = 0;
	unsigned int highF =((FULL >> (32 - iBit)) << (32 - iBit));
	unsigned int high;
	for(t2 = t1; t2->next != NULL; t2 = t2->next)
	{
		high = (t2->num & highF) >> (32 - iBit);
		t2->num <<= iBit;
		t2->num |= carry;
		carry = high;
	}
	high = (t2->num & highF) >> (32 - iBit);
	t2->num <<= iBit;
	t2->num |= carry;
	carry = high;
	if(carry != 0)
		t2->next = new intNode(carry);

	return *this;
}

BigInt& BigInt::operator >>= (int iBit)
{
	if(BIlisZero())
		return *this;

	int block = iBit / 32;
	intNode* t = head;
	for(int i = 0; (i < block) && (head != NULL); ++i)
	{
		t = head;
		head = head->next;
		delete t;
	}
	if(head == NULL)
	{
		head = new intNode;
		return *this;
	}

	iBit %= 32;
	if(iBit == 0)
		return *this;

	t = head;
	if(t->next == NULL)
	{
		t->num >>= iBit;
		return *this;
	}

	unsigned int low;
	unsigned int lowF = ((FULL << (32 - iBit)) >> (32 - iBit));
	unsigned int carry = 0;
	for(t = head; t->next->next != NULL; t = t->next)
	{
		low = ((t->next->num & lowF) << (32-iBit));
		t->num = ((t->num >> iBit) | low);
	}
	low = ((t->next->num & lowF) << (32-iBit));
	t->num = ((t->num >> iBit) | low);
	t->next->num >>= iBit;
	if(t->next->num == 0)
	{
		delete t->next;
		t->next = NULL;
	}
	return *this;
}

BigInt& BigInt::operator = (const BigInt& p)
{
	positive = p.positive;
	clear();
	head = p.head;
	return *this;
}

BigInt& BigInt::operator = (const unsigned int& p)
{
	positive = true;
	clear();
	head = new intNode(p);
	return *this;
}

BigInt& BigInt::operator ++ ()
{
	intNode *t = head;

	while(t->next != NULL)
	{
		++(t->num);
		if(t->num != 0)
			return *this;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
美女网站一区二区| 在线播放91灌醉迷j高跟美女 | 亚洲午夜三级在线| 欧美久久久久久蜜桃| 国产成人免费xxxxxxxx| 亚洲欧美另类久久久精品| 日韩免费在线观看| 国产高清亚洲一区| 欧美tickling网站挠脚心| 久久国产三级精品| 久久天堂av综合合色蜜桃网| 国产不卡在线播放| 中文字幕永久在线不卡| 91丨porny丨中文| 亚洲人成7777| 欧美在线999| 免费成人你懂的| 久久精品人人做人人爽97| 粉嫩av一区二区三区在线播放| 国产片一区二区| 欧美日韩国产精选| 高清久久久久久| 日韩av中文在线观看| 中文字幕人成不卡一区| 精品免费国产二区三区 | 亚洲香蕉伊在人在线观| 777午夜精品免费视频| 免费高清在线一区| 555夜色666亚洲国产免| 成人小视频免费观看| 一区二区三区.www| 久久婷婷色综合| 久久久精品2019中文字幕之3| 国产激情一区二区三区四区| 久久奇米777| 国产精品全国免费观看高清 | 日韩二区在线观看| 在线免费观看成人短视频| 婷婷久久综合九色综合绿巨人| 中文字幕欧美三区| 香蕉久久一区二区不卡无毒影院 | 欧美综合亚洲图片综合区| 亚洲精品成人精品456| 欧美不卡视频一区| 在线影院国内精品| 国产精品 日产精品 欧美精品| 亚洲啪啪综合av一区二区三区| 91精品国产91久久综合桃花| 国产成人综合视频| 国产精品家庭影院| 欧美福利视频导航| 不卡的av中国片| 国产乱色国产精品免费视频| 日韩av午夜在线观看| 一区二区三区高清在线| 中文字幕一区二区三区四区| 在线综合视频播放| 欧美精品18+| 欧美日韩国产大片| 欧美天堂一区二区三区| 色狠狠色狠狠综合| 欧美三区在线观看| 色综合久久88色综合天天6| 成人免费视频一区| 欧美日韩亚洲综合在线| 成人avav影音| 成人午夜电影久久影院| 风间由美一区二区三区在线观看| 亚洲卡通欧美制服中文| 一级中文字幕一区二区| 亚洲一区av在线| 日本欧美久久久久免费播放网| 一区二区三区免费看视频| 亚洲精品老司机| 免费在线成人网| 国产伦理精品不卡| 美女mm1313爽爽久久久蜜臀| 国产伦理精品不卡| 色婷婷综合五月| 日韩精品一区二区三区四区视频| 日韩三级视频在线看| 中文字幕一区二区三区色视频| 亚洲另类在线制服丝袜| 日韩精品免费专区| 久久精品国产一区二区三区免费看 | 中文字幕精品三区| 午夜视频一区在线观看| 国产精品中文字幕一区二区三区| 成人丝袜高跟foot| 日韩精品一区二区三区在线播放| 精品国产乱码久久久久久浪潮| 欧美高清在线视频| 日韩精品1区2区3区| 懂色av中文字幕一区二区三区| 色综合天天狠狠| 91精品欧美福利在线观看| 国产日本一区二区| 国内精品伊人久久久久影院对白| 在线观看国产91| 一区二区三区在线观看网站| 国产成人精品一区二| 欧美一级欧美一级在线播放| 一区二区高清免费观看影视大全 | 亚洲精品视频在线看| 成人免费视频国产在线观看| 亚洲精品一区在线观看| 亚洲电影视频在线| 欧美美女一区二区在线观看| 国产精品免费av| www.av亚洲| 亚洲人成在线播放网站岛国| 99国产精品一区| 亚洲色图制服丝袜| 国产成人综合在线播放| 91精品国产综合久久福利| 日本麻豆一区二区三区视频| 精品国产亚洲在线| 国产精品99久久久久久似苏梦涵 | 91视视频在线观看入口直接观看www| 中文字幕第一区二区| 色嗨嗨av一区二区三区| 一区二区三区不卡在线观看 | 婷婷夜色潮精品综合在线| 日韩精品影音先锋| 国产不卡视频在线播放| 欧美人体做爰大胆视频| 久久精品国产精品青草| 69av一区二区三区| 国产精品亚洲第一区在线暖暖韩国| 中文字幕日本乱码精品影院| 色视频成人在线观看免| 一区二区三国产精华液| 欧美一区二区三区成人| 国产自产视频一区二区三区| 中文字幕一区二区三区乱码在线| 国产呦精品一区二区三区网站| 亚洲精品国产精品乱码不99| 久久久高清一区二区三区| 欧美久久久久久蜜桃| 欧美日韩视频专区在线播放| av一二三不卡影片| 成人av片在线观看| 成人久久久精品乱码一区二区三区| 韩日欧美一区二区三区| 亚洲色图视频免费播放| 国产欧美精品在线观看| 国产日本一区二区| 久久精品日产第一区二区三区高清版| 日韩欧美在线影院| 日韩视频在线你懂得| 日韩精品一区二区三区在线观看| 337p亚洲精品色噜噜狠狠| 日韩免费看网站| 久久人人超碰精品| 中文字幕字幕中文在线中不卡视频| 国产免费成人在线视频| 最新国产成人在线观看| 亚洲午夜在线观看视频在线| 免费成人美女在线观看| 国产综合色在线| 国产成人免费高清| 欧美三级日韩在线| 精品国产一区二区在线观看| 国产精品少妇自拍| 夜夜亚洲天天久久| 国产精品一二三区在线| 日本韩国欧美一区二区三区| 日韩精品一区二区三区蜜臀 | 日本欧洲一区二区| 成人av网址在线| 欧美成人三级在线| 国产精品久久久99| 婷婷综合五月天| 91蜜桃视频在线| 精品国产123| 亚洲成人在线网站| 91在线云播放| 国产亚洲一区二区三区四区| 一二三区精品福利视频| av亚洲精华国产精华| 精品乱码亚洲一区二区不卡| 亚洲国产视频a| 99v久久综合狠狠综合久久| 日韩一卡二卡三卡四卡| 亚洲成人www| 欧美三级午夜理伦三级中视频| 国产精品青草综合久久久久99| 理论电影国产精品| 日韩免费观看2025年上映的电影| 亚洲午夜视频在线观看| 91丝袜国产在线播放| 最新热久久免费视频| av亚洲精华国产精华精华| 中文字幕巨乱亚洲| 成人自拍视频在线| 亚洲少妇30p| 欧美亚州韩日在线看免费版国语版| 自拍偷拍亚洲激情| 91久久线看在观草草青青| 亚洲第一综合色|