Object

com.alexdupre.bitcoincash

Crypto

Related Doc: package bitcoincash

Permalink

object Crypto

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Crypto
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. case class Point(value: ECPoint) extends Product with Serializable

    Permalink

    Curve point

    Curve point

    value

    ecPoint to initialize this point with

  2. case class PointProxy(bin: BinaryData) extends Product with Serializable

    Permalink
  3. case class PrivateKey(value: Scalar, compressed: Boolean = true) extends Product with Serializable

    Permalink

    value

    value of this private key (a number)

    compressed

    flags which specifies if the associated public key will be compressed or uncompressed.

  4. case class PublicKey(raw: BinaryData, checkValid: Boolean = true) extends Product with Serializable

    Permalink

    raw

    serialized value of this public key (a point)

    checkValid

    indicates whether or not we check that this is a valid public key; this should be used carefully for optimization purposes

  5. case class Scalar(value: BigInteger) extends Product with Serializable

    Permalink

    A scalar is a 256 bit number

    A scalar is a 256 bit number

    value

    value to initialize this scalar with

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. object Point extends Serializable

    Permalink
  5. object PrivateKey extends Serializable

    Permalink
  6. object PublicKey extends Serializable

    Permalink
  7. object Scalar extends Serializable

    Permalink
  8. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  9. implicit def biginteger2scalar(value: BigInteger): Scalar

    Permalink
  10. implicit def bin2scalar(value: BinaryData): Scalar

    Permalink
  11. def checkDataSignatureEncoding(sig: Seq[Byte], flags: Int): Boolean

    Permalink
  12. def checkPubKeyEncoding(key: Seq[Byte], flags: Int): Boolean

    Permalink
  13. def checkRawECDSASignatureEncoding(sig: Seq[Byte], flags: Int): Boolean

    Permalink
  14. def checkRawSignatureEncoding(sig: Seq[Byte], flags: Int): Boolean

    Permalink
  15. def checkTransactionSignatureEncoding(sig: Seq[Byte], flags: Int, supportSchnorr: Boolean): Boolean

    Permalink
  16. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  17. val curve: ECDomainParameters

    Permalink
  18. def decodeSignature(blob: Seq[Byte]): (BigInteger, BigInteger)

    Permalink

    An ECDSA signature is a (r, s) pair.

    An ECDSA signature is a (r, s) pair. Bitcoin uses DER encoded signatures

    blob

    sigbyte data

    returns

    the decoded (r, s) signature

  19. def decodeSignatureLax(input: BinaryData): (BigInteger, BigInteger)

    Permalink
  20. def decodeSignatureLax(input: ByteArrayInputStream): (BigInteger, BigInteger)

    Permalink
  21. def ecdh(priv: Scalar, pub: Point): BinaryData

    Permalink

    Computes ecdh using secp256k1's variant: sha256(priv * pub serialized in compressed format)

    Computes ecdh using secp256k1's variant: sha256(priv * pub serialized in compressed format)

    priv

    private value

    pub

    public value

    returns

    ecdh(priv, pub) as computed by libsecp256k1

  22. implicit def ecpoint2point(value: ECPoint): Point

    Permalink
  23. def encodeSignature(t: (BigInteger, BigInteger)): BinaryData

    Permalink
  24. def encodeSignature(r: BigInteger, s: BigInteger): BinaryData

    Permalink

    An ECDSA signature is a (r, s) pair.

    An ECDSA signature is a (r, s) pair. Bitcoin uses DER encoded signatures

    r

    first value

    s

    second value

    returns

    (r, s) in DER format

  25. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  26. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  27. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  28. def fixSize(data: BinaryData): BinaryData

    Permalink
  29. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  30. def getHashType(sig: Seq[Byte]): Int

    Permalink
  31. val halfCurveOrder: BigInteger

    Permalink
  32. def hash(digest: Digest)(input: Seq[Byte]): BinaryData

    Permalink
  33. def hash160(input: Seq[Byte]): BinaryData

    Permalink

    160 bits bitcoin hash, used mostly for address encoding hash160(input) = RIPEMD160(SHA256(input))

    160 bits bitcoin hash, used mostly for address encoding hash160(input) = RIPEMD160(SHA256(input))

    input

    array of byte

    returns

    the 160 bits BTC hash of input

  34. def hash256(input: Seq[Byte]): BinaryData

    Permalink

    256 bits bitcoin hash hash256(input) = SHA256(SHA256(input))

    256 bits bitcoin hash hash256(input) = SHA256(SHA256(input))

    input

    array of byte

    returns

    the 256 bits BTC hash of input

  35. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  36. def hmac512(key: Seq[Byte], data: Seq[Byte]): BinaryData

    Permalink
  37. def isDefinedHashtypeSignature(sig: Seq[Byte]): Boolean

    Permalink
  38. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  39. def isLowDERSignature(sig: Seq[Byte]): Boolean

    Permalink
  40. def isPrivateKeyCompressed(key: PrivateKey): Boolean

    Permalink
  41. def isPubKeyCompressed(key: Seq[Byte]): Boolean

    Permalink
  42. def isPubKeyCompressedOrUncompressed(key: Seq[Byte]): Boolean

    Permalink
  43. def isPubKeyValid(key: Seq[Byte]): Boolean

    Permalink

    key

    serialized public key

    returns

    true if the key is valid. Please not that this performs very basic tests and does not check that the point represented by this key is actually valid.

  44. def isValidDERSignatureEncoding(sig: Seq[Byte]): Boolean

    Permalink
  45. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  46. def normalizeSignature(sig: BinaryData): BinaryData

    Permalink
  47. def normalizeSignature(r: BigInteger, s: BigInteger): (BigInteger, BigInteger)

    Permalink
  48. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  49. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  50. val one: BigInteger

    Permalink
  51. val params: X9ECParameters

    Permalink
  52. implicit def point2ecpoint(point: Point): ECPoint

    Permalink
  53. implicit def privatekey2scalar(priv: PrivateKey): Scalar

    Permalink
  54. def publicKeyFromPrivateKey(privateKey: BinaryData): PublicKey

    Permalink

    privateKey

    private key

    returns

    the corresponding public key

  55. implicit def publickey2bin(pub: PublicKey): BinaryData

    Permalink
  56. implicit def publickey2point(pub: PublicKey): Point

    Permalink
  57. def recoverPoint(x: BigInteger): (Point, Point)

    Permalink

    x

    x coordinate

    returns

    a tuple (p1, p2) where p1 and p2 are points on the curve and p1.x = p2.x = x p1.y is even, p2.y is odd

  58. def recoverPublicKey(sig: BinaryData, message: BinaryData): (PublicKey, PublicKey)

    Permalink
  59. def recoverPublicKey(t: (BigInteger, BigInteger), message: BinaryData): (PublicKey, PublicKey)

    Permalink

    Recover public keys from a signature and the message that was signed.

    Recover public keys from a signature and the message that was signed. This method will return 2 public keys, and the signature can be verified with both, but only one of them matches that private key that was used to generate the signature.

    t

    signature

    message

    message that was signed

    returns

    a (pub1, pub2) tuple where pub1 and pub2 are candidates public keys. If you have the recovery id then use pub1 if the recovery id is even and pub2 if it is odd

  60. def ripemd160: (Seq[Byte]) ⇒ BinaryData

    Permalink
  61. implicit def scalar2biginteger(scalar: Scalar): BigInteger

    Permalink
  62. implicit def scalar2bin(scalar: Scalar): BinaryData

    Permalink
  63. def sha1: (Seq[Byte]) ⇒ BinaryData

    Permalink
  64. def sha256: (Seq[Byte]) ⇒ BinaryData

    Permalink
  65. def sign(data: BinaryData, privateKey: PrivateKey): (BigInteger, BigInteger)

    Permalink

    Sign data with a private key, using RCF6979 deterministic signatures

    Sign data with a private key, using RCF6979 deterministic signatures

    data

    data to sign

    privateKey

    private key. If you are using bitcoin "compressed" private keys make sure to only use the first 32 bytes of the key (there is an extra "1" appended to the key)

    returns

    a (r, s) ECDSA signature pair

  66. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  67. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  68. def verifyECDSA(data: BinaryData, signature: BinaryData, publicKey: PublicKey): Boolean

    Permalink
  69. def verifySchnorr(data: BinaryData, signature: BinaryData, publicKey: PublicKey): Boolean

    Permalink
  70. def verifySignature(data: BinaryData, signature: BinaryData, publicKey: PublicKey, flags: Int): Boolean

    Permalink

    data

    data

    signature

    signature

    publicKey

    public key

    returns

    true is signature is valid for this data with this public key

  71. def verifySignature(data: Seq[Byte], signature: (BigInteger, BigInteger), publicKey: PublicKey, flags: Int): Boolean

    Permalink
  72. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  73. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  74. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  75. val zero: BigInteger

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped