本文整理汇总了Java中org.bouncycastle.math.ec.ECFieldElement.getFieldSize方法的典型用法代码示例。如果您正苦于以下问题:Java ECFieldElement.getFieldSize方法的具体用法?Java ECFieldElement.getFieldSize怎么用?Java ECFieldElement.getFieldSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bouncycastle.math.ec.ECFieldElement
的用法示例。
在下文中一共展示了ECFieldElement.getFieldSize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calculateTrace
import org.bouncycastle.math.ec.ECFieldElement; //导入方法依赖的package包/类
private static int calculateTrace(ECFieldElement fe)
{
int m = fe.getFieldSize();
ECFieldElement tr = fe;
for (int i = 1; i < m; ++i)
{
fe = fe.square();
tr = tr.add(fe);
}
BigInteger b = tr.toBigInteger();
if (b.bitLength() > 1)
{
throw new IllegalStateException();
}
return b.intValue();
}
示例2: trace
import org.bouncycastle.math.ec.ECFieldElement; //导入方法依赖的package包/类
private static BigInteger trace(ECFieldElement fe)
{
ECFieldElement t = fe;
for (int i = 0; i < fe.getFieldSize() - 1; i++)
{
t = t.square().add(fe);
}
return t.toBigInteger();
}
示例3: trace
import org.bouncycastle.math.ec.ECFieldElement; //导入方法依赖的package包/类
private static ECFieldElement trace(ECFieldElement fe)
{
ECFieldElement t = fe;
for (int i = 1; i < fe.getFieldSize(); ++i)
{
t = t.square().add(fe);
}
return t;
}
示例4: solveQuadraticEquation
import org.bouncycastle.math.ec.ECFieldElement; //导入方法依赖的package包/类
/**
* Solves a quadratic equation <code>z<sup>2</sup> + z = beta</code>(X9.62
* D.1.6) The other solution is <code>z + 1</code>.
*
* @param beta The value to solve the quadratic equation for.
* @return the solution for <code>z<sup>2</sup> + z = beta</code> or
* <code>null</code> if no solution exists.
*/
private static ECFieldElement solveQuadraticEquation(ECCurve curve, ECFieldElement beta)
{
if (beta.isZero())
{
return beta;
}
ECFieldElement zeroElement = curve.fromBigInteger(ECConstants.ZERO);
ECFieldElement z = null;
ECFieldElement gamma = null;
Random rand = new Random();
int m = beta.getFieldSize();
do
{
ECFieldElement t = curve.fromBigInteger(new BigInteger(m, rand));
z = zeroElement;
ECFieldElement w = beta;
for (int i = 1; i <= m - 1; i++)
{
ECFieldElement w2 = w.square();
z = z.square().add(w2.multiply(t));
w = w2.add(beta);
}
if (!w.isZero())
{
return null;
}
gamma = z.square().add(z);
}
while (gamma.isZero());
return z;
}
示例5: getByteLength
import org.bouncycastle.math.ec.ECFieldElement; //导入方法依赖的package包/类
public int getByteLength(
ECFieldElement fe)
{
return (fe.getFieldSize() + 7) / 8;
}