本文整理了Java中org.bouncycastle.math.ec.ECPoint.subtract()
方法的一些代码示例,展示了ECPoint.subtract()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ECPoint.subtract()
方法的具体详情如下:
包路径:org.bouncycastle.math.ec.ECPoint
类名称:ECPoint
方法名:subtract
暂无
代码示例来源:origin: redfish64/TinyTravelTracker
/**
* Decrypt an EC pair producing the original EC point.
*
* @param pair the EC point pair to process.
* @return the result of the Elgamal process.
*/
public ECPoint decrypt(ECPair pair)
{
if (key == null)
{
throw new IllegalStateException("ECElGamalDecryptor not initialised");
}
ECPoint tmp = pair.getX().multiply(key.getD());
return pair.getY().subtract(tmp).normalize();
}
}
代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on
/**
* Decrypt an EC pair producing the original EC point.
*
* @param pair the EC point pair to process.
* @return the result of the Elgamal process.
*/
public ECPoint decrypt(ECPair pair)
{
if (key == null)
{
throw new IllegalStateException("ECElGamalDecryptor not initialised");
}
ECCurve curve = key.getParameters().getCurve();
ECPoint tmp = ECAlgorithms.cleanPoint(curve, pair.getX()).multiply(key.getD());
return ECAlgorithms.cleanPoint(curve, pair.getY()).subtract(tmp).normalize();
}
}
代码示例来源:origin: redfish64/TinyTravelTracker
static ECPoint implShamirsTrickJsf(ECPoint P, BigInteger k,
ECPoint Q, BigInteger l)
{
ECCurve curve = P.getCurve();
ECPoint infinity = curve.getInfinity();
// TODO conjugate co-Z addition (ZADDC) can return both of these
ECPoint PaddQ = P.add(Q);
ECPoint PsubQ = P.subtract(Q);
ECPoint[] points = new ECPoint[]{ Q, PsubQ, P, PaddQ };
curve.normalizeAll(points);
ECPoint[] table = new ECPoint[] {
points[3].negate(), points[2].negate(), points[1].negate(),
points[0].negate(), infinity, points[0],
points[1], points[2], points[3] };
byte[] jsf = WNafUtil.generateJSF(k, l);
ECPoint R = infinity;
int i = jsf.length;
while (--i >= 0)
{
int jsfi = jsf[i];
// NOTE: The shifting ensures the sign is extended correctly
int kDigit = ((jsfi << 24) >> 28), lDigit = ((jsfi << 28) >> 28);
int index = 4 + (kDigit * 3) + lDigit;
R = R.twicePlus(table[index]);
}
return R;
}
代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on
static ECPoint implShamirsTrickJsf(ECPoint P, BigInteger k,
ECPoint Q, BigInteger l)
{
ECCurve curve = P.getCurve();
ECPoint infinity = curve.getInfinity();
// TODO conjugate co-Z addition (ZADDC) can return both of these
ECPoint PaddQ = P.add(Q);
ECPoint PsubQ = P.subtract(Q);
ECPoint[] points = new ECPoint[]{ Q, PsubQ, P, PaddQ };
curve.normalizeAll(points);
ECPoint[] table = new ECPoint[] {
points[3].negate(), points[2].negate(), points[1].negate(),
points[0].negate(), infinity, points[0],
points[1], points[2], points[3] };
byte[] jsf = WNafUtil.generateJSF(k, l);
ECPoint R = infinity;
int i = jsf.length;
while (--i >= 0)
{
int jsfi = jsf[i];
// NOTE: The shifting ensures the sign is extended correctly
int kDigit = ((jsfi << 24) >> 28), lDigit = ((jsfi << 28) >> 28);
int index = 4 + (kDigit * 3) + lDigit;
R = R.twicePlus(table[index]);
}
return R;
}
代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on
pow2Table[minWidth] = pow2Table[0].subtract(pow2Table[1]);
内容来源于网络,如有侵权,请联系作者删除!