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

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

?? bignumber.cpp

?? RSA加密解密算法
?? CPP
?? 第 1 頁 / 共 5 頁
字號:
/*
 * An optimized version of the above, for shifts of 1.
 * Some machines can use add-with-carry tricks for this.
 */
#ifndef bniDouble_32
BNWORD32
bniDouble_32(BNWORD32 *num, unsigned len)
{
	BNWORD32 x, carry;

	carry = 0;
	while (len--) {
		BIG(--num;)
		x = *num;
		*num = (x<<1) | carry;
		LITTLE(num++;)
		carry = x >> (32-1);
	}
	return carry;
}
#endif /* !bniDouble_32 */

/*
 * Shift n words right "shift" bits.  0 < shift < 32.  Returns the
 * carry, any bits shifted off the right-hand side (0 <= carry < 2^shift).
 */
#ifndef bniRshift_32
BNWORD32
bniRshift_32(BNWORD32 *num, unsigned len, unsigned shift)
{
	BNWORD32 x, carry = 0;

	ASSERT(shift > 0);
	ASSERT(shift < 32);

	BIGLITTLE(num -= len, num += len);

	while (len--) {
		LITTLE(--num;)
		x = *num;
		*num = (x>>shift) | carry;
		BIG(num++;)
		carry = x << (32-shift);
	}
	return carry >> (32-shift);
}
#endif /* !bniRshift_32 */

/* 
 * Multiply two numbers of the given lengths.  prod and num2 may overlap,
 * provided that the low len1 bits of prod are free.  (This corresponds
 * nicely to the place the result is returned from bniMontReduce_32.)
 *
 * TODO: Use Karatsuba multiply.  The overlap constraints may have
 * to get rewhacked.
 */
#ifndef bniMul_32
void
bniMul_32(BNWORD32 *prod, BNWORD32 const *num1, unsigned len1,
                          BNWORD32 const *num2, unsigned len2)
{
	/* Special case of zero */
	if (!len1 || !len2) {
		bniZero_32(prod, len1+len2);
		return;
	}

	/* Multiply first word */
	bniMulN1_32(prod, num1, len1, BIGLITTLE(*--num2,*num2++));

	/*
	 * Add in subsequent words, storing the most significant word,
	 * which is new each time.
	 */
	while (--len2) {
		BIGLITTLE(--prod,prod++);
		BIGLITTLE(*(prod-len1-1),*(prod+len1)) =
			bniMulAdd1_32(prod, num1, len1,
				BIGLITTLE(*--num2,*num2++));
	}
}
#endif /* !bniMul_32 */

/*
 * bniMulX_32 is a square multiply - both inputs are the same length.
 * It's normally just a macro wrapper around the general multiply,
 * but might be implementable in assembly more efficiently (such as
 * when product scanning).
 */
#ifndef bniMulX_32
#if defined(BNWORD64) && PRODUCT_SCAN
/*
 * Test code to see whether product scanning is any faster.  It seems
 * to make the C code slower, so PRODUCT_SCAN is not defined.
 */
