【发布时间】:2018-11-27 14:03:47
【问题描述】:
我尝试计算椭圆曲线 F2m (m = 163) 的 x 坐标的 Tr(x) 运算。为此,我使用了具有相应类型的“Bouncy Castle”。我的椭圆曲线的迹线等于 0 或 1,我的代码如下:
public int CalculateTrace_Test(byte[] array)
{
int m = 163;
BigInteger two = new BigInteger("2", 10);
BigInteger x = new BigInteger(array);
BigInteger xi = x;
BigInteger temp = x;
for (int i = 1; i < m; i++)
{
var next = xi.ModPow(two.Pow(i), fx);
temp = temp.Xor(next);
}
return temp.IntValue;
}
这里 fx 是由不可约多项式f(x) = x^163+x^7+x^6+x^3 + 1 形成的整数。
所以我的问题是它不起作用,因此我什么都有,但不是 1 或 0。谁能告诉我跟踪的实现有什么问题?
【问题讨论】:
标签: java cryptography bouncycastle