⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fpnafmultiplier.java

📁 kmlnjlkj nlkjlkjkljl okopokipoipo oipipipo i
💻 JAVA
字号:
package org.bouncycastle.math.ec;import java.math.BigInteger;/** * Class implementing the NAF (Non-Adjacent Form) multiplication algorithm. */class FpNafMultiplier implements ECMultiplier{    /**     * D.3.2 pg 101     * @see org.bouncycastle.math.ec.ECMultiplier#multiply(org.bouncycastle.math.ec.ECPoint, java.math.BigInteger)     */    public ECPoint multiply(ECPoint p, BigInteger k, PreCompInfo preCompInfo)    {        // TODO Probably should try to add this        // BigInteger e = k.mod(n); // n == order of p        BigInteger e = k;        BigInteger h = e.multiply(BigInteger.valueOf(3));        ECPoint neg = p.negate();        ECPoint R = p;        for (int i = h.bitLength() - 2; i > 0; --i)        {                         R = R.twice();            boolean hBit = h.testBit(i);            boolean eBit = e.testBit(i);            if (hBit != eBit)            {                R = R.add(hBit ? p : neg);            }        }        return R;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -