当前位置: 首页>>代码示例>>Java>>正文


Java ECFieldElement类代码示例

本文整理汇总了Java中org.spongycastle.math.ec.ECFieldElement的典型用法代码示例。如果您正苦于以下问题:Java ECFieldElement类的具体用法?Java ECFieldElement怎么用?Java ECFieldElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ECFieldElement类属于org.spongycastle.math.ec包,在下文中一共展示了ECFieldElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: byteArrayToECPoint

import org.spongycastle.math.ec.ECFieldElement; //导入依赖的package包/类
private static ECPoint byteArrayToECPoint(final byte[] value, final ECCurve.Fp curve)
		throws IllegalArgumentException {
	final byte[] x = new byte[(value.length - 1) / 2];
	final byte[] y = new byte[(value.length - 1) / 2];
	if (value[0] != (byte) 0x04) {
		throw new IllegalArgumentException("No uncompressed Point found!"); //$NON-NLS-1$
	}
	System.arraycopy(value, 1, x, 0, (value.length - 1) / 2);
	System.arraycopy(value, 1 + (value.length - 1) / 2, y, 0,
			(value.length - 1) / 2);
	final ECFieldElement.Fp xE = (org.spongycastle.math.ec.ECFieldElement.Fp) curve.fromBigInteger(new BigInteger(1, x));
	final ECFieldElement.Fp yE = (org.spongycastle.math.ec.ECFieldElement.Fp) curve.fromBigInteger(new BigInteger(1, y));

	final ECPoint point = curve.createPoint(xE.toBigInteger(), yE.toBigInteger());
	return point;
}
 
开发者ID:MiFirma,项目名称:mi-firma-android,代码行数:17,代码来源:PaceChannelHelper.java

示例2: decompressKey

import org.spongycastle.math.ec.ECFieldElement; //导入依赖的package包/类
/** Decompress a compressed public key (x co-ord and low-bit of y-coord). */
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
    // This code is adapted from Bouncy Castle ECCurve.Fp.decodePoint(), but it wasn't easily re-used.
    ECCurve.Fp curve = (ECCurve.Fp) ecParams.getCurve();
    ECFieldElement x = new ECFieldElement.Fp(curve.getQ(), xBN);
    ECFieldElement alpha = x.multiply(x.square().add(curve.getA())).add(curve.getB());
    ECFieldElement beta = alpha.sqrt();
    // If we can't find a sqrt we haven't got a point on the curve - invalid inputs.
    if (beta == null)
        throw new IllegalArgumentException("Invalid point compression");
    if (beta.toBigInteger().testBit(0) == yBit) {
        return new ECPoint.Fp(curve, x, beta, true);
    } else {
        ECFieldElement.Fp y = new ECFieldElement.Fp(curve.getQ(), curve.getQ().subtract(beta.toBigInteger()));
        return new ECPoint.Fp(curve, x, y, true);
    }
}
 
开发者ID:appteam-nith,项目名称:NithPointsj,代码行数:18,代码来源:ECKey.java

示例3: decompressKey

import org.spongycastle.math.ec.ECFieldElement; //导入依赖的package包/类
/** Decompress a compressed public key (x co-ord and low-bit of y-coord). */
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
    // This code is adapted from Bouncy Castle ECCurve.Fp.decodePoint(), but it wasn't easily re-used.
    ECCurve.Fp curve = (ECCurve.Fp) CURVE.getCurve();
    ECFieldElement x = new ECFieldElement.Fp(curve.getQ(), xBN);
    ECFieldElement alpha = x.multiply(x.square().add(curve.getA())).add(curve.getB());
    ECFieldElement beta = alpha.sqrt();
    // If we can't find a sqrt we haven't got a point on the curve - invalid inputs.
    if (beta == null)
        throw new IllegalArgumentException("Invalid point compression");
    if (beta.toBigInteger().testBit(0) == yBit) {
        return new ECPoint.Fp(curve, x, beta, true);
    } else {
        ECFieldElement.Fp y = new ECFieldElement.Fp(curve.getQ(), curve.getQ().subtract(beta.toBigInteger()));
        return new ECPoint.Fp(curve, x, y, true);
    }
}
 
开发者ID:sserrano44,项目名称:bitcoinj-watcher-service,代码行数:18,代码来源:ECKey.java

示例4: decompressKey

import org.spongycastle.math.ec.ECFieldElement; //导入依赖的package包/类
/**
 * Decompress a compressed public key (x co-ord and low-bit of y-coord).
 */
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
    // This code is adapted from Bouncy Castle ECCurve.Fp.decodePoint(), but it wasn't easily re-used.
    ECCurve.Fp curve = (ECCurve.Fp) ecParams.getCurve();
    ECFieldElement x = new ECFieldElement.Fp(curve.getQ(), xBN);
    ECFieldElement alpha = x.multiply(x.square().add(curve.getA())).add(curve.getB());
    ECFieldElement beta = alpha.sqrt();
    // If we can't find a sqrt we haven't got a point on the curve - invalid inputs.
    if (beta == null)
        throw new IllegalArgumentException("Invalid point compression");
    if (beta.toBigInteger().testBit(0) == yBit) {
        return new ECPoint.Fp(curve, x, beta, true);
    } else {
        ECFieldElement.Fp y = new ECFieldElement.Fp(curve.getQ(), curve.getQ().subtract(beta.toBigInteger()));
        return new ECPoint.Fp(curve, x, y, true);
    }
}
 
