org.spongycastle.asn1.x9.X9IntegerConverter.integerToBytes()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(90)

本文整理了Java中org.spongycastle.asn1.x9.X9IntegerConverter.integerToBytes()方法的一些代码示例,展示了X9IntegerConverter.integerToBytes()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。X9IntegerConverter.integerToBytes()方法的具体详情如下:
包路径:org.spongycastle.asn1.x9.X9IntegerConverter
类名称:X9IntegerConverter
方法名:integerToBytes

X9IntegerConverter.integerToBytes介绍

[英]Convert an integer to a byte array, ensuring it is exactly qLength long.
[中]将整数转换为字节数组,确保其长度正好为qLength。

代码示例

代码示例来源:origin: ethereum/ethereumj

/**
 * Decompress a compressed public key (x co-ord and low-bit of y-coord).
 *
 * @param xBN -
 * @param yBit -
 * @return -
 */
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
  X9IntegerConverter x9 = new X9IntegerConverter();
  byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(CURVE.getCurve()));
  compEnc[0] = (byte) (yBit ? 0x03 : 0x02);
  return CURVE.getCurve().decodePoint(compEnc);
}

代码示例来源:origin: com.madgag.spongycastle/prov

protected byte[] bigIntToBytes(
  BigInteger    r)
{
  return converter.integerToBytes(r, converter.getByteLength(parameters.getCurve()));
}

代码示例来源:origin: com.madgag/scprov-jdk15on

private byte[] bigIntToBytes(
  BigInteger    r)
{
  return converter.integerToBytes(r, converter.getByteLength(parameters.getG().getX()));
}

代码示例来源:origin: com.madgag/sc-light-jdk15on

/**
   * Produce an object suitable for an ASN1OutputStream.
   * <pre>
   *  FieldElement ::= OCTET STRING
   * </pre>
   * <p>
   * <ol>
   * <li> if <i>q</i> is an odd prime then the field element is
   * processed as an Integer and converted to an octet string
   * according to x 9.62 4.3.1.</li>
   * <li> if <i>q</i> is 2<sup>m</sup> then the bit string
   * contained in the field element is converted into an octet
   * string with the same ordering padded at the front if necessary.
   * </li>
   * </ol>
   */
  public ASN1Primitive toASN1Primitive()
  {
    int byteCount = converter.getByteLength(f);
    byte[] paddedBigInteger = converter.integerToBytes(f.toBigInteger(), byteCount);

    return new DEROctetString(paddedBigInteger);
  }
}

代码示例来源:origin: com.madgag.spongycastle/core

/**
   * Produce an object suitable for an ASN1OutputStream.
   * <pre>
   *  FieldElement ::= OCTET STRING
   * </pre>
   * <p>
   * <ol>
   * <li> if <i>q</i> is an odd prime then the field element is
   * processed as an Integer and converted to an octet string
   * according to x 9.62 4.3.1.</li>
   * <li> if <i>q</i> is 2<sup>m</sup> then the bit string
   * contained in the field element is converted into an octet
   * string with the same ordering padded at the front if necessary.
   * </li>
   * </ol>
   */
  public ASN1Primitive toASN1Primitive()
  {
    int byteCount = converter.getByteLength(f);
    byte[] paddedBigInteger = converter.integerToBytes(f.toBigInteger(), byteCount);

    return new DEROctetString(paddedBigInteger);
  }
}

代码示例来源:origin: fr.acinq/bitcoinj-core

/** Decompress a compressed public key (x co-ord and low-bit of y-coord). */
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
  X9IntegerConverter x9 = new X9IntegerConverter();
  byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(CURVE.getCurve()));
  compEnc[0] = (byte)(yBit ? 0x03 : 0x02);
  return CURVE.getCurve().decodePoint(compEnc);
}

代码示例来源:origin: com.google/bitcoinj

/** Decompress a compressed public key (x co-ord and low-bit of y-coord). */
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
  X9IntegerConverter x9 = new X9IntegerConverter();
  byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(CURVE.getCurve()));
  compEnc[0] = (byte)(yBit ? 0x03 : 0x02);
  return CURVE.getCurve().decodePoint(compEnc);
}

代码示例来源:origin: com.madgag/sc-light-jdk15on

byte[]  X = converter.integerToBytes(this.getX().toBigInteger(), qLength);
byte[]  PO = new byte[X.length + 1];
byte[]  X = converter.integerToBytes(this.getX().toBigInteger(), qLength);
byte[]  Y = converter.integerToBytes(this.getY().toBigInteger(), qLength);
byte[]  PO = new byte[X.length + Y.length + 1];

代码示例来源:origin: HashEngineering/dashj

/** Decompress a compressed public key (x co-ord and low-bit of y-coord). */
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
  X9IntegerConverter x9 = new X9IntegerConverter();
  byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(CURVE.getCurve()));
  compEnc[0] = (byte)(yBit ? 0x03 : 0x02);
  return CURVE.getCurve().decodePoint(compEnc);
}