static void
bniMulX_32(BNWORD32 *prod, BNWORD32 const *num1, BNWORD32 const *num2,
	unsigned len)
{
	BNWORD64 x, y;
	BNWORD32 const *p1, *p2;
	unsigned carry;
	unsigned i, j;

	/* Special case of zero */
	if (!len)
		return;

	x = (BNWORD64)BIGLITTLE(num1[-1] * num2[-1], num1[0] * num2[0]);
	BIGLITTLE(*--prod, *prod++) = (BNWORD32)x;
	x >>= 32;

	for (i = 1; i < len; i++) {
		carry = 0;
		p1 = num1;
		p2 = BIGLITTLE(num2-i-1,num2+i+1);
		for (j = 0; j <= i; j++) {
			BIG(y = (BNWORD64)*--p1 * *p2++;)
			LITTLE(y = (BNWORD64)*p1++ * *--p2;)
			x += y;
			carry += (x < y);
		}
		BIGLITTLE(*--prod,*prod++) = (BNWORD32)x;
		x = (x >> 32) | (BNWORD64)carry << 32;
	}
	for (i = 1; i < len; i++) {
		carry = 0;
		p1 = BIGLITTLE(num1-i,num1+i);
		p2 = BIGLITTLE(num2-len,num2+len);
		for (j = i; j < len; j++) {
			BIG(y = (BNWORD64)*--p1 * *p2++;)
			LITTLE(y = (BNWORD64)*p1++ * *--p2;)
			x += y;
			carry += (x < y);
		}
		BIGLITTLE(*--prod,*prod++) = (BNWORD32)x;
		x = (x >> 32) | (BNWORD64)carry << 32;
	}
	
	BIGLITTLE(*--prod,*prod) = (BNWORD32)x;
}
#else /* !defined(BNWORD64) || !PRODUCT_SCAN */
/* Default trivial macro definition */
#define bniMulX_32(prod, num1, num2, len) bniMul_32(prod, num1, len, num2, len)
#endif /* !defined(BNWORD64) || !PRODUCT_SCAN */
#endif /* !lbmMulX_32 */

#if !defined(bniMontMul_32) && defined(BNWORD64) && PRODUCT_SCAN
/*
 * Test code for product-scanning multiply.  This seems to slow the C
 * code down rather than speed it up.
 * This does a multiply and Montgomery reduction together, using the
 * same loops.  The outer loop scans across the product, twice.
 * The first pass computes the low half of the product and the
 * Montgomery multipliers.  These are stored in the product array,
 * which contains no data as of yet.  x and carry add up the columns
 * and propagate carries forward.
 *
 * The second half multiplies the upper half, adding in the modulus
 * times the Montgomery multipliers.  The results of this multiply
 * are stored.
 */
static void
bniMontMul_32(BNWORD32 *prod, BNWORD32 const *num1, BNWORD32 const *num2,
	BNWORD32 const *mod, unsigned len, BNWORD32 inv)
{
	BNWORD64 x, y;
	BNWORD32 const *p1, *p2, *pm;
	BNWORD32 *pp;
	BNWORD32 t;
	unsigned carry;
	unsigned i, j;

	/* Special case of zero */
	if (!len)
		return;

	/*
	 * This computes directly into the high half of prod, so just
	 * shift the pointer and consider prod only "len" elements long
	 * for the rest of the code.
	 */
	BIGLITTLE(prod -= len, prod += len);

	/* Pass 1 - compute Montgomery multipliers */
	/* First iteration can have certain simplifications. */
	x = (BNWORD64)BIGLITTLE(num1[-1] * num2[-1], num1[0] * num2[0]);
	BIGLITTLE(prod[-1], prod[0]) = t = inv * (BNWORD32)x;
	y = (BNWORD64)t * BIGLITTLE(mod[-1],mod[0]);
	x += y;
	/* Note: GCC 2.6.3 has a bug if you try to eliminate "carry" */
	carry = (x < y);
	ASSERT((BNWORD32)x == 0);
	x = x >> 32 | (BNWORD64)carry << 32;

	for (i = 1; i < len; i++) {
		carry = 0;
		p1 = num1;
		p2 = BIGLITTLE(num2-i-1,num2+i+1);
		pp = prod;
		pm = BIGLITTLE(mod-i-1,mod+i+1);
		for (j = 0; j < i; j++) {
			y = (BNWORD64)BIGLITTLE(*--p1 * *p2++, *p1++ * *--p2);
			x += y;
			carry += (x < y);
			y = (BNWORD64)BIGLITTLE(*--pp * *pm++, *pp++ * *--pm);
			x += y;
			carry += (x < y);
		}
		y = (BNWORD64)BIGLITTLE(p1[-1] * p2[0], p1[0] * p2[-1]);
		x += y;
		carry += (x < y);
		ASSERT(BIGLITTLE(pp == prod-i, pp == prod+i));
		BIGLITTLE(pp[-1], pp[0]) = t = inv * (BNWORD32)x;
		ASSERT(BIGLITTLE(pm == mod-1, pm == mod+1));
		y = (BNWORD64)t * BIGLITTLE(pm[0],pm[-1]);
		x += y;
		carry += (x < y);
		ASSERT((BNWORD32)x == 0);
		x = x >> 32 | (BNWORD64)carry << 32;
	}

	/* Pass 2 - compute reduced product and store */
	for (i = 1; i < len; i++) {
		carry = 0;
		p1 = BIGLITTLE(num1-i,num1+i);
		p2 = BIGLITTLE(num2-len,num2+len);
		pm = BIGLITTLE(mod-i,mod+i);
		pp = BIGLITTLE(prod-len,prod+len);
		for (j = i; j < len; j++) {
			y = (BNWORD64)BIGLITTLE(*--p1 * *p2++, *p1++ * *--p2);
			x += y;
			carry += (x < y);
			y = (BNWORD64)BIGLITTLE(*--pm * *pp++, *pm++ * *--pp);
			x += y;
			carry += (x < y);
		}
		ASSERT(BIGLITTLE(pm == mod-len, pm == mod+len));
		ASSERT(BIGLITTLE(pp == prod-i, pp == prod+i));
		BIGLITTLE(pp[0],pp[-1]) = (BNWORD32)x;
		x = (x >> 32) | (BNWORD64)carry << 32;
	}

	/* Last round of second half, simplified. */
	BIGLITTLE(*(prod-len),*(prod+len-1)) = (BNWORD32)x;
	carry = (x >> 32);

	while (carry)
		carry -= bniSubN_32(prod, mod, len);
	while (bniCmp_32(prod, mod, len) >= 0)
		(void)bniSubN_32(prod, mod, len);
}
/* Suppress later definition */
#define bniMontMul_32 bniMontMul_32
#endif

#if !defined(bniSquare_32) && defined(BNWORD64) && PRODUCT_SCAN
/*
 * Trial code for product-scanning squaring.  This seems to slow the C
 * code down rather than speed it up.
 */
void
bniSquare_32(BNWORD32 *prod, BNWORD32 const *num, unsigned len)
{
	BNWORD64 x, y, z;
	BNWORD32 const *p1, *p2;
	unsigned carry;
	unsigned i, j;

	/* Special case of zero */
	if (!len)
		return;

	/* Word 0 of product */
	x = (BNWORD64)BIGLITTLE(num[-1] * num[-1], num[0] * num[0]);
	BIGLITTLE(*--prod, *prod++) = (BNWORD32)x;
	x >>= 32;

	/* Words 1 through len-1 */
	for (i = 1; i < len; i++) {
		carry = 0;
		y = 0;
		p1 = num;
		p2 = BIGLITTLE(num-i-1,num+i+1);
		for (j = 0; j < (i+1)/2; j++) {
			BIG(z = (BNWORD64)*--p1 * *p2++;)
			LITTLE(z = (BNWORD64)*p1++ * *--p2;)
			y += z;
			carry += (y < z);
		}
		y += z = y;
		carry += carry + (y < z);
		if ((i & 1) == 0) {
			ASSERT(BIGLITTLE(p1-1 == p2, p1 == p2-1));
			BIG(z = (BNWORD64)*p2 * *p2;)
			LITTLE(z = (BNWORD64)*p1 * *p1;)
			y += z;
			carry += (y < z);
		}
		x += y;
		carry += (x < y);
		BIGLITTLE(*--prod,*prod++) = (BNWORD32)x;
		x = (x >> 32) | (BNWORD64)carry << 32;
	}
	/* Words len through 2*len-2 */
	for (i = 1; i < len; i++) {
		carry = 0;
		y = 0;
		p1 = BIGLITTLE(num-i,num+i);
		p2 = BIGLITTLE(num-len,num+len);
		for (j = 0; j < (len-i)/2; j++) {
			BIG(z = (BNWORD64)*--p1 * *p2++;)
			LITTLE(z = (BNWORD64)*p1++ * *--p2;)
			y += z;
			carry += (y < z);
		}
		y += z = y;
		carry += carry + (y < z);
		if ((len-i) & 1) {
			ASSERT(BIGLITTLE(p1-1 == p2, p1 == p2-1));
			BIG(z = (BNWORD64)*p2 * *p2;)
			LITTLE(z = (BNWORD64)*p1 * *p1;)
			y += z;
			carry += (y < z);
		}
		x += y;
		carry += (x < y);
		BIGLITTLE(*--prod,*prod++) = (BNWORD32)x;
		x = (x >> 32) | (BNWORD64)carry << 32;
	}
	
	/* Word 2*len-1 */
	BIGLITTLE(*--prod,*prod) = (BNWORD32)x;
}
/* Suppress later definition */
#define bniSquare_32 bniSquare_32
#endif

/*
 * Square a number, using optimized squaring to reduce the number of
 * primitive multiples that are executed.  There may not be any
 * overlap of the input and output.
 *
 * Technique: Consider the partial products in the multiplication
 * of "abcde" by itself:
 *
 *               a  b  c  d  e
 *            *  a  b  c  d  e
 *          ==================
 *              ae be ce de ee
 *           ad bd cd dd de
 *        ac bc cc cd ce
 *     ab bb bc bd be
 *  aa ab ac ad ae
 *
 * Note that everything above the main diagonal:
 *              ae be ce de = (abcd) * e
 *           ad bd cd       = (abc) * d
 *        ac bc             = (ab) * c
 *     ab                   = (a) * b
 *
 * is a copy of everything below the main diagonal:
 *                       de
 *                 cd ce
 *           bc bd be
 *     ab ac ad ae
 *
 * Thus, the sum is 2 * (off the diagonal) + diagonal.
 *
 * This is accumulated beginning with the diagonal (which
 * consist of the squares of the digits of the input), which is then
 * divided by two, the off-diagonal added, and multiplied by two
 * again.  The low bit is simply a copy of the low bit of the
 * input, so it doesn't need special care.
 *
 * TODO: Merge the shift by 1 with the squaring loop.
 * TODO: Use Karatsuba.  (a*W+b)^2 = a^2 * (W^2+W) + b^2 * (W+1) - (a-b)^2 * W.
 */
#ifndef bniSquare_32
void
bniSquare_32(BNWORD32 *prod, BNWORD32 const *num, unsigned len)
{
	BNWORD32 t;
	BNWORD32 *prodx = prod;		/* Working copy of the argument */
	BNWORD32 const *numx = num;	/* Working copy of the argument */
	unsigned lenx = len;		/* Working copy of the argument */

	if (!len)
		return;

	/* First, store all the squares */
	while (lenx--) {
#ifdef mul32_ppmm
		BNWORD32 ph, pl;
		t = BIGLITTLE(*--numx,*numx++);
		mul32_ppmm(ph,pl,t,t);
		BIGLITTLE(*--prodx,*prodx++) = pl;
		BIGLITTLE(*--prodx,*prodx++) = ph;
#elif defined(BNWORD64) /* use BNWORD64 */
		BNWORD64 p;
		t = BIGLITTLE(*--numx,*numx++);
		p = (BNWORD64)t * t;
		BIGLITTLE(*--prodx,*prodx++) = (BNWORD32)p;
		BIGLITTLE(*--prodx,*prodx++) = (BNWORD32)(p>>32);
#else	/* Use bniMulN1_32 */
		t = BIGLITTLE(numx[-1],*numx);
		bniMulN1_32(prodx, numx, 1, t);
		BIGLITTLE(--numx,numx++);
		BIGLITTLE(prodx -= 2, prodx += 2);
#endif
	}
	/* Then, shift right 1 bit */
	(void)bniRshift_32(prod, 2*len, 1);

	/* Then, add in the off-diagonal sums */
	lenx = len;
	numx = num;
	prodx = prod;
	while (--lenx) {
		t = BIGLITTLE(*--numx,*numx++);
		BIGLITTLE(--prodx,prodx++);
		t = bniMulAdd1_32(prodx, numx, lenx, t);
		bniAdd1_32(BIGLITTLE(prodx-lenx,prodx+lenx), lenx+1, t);
		BIGLITTLE(--prodx,prodx++);
	}

	/* Shift it back up */
	bniDouble_32(prod, 2*len);

	/* And set the low bit appropriately */
	BIGLITTLE(prod[-1],prod[0]) |= BIGLITTLE(num[-1],num[0]) & 1;
}
#endif /* !bniSquare_32 */