开发者ID:goldcoin,项目名称:goldcoin-android,代码行数:20,代码来源:ECKey.java

示例5: computeAffineY

import org.spongycastle.math.ec.ECFieldElement; //导入依赖的package包/类
private static BigInteger computeAffineY(final BigInteger affineX, final ECParameterSpec params) {
	final ECCurve bcCurve = toBouncyCastleECCurve(params);
	final ECFieldElement a = bcCurve.getA();
	final ECFieldElement b = bcCurve.getB();
	final ECFieldElement x = bcCurve.fromBigInteger(affineX);
	final ECFieldElement y = x.multiply(x).add(a).multiply(x).add(b).sqrt();
	return y.toBigInteger();
}
 
开发者ID:MiFirma,项目名称:mi-firma-android,代码行数:9,代码来源:JseCryptoHelper.java

示例6: computeAffineY

import org.spongycastle.math.ec.ECFieldElement; //导入依赖的package包/类
private static BigInteger computeAffineY(final BigInteger affineX, final ECParameterSpec params) {
	final ECCurve bcCurve = toSpongyCastleECCurve(params);
	final ECFieldElement a = bcCurve.getA();
	final ECFieldElement b = bcCurve.getB();
	final ECFieldElement x = bcCurve.fromBigInteger(affineX);
	final ECFieldElement y = x.multiply(x).add(a).multiply(x).add(b).sqrt();
	return y.toBigInteger();
}
 
开发者ID:MiFirma,项目名称:mi-firma-android,代码行数:9,代码来源:JseCryptoHelper.java

示例7: getYCoord

import org.spongycastle.math.ec.ECFieldElement; //导入依赖的package包/类
public ECFieldElement getYCoord() {
    return get().getYCoord();
}
 
开发者ID:creativechain,项目名称:creacoinj,代码行数:4,代码来源:LazyECPoint.java

示例8: getZCoords

import org.spongycastle.math.ec.ECFieldElement; //导入依赖的package包/类
public ECFieldElement[] getZCoords() {
    return get().getZCoords();
}
 
开发者ID:creativechain,项目名称:creacoinj,代码行数:4,代码来源:LazyECPoint.java

示例9: scaleY

import org.spongycastle.math.ec.ECFieldElement; //导入依赖的package包/类
public ECPoint scaleY(ECFieldElement scale) {
    return get().scaleY(scale);
}
 
开发者ID:creativechain,项目名称:creacoinj,代码行数:4,代码来源:LazyECPoint.java

示例10: getXCoord

import org.spongycastle.math.ec.ECFieldElement; //导入依赖的package包/类
public ECFieldElement getXCoord() {
    return get().getXCoord();
}
 
开发者ID:creativechain,项目名称:creacoinj,代码行数:4,代码来源:LazyECPoint.java

示例11: scaleX

import org.spongycastle.math.ec.ECFieldElement; //导入依赖的package包/类
public ECPoint scaleX(ECFieldElement scale) {
    return get().scaleX(scale);
}
 
开发者ID:creativechain,项目名称:creacoinj,代码行数:4,代码来源:LazyECPoint.java

示例12: getZCoord

import org.spongycastle.math.ec.ECFieldElement; //导入依赖的package包/类
public ECFieldElement getZCoord(int index) {
    return get().getZCoord(index);
}
 
开发者ID:creativechain,项目名称:creacoinj,代码行数:4,代码来源:LazyECPoint.java

示例13: getY

import org.spongycastle.math.ec.ECFieldElement; //导入依赖的package包/类
public ECFieldElement getY() {
    return this.normalize().getYCoord();
}
 
开发者ID:creativechain,项目名称:creacoinj,代码行数:4,代码来源:LazyECPoint.java

示例14: getAffineYCoord

import org.spongycastle.math.ec.ECFieldElement; //导入依赖的package包/类
public ECFieldElement getAffineYCoord() {
    return get().getAffineYCoord();
}
 
开发者ID:creativechain,项目名称:creacoinj,代码行数:4,代码来源:LazyECPoint.java

示例15: getAffineXCoord

import org.spongycastle.math.ec.ECFieldElement; //导入依赖的package包/类
public ECFieldElement getAffineXCoord() {
    return get().getAffineXCoord();
}
 
开发者ID:creativechain,项目名称:creacoinj,代码行数:4,代码来源:LazyECPoint.java


注:本文中的org.spongycastle.math.ec.ECFieldElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。