代码示例来源:origin: greenaddress/GreenBits

/** Decompress a compressed public key (x co-ord and low-bit of y-coord). */
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
  X9IntegerConverter x9 = new X9IntegerConverter();
  byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(CURVE.getCurve()));
  compEnc[0] = (byte)(yBit ? 0x03 : 0x02);
  return CURVE.getCurve().decodePoint(compEnc);
}

代码示例来源:origin: cash.bitcoinj/bitcoinj-core

/** Decompress a compressed public key (x co-ord and low-bit of y-coord). */
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
  X9IntegerConverter x9 = new X9IntegerConverter();
  byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(CURVE.getCurve()));
  compEnc[0] = (byte)(yBit ? 0x03 : 0x02);
  return CURVE.getCurve().decodePoint(compEnc);
}

代码示例来源:origin: QuincySx/BlockchainWallet-Crypto

private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
  X9IntegerConverter x9 = new X9IntegerConverter();
  byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(CURVE.getCurve()));
  compEnc[0] = (byte) (yBit ? 0x03 : 0x02);
  return CURVE.getCurve().decodePoint(compEnc);
}

代码示例来源:origin: yggdrash/yggdrash

/**
 * Decompress a compressed public key (x co-ord and low-bit of y-coord).
 *
 * @param xBN  -
 * @param yBit -
 * @return -
 */
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
  X9IntegerConverter x9 = new X9IntegerConverter();
  byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(CURVE.getCurve()));
  compEnc[0] = (byte) (yBit ? 0x03 : 0x02);
  return CURVE.getCurve().decodePoint(compEnc);
}

代码示例来源:origin: UlordChain/ulordj-thin

/** Decompress a compressed public key (x co-ord and low-bit of y-coord). */
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
  X9IntegerConverter x9 = new X9IntegerConverter();
  byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(CURVE.getCurve()));
  compEnc[0] = (byte)(yBit ? 0x03 : 0x02);
  return CURVE.getCurve().decodePoint(compEnc);
}

代码示例来源:origin: nebulasio/neb.java

/**
 * Decompress a compressed public key (x co-ord and low-bit of y-coord).
 *
 * @param xBN -
 * @param yBit -
 * @return -
 */
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
  X9IntegerConverter x9 = new X9IntegerConverter();
  byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(CURVE.getCurve()));
  compEnc[0] = (byte) (yBit ? 0x03 : 0x02);
  return CURVE.getCurve().decodePoint(compEnc);
}

代码示例来源:origin: CoinbaseWallet/toshi-headless-client

/**
 * Decompress a compressed public key (x co-ord and low-bit of y-coord).
 *
 * @param xBN -
 * @param yBit -
 * @return -
 */
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
  X9IntegerConverter x9 = new X9IntegerConverter();
  byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(CURVE.getCurve()));
  compEnc[0] = (byte) (yBit ? 0x03 : 0x02);
  return CURVE.getCurve().decodePoint(compEnc);
}

代码示例来源:origin: tronprotocol/wallet-cli

/**
 * Decompress a compressed public key (x co-ord and low-bit of y-coord).
 *
 * @param xBN -
 * @param yBit -
 * @return -
 */
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
 X9IntegerConverter x9 = new X9IntegerConverter();
 byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(CURVE
   .getCurve()));
 compEnc[0] = (byte) (yBit ? 0x03 : 0x02);
 return CURVE.getCurve().decodePoint(compEnc);
}

代码示例来源:origin: biheBlockChain/wkcwallet-java

/**
 * Decompress a compressed public key (x co-ord and low-bit of y-coord).
 *
 * @param xBN
 *            -
 * @param yBit
 *            -
 * @return -
 */
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
  X9IntegerConverter x9 = new X9IntegerConverter();
  byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(CURVE.getCurve()));
  compEnc[0] = (byte) (yBit ? 0x03 : 0x02);
  return CURVE.getCurve().decodePoint(compEnc);
}

代码示例来源:origin: AppStoreFoundation/asf-sdk

/**
 * Decompress a compressed public key (x co-ord and low-bit of y-coord).
 *
 * @param xBN -
 * @param yBit -
 *
 * @return -
 */
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
 X9IntegerConverter x9 = new X9IntegerConverter();
 byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(CURVE.getCurve()));
 compEnc[0] = (byte) (yBit ? 0x03 : 0x02);
 return CURVE.getCurve()
   .decodePoint(compEnc);
}

代码示例来源:origin: com.madgag/sc-light-jdk15on

byte[] X = converter.integerToBytes(this.getX().toBigInteger(), byteCount);
byte[] PO;
  byte[] Y = converter.integerToBytes(this.getY().toBigInteger(), byteCount);

相关文章

微信公众号

最新文章

更多