本文整理汇总了C#中Org.BouncyCastle.Math.EC.ECCurve.FromBigInteger方法的典型用法代码示例。如果您正苦于以下问题:C# ECCurve.FromBigInteger方法的具体用法?C# ECCurve.FromBigInteger怎么用?C# ECCurve.FromBigInteger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Org.BouncyCastle.Math.EC.ECCurve
的用法示例。
在下文中一共展示了ECCurve.FromBigInteger方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetInitialZCoords
protected static ECFieldElement[] GetInitialZCoords(ECCurve curve)
{
// Cope with null curve, most commonly used by implicitlyCa
int coord = null == curve ? ECCurve.COORD_AFFINE : curve.CoordinateSystem;
switch (coord)
{
case ECCurve.COORD_AFFINE:
case ECCurve.COORD_LAMBDA_AFFINE:
return EMPTY_ZS;
default:
break;
}
ECFieldElement one = curve.FromBigInteger(BigInteger.One);
switch (coord)
{
case ECCurve.COORD_HOMOGENEOUS:
case ECCurve.COORD_JACOBIAN:
case ECCurve.COORD_LAMBDA_PROJECTIVE:
return new ECFieldElement[] { one };
case ECCurve.COORD_JACOBIAN_CHUDNOVSKY:
return new ECFieldElement[] { one, one, one };
case ECCurve.COORD_JACOBIAN_MODIFIED:
return new ECFieldElement[] { one, curve.A };
default:
throw new ArgumentException("unknown coordinate system");
}
}
示例2: ImplSqrtTest
private void ImplSqrtTest(ECCurve c)
{
if (ECAlgorithms.IsFpCurve(c))
{
BigInteger p = c.Field.Characteristic;
BigInteger pMinusOne = p.Subtract(BigInteger.One);
BigInteger legendreExponent = p.ShiftRight(1);
int count = 0;
while (count < 10)
{
BigInteger nonSquare = BigIntegers.CreateRandomInRange(BigInteger.Two, pMinusOne, secRand);
if (!nonSquare.ModPow(legendreExponent, p).Equals(BigInteger.One))
{
ECFieldElement root = c.FromBigInteger(nonSquare).Sqrt();
Assert.IsNull(root);
++count;
}
}
}
}
示例3: ImplSqrtTest
private void ImplSqrtTest(ECCurve c)
{
if (ECAlgorithms.IsFpCurve(c))
{
BigInteger p = c.Field.Characteristic;
BigInteger pMinusOne = p.Subtract(BigInteger.One);
BigInteger legendreExponent = p.ShiftRight(1);
int count = 0;
while (count < 10)
{
BigInteger nonSquare = BigIntegers.CreateRandomInRange(BigInteger.Two, pMinusOne, secRand);
if (!nonSquare.ModPow(legendreExponent, p).Equals(BigInteger.One))
{
ECFieldElement root = c.FromBigInteger(nonSquare).Sqrt();
Assert.IsNull(root);
++count;
}
}
}
else if (ECAlgorithms.IsF2mCurve(c))
{
int m = c.FieldSize;
BigInteger x = new BigInteger(m, secRand);
ECFieldElement fe = c.FromBigInteger(x);
for (int i = 0; i < 100; ++i)
{
ECFieldElement sq = fe.Square();
ECFieldElement check = sq.Sqrt();
Assert.AreEqual(fe, check);
fe = sq;
}
}
}