/*
 * bniNorm_32 - given a number, return a modified length such that the
 * most significant digit is non-zero.  Zero-length input is okay.
 */
#ifndef bniNorm_32
unsigned
bniNorm_32(BNWORD32 const *num, unsigned len)
{
	BIGLITTLE(num -= len,num += len);
	while (len && BIGLITTLE(*num++,*--num) == 0)
		--len;
	return len;
}
#endif /* bniNorm_32 */

/*
 * bniBits_32 - return the number of significant bits in the array.
 * It starts by normalizing the array.  Zero-length input is okay.
 * Then assuming there's anything to it, it fetches the high word,
 * generates a bit length by multiplying the word length by 32, and
 * subtracts off 32/2, 32/4, 32/8, ... bits if the high bits are clear.
 */
#ifndef bniBits_32
unsigned
bniBits_32(BNWORD32 const *num, unsigned len)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩电影在线一区二区三区| 久久99精品视频| 日韩亚洲欧美高清| av成人老司机| 狠狠色丁香婷综合久久| 亚洲综合久久久| 国产精品久久久久久久久久久免费看 | 国产精品18久久久久久久久久久久 | 777午夜精品视频在线播放| 国产专区综合网| 一区二区三区日韩欧美| 中文字幕乱码亚洲精品一区| 在线播放中文字幕一区| 91免费视频网| 粉嫩av一区二区三区| 美美哒免费高清在线观看视频一区二区| 国产精品麻豆网站| 国产午夜精品在线观看| 日韩欧美国产精品一区| 欧美视频一区在线| 91在线免费看| 成人黄色一级视频| 国产精品一区二区三区99| 亚洲永久免费视频| 亚洲色欲色欲www| 国产精品欧美极品| 久久久综合九色合综国产精品| 91精品国产色综合久久ai换脸| 91尤物视频在线观看| 国产激情视频一区二区在线观看| 麻豆精品精品国产自在97香蕉| 午夜亚洲国产au精品一区二区| 樱花影视一区二区| 亚洲欧美电影院| 亚洲日本丝袜连裤袜办公室| 国产精品国产a| 国产精品麻豆视频| 亚洲国产精品高清| 国产精品久久久久影院亚瑟| 久久欧美中文字幕| 久久精品欧美一区二区三区不卡 | 欧美va天堂va视频va在线| 7777精品伊人久久久大香线蕉完整版| 欧美又粗又大又爽| 欧美日韩综合不卡| 欧美日韩亚洲综合在线 | 久久精品一区蜜桃臀影院| 精品成人佐山爱一区二区| 亚洲精品一区在线观看| 国产三级精品三级| 国产精品色呦呦| 中文字幕一区二区三区蜜月| 亚洲人一二三区| 亚洲国产欧美在线人成| 青青草视频一区| 麻豆免费精品视频| 国产精品911| www.综合网.com| 欧美怡红院视频| 制服视频三区第一页精品| 日韩欧美一区二区三区在线| 久久精品视频在线免费观看| 18欧美乱大交hd1984| 亚洲国产毛片aaaaa无费看| 日本成人在线不卡视频| 国内久久精品视频| 91麻豆免费观看| 欧美精品久久一区| 久久网这里都是精品| 国产精品大尺度| 婷婷综合五月天| 国产一区二区三区在线看麻豆| 不卡一区在线观看| 欧美日韩国产综合久久| 久久网站最新地址| 亚洲精品videosex极品| 琪琪久久久久日韩精品| 福利一区福利二区| 欧美日韩一区二区三区免费看| 精品国产一区二区三区四区四 | 欧美色区777第一页| 精品欧美一区二区久久| 亚洲欧美福利一区二区| 蜜桃视频在线观看一区| 成人小视频免费观看| 欧美卡1卡2卡| 久久久www免费人成精品| 亚洲一区在线观看网站| 国产乱国产乱300精品| 欧美在线观看一二区| 久久久久99精品一区| 亚洲毛片av在线| 国产一区二区女| 欧美在线观看你懂的| 国产午夜精品一区二区| 午夜精品视频在线观看| 丁香婷婷深情五月亚洲| 在线成人免费视频| 亚洲欧美日韩在线不卡| 狠狠色丁香久久婷婷综合_中 | 色噜噜狠狠一区二区三区果冻| 欧美一级国产精品| 一区二区三区美女视频| 国产精品羞羞答答xxdd| 日韩一卡二卡三卡四卡| 一区二区三区中文字幕电影 | 91.xcao| 国产精品久久久久aaaa| 美女尤物国产一区| 91福利视频在线| 国产精品水嫩水嫩| 久久精品久久久精品美女| 欧美亚洲尤物久久| 亚洲欧美一区二区三区孕妇| 国产福利一区二区三区视频在线| 欧美裸体一区二区三区| 亚洲免费视频中文字幕| 成人手机在线视频| 久久久久久久久伊人| 久久精品国产久精国产| 欧美日韩国产影片| 亚洲美女精品一区| 99久久99久久久精品齐齐| 国产欧美日韩不卡| 国产呦精品一区二区三区网站| 欧美一区二区三区精品| 天使萌一区二区三区免费观看| 色欲综合视频天天天| 中文字幕在线观看一区| 高清不卡在线观看| 2欧美一区二区三区在线观看视频| 午夜欧美一区二区三区在线播放| 色婷婷久久久久swag精品| 中文字幕电影一区| 国产精品中文字幕欧美| 欧美精品一区二区精品网| 老司机免费视频一区二区| 欧美大片顶级少妇| 久久精品二区亚洲w码| 欧美一级淫片007| 日韩在线一区二区三区| 欧美精品vⅰdeose4hd| 三级成人在线视频| 欧美一区二区大片| 九九九精品视频| 久久久久久黄色| 国产伦精一区二区三区| 一区二区三区在线观看国产| 成年人国产精品| 日本一区二区三区四区| 成人精品亚洲人成在线| 国产成人啪免费观看软件| 蜜臀久久99精品久久久画质超高清| 狠狠久久亚洲欧美| 欧美激情综合五月色丁香小说| jlzzjlzz亚洲女人18| 亚洲视频一区二区在线| 欧美系列一区二区| 免费成人在线视频观看| 久久精品一区二区三区不卡牛牛| 成人性生交大片免费看在线播放| 亚洲女女做受ⅹxx高潮| 欧美精品少妇一区二区三区| 久久99热这里只有精品| 国产日产精品1区| 91日韩精品一区| 午夜精品久久久久久不卡8050| **性色生活片久久毛片| 亚洲成人中文在线| 91老师片黄在线观看| 亚洲大片一区二区三区| 精品日韩欧美在线| 成人午夜大片免费观看| 亚洲最大成人网4388xx| 欧美成人性战久久| av电影在线不卡| 日本特黄久久久高潮| 中文字幕第一区第二区| 欧美日韩久久久| 国产精品77777竹菊影视小说| 亚洲精品第一国产综合野| 日韩一级在线观看| 91视频一区二区三区| 久久精品国产精品亚洲精品| 国产精品毛片高清在线完整版| 在线电影院国产精品| 播五月开心婷婷综合| 欧美aaa在线| 亚洲精品日产精品乱码不卡| 精品久久人人做人人爰| 欧洲av在线精品| 国产成人av电影免费在线观看| 亚洲国产综合色| 国产精品久久久久aaaa樱花| 欧美一区二区国产| 欧美性做爰猛烈叫床潮| 成人综合婷婷国产精品久久| 日韩成人免费看| 亚洲精品乱码久久久久久黑人| 久久夜色精品国产噜噜av|