Class SecpXOnlyPubKeyImpl

java.lang.Object
org.bitcoinj.secp.internal.SecpXOnlyPubKeyImpl
All Implemented Interfaces:
Comparable<ByteArray>, ByteArray, SecpXOnlyPubKey

public class SecpXOnlyPubKeyImpl extends Object implements SecpXOnlyPubKey, ByteArray
Simple implementation using {code @byte[]} as internal storage.
  • Constructor Details

  • Method Details

    • ofVerifiedBytes

      public static SecpXOnlyPubKeyImpl ofVerifiedBytes(byte[] bytes)
    • xOnlyToSerializedCompressed

      public static byte[] xOnlyToSerializedCompressed(byte[] xOnly)
      Convert to SECG Compressed serialization (i.e. an even value, prefixed with a 0x02 byte).
      Parameters:
      xOnly - 32-byte x-only public key
      Returns:
      SECG Compressed (even) value (33-bytes)
    • getX

      public BigInteger getX()
      Description copied from interface: SecpXOnlyPubKey
      Get X as a BigInteger
      Specified by:
      getX in interface SecpXOnlyPubKey
      Returns:
      X as a BigInteger
    • bytes

      public byte[] bytes()
      Description copied from interface: ByteArray
      Get the bytes as an array
      Specified by:
      bytes in interface ByteArray
      Returns:
      the bytes as an array
    • serialize

      public byte[] serialize()
      Description copied from interface: SecpXOnlyPubKey
      Serialize as a 32-byte, Big-endian byte array (no prefix byte)
      Specified by:
      serialize in interface SecpXOnlyPubKey
      Returns:
      Big-endian, 32 bytes
    • serializeCompressed

      public byte[] serializeCompressed()
      Description copied from interface: SecpXOnlyPubKey
      Serialize as SECG Compressed (i.e. an even value, prefixed with a 0x02 byte).
      Specified by:
      serializeCompressed in interface SecpXOnlyPubKey
      Returns:
      SECG Compressed (even) value
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      A hex string representing the default binary serialization format