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(value: Point, compressed: Boolean = true) extends Product with Serializable

    Permalink

    value

    value of this public key (a point)

    compressed

    flags which specifies if the public key is compressed or uncompressed. Compressed public keys are encoded on 33 bytes (first byte = sign of Y, then X on 32 bytes)

  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 checkPubKeyEncoding(key: Seq[Byte], flags: Int): Boolean

    Permalink
  12. def checkSignatureEncoding(sig: Seq[Byte], flags: Int): Boolean

    Permalink
  13. def clone(): AnyRef

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

    Permalink
  15. 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

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

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

    Permalink
  18. 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

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

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

    Permalink
  21. 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

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

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

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

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

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

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

    Permalink
  28. val halfCurveOrder: BigInteger

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

    Permalink
  30. 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

  31. 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

  32. def hashCode(): Int

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

    Permalink
  34. def isDERSignature(sig: Seq[Byte]): Boolean

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

    Permalink
  36. final def isInstanceOf[T0]: Boolean

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

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

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

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

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

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

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

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

    Permalink
  45. final def notify(): Unit

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

    Permalink
    Definition Classes
    AnyRef
  47. val one: BigInteger

    Permalink
  48. val params: X9ECParameters

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

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

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

    Permalink

    privateKey

    private key

    returns

    the corresponding public key

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

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

    Permalink
  54. 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

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

    Permalink
  56. 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

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

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

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

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

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

    Permalink
  62. 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

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

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

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

    Permalink

    data

    data

    signature

    signature

    publicKey

    public key

    returns

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

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

    Permalink
  67. final def wait(): Unit

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

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

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

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped