trait CryptoUtil extends CryptoRuntime
Utility cryptographic functions This is a proxy for the underlying implementation of CryptoRuntime such as LibSecp256k1CryptoRuntime.
This is necessary so that the core module doesn't need to be refactored to add support for multiple platforms, it can keep referencing CryptoUtil
- Alphabetic
- By Inheritance
- CryptoUtil
- CryptoRuntime
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def adaptorComplete(key: ECPrivateKey, adaptorSignature: ECAdaptorSignature): ECDigitalSignature
- Definition Classes
- CryptoUtil → CryptoRuntime
- def adaptorSign(key: ECPrivateKey, adaptorPoint: ECPublicKey, msg: ByteVector, auxRand: ByteVector): ECAdaptorSignature
- Definition Classes
- CryptoUtil → CryptoRuntime
- def adaptorVerify(adaptorSignature: ECAdaptorSignature, key: ECPublicKey, msg: ByteVector, adaptorPoint: ECPublicKey): Boolean
- Definition Classes
- CryptoUtil → CryptoRuntime
- def add(pk1: ECPublicKey, pk2: ECPublicKey): ECPublicKey
Adds two public keys together, failing if the sum is 0x00 (the point at infinity).
Adds two public keys together, failing if the sum is 0x00 (the point at infinity).
- Definition Classes
- CryptoUtil → CryptoRuntime
- def add(point1: SecpPoint, point2: SecpPoint): SecpPoint
Adds two SecpPoints together and correctly handles the point at infinity (0x00).
Adds two SecpPoints together and correctly handles the point at infinity (0x00).
- Definition Classes
- CryptoUtil → CryptoRuntime
- def add(pk1: ByteVector, pk2: ECPrivateKey): ByteVector
- Definition Classes
- CryptoUtil → CryptoRuntime
- def add(pk1: ECPrivateKey, pk2: ECPrivateKey): ECPrivateKey
- Definition Classes
- CryptoUtil → CryptoRuntime
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def checkEntropy(bytes: ByteVector): Boolean
- Definition Classes
- CryptoRuntime
- def checkEntropy(bitVector: BitVector): Boolean
Implements basic sanity tests for checking entropy like making sure it isn't all the same bytes, it isn't all 0x00...00 or it isn't all 0xffff...fff
Implements basic sanity tests for checking entropy like making sure it isn't all the same bytes, it isn't all 0x00...00 or it isn't all 0xffff...fff
- Definition Classes
- CryptoRuntime
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def combinePubKeys(pubKeys: Vector[ECPublicKey], isCompressed: Boolean = true): ECPublicKey
Adds a Vector of public keys together, failing only if the total sum is 0x00 (the point at infinity), but still succeeding if sub-sums are 0x00.
Adds a Vector of public keys together, failing only if the total sum is 0x00 (the point at infinity), but still succeeding if sub-sums are 0x00.
- Definition Classes
- CryptoUtil → CryptoRuntime
- lazy val cryptoContext: CryptoContext
- Definition Classes
- CryptoUtil → CryptoRuntime
- def decodePoint(bytes: ByteVector): SecpPoint
- Definition Classes
- CryptoUtil → CryptoRuntime
- def decodePoint(pubKey: ECPublicKey): SecpPoint
- Definition Classes
- CryptoRuntime
- def decodeSignature(signature: ECDigitalSignature): (BigInt, BigInt)
- Definition Classes
- CryptoUtil → CryptoRuntime
- def decompressed[PK <: ECPublicKeyApi](publicKey: PK): decompressed.publicKey.type
- Definition Classes
- CryptoUtil → CryptoRuntime
- def decompressed(pubKeyBytes: ByteVector): ByteVector
- Definition Classes
- CryptoUtil → CryptoRuntime
- def decompressed[PK <: ECPublicKeyApi](pubKeyBytes: ByteVector, fromBytes: (ByteVector) => PK): PK
- Definition Classes
- CryptoRuntime
- def doubleSHA256(str: String): DoubleSha256Digest
- def doubleSHA256(bytes: ByteVector): DoubleSha256Digest
Performs sha256(sha256(bytes)).
Performs sha256(sha256(bytes)).
- Definition Classes
- CryptoRuntime
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def extractAdaptorSecret(signature: ECDigitalSignature, adaptorSignature: ECAdaptorSignature, key: ECPublicKey): ECPrivateKey
- Definition Classes
- CryptoUtil → CryptoRuntime
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def freshPrivateKey: ECPrivateKey
Generates a 32 byte private key
Generates a 32 byte private key
- Definition Classes
- CryptoUtil → CryptoRuntime
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hmac256(key: ByteVector, data: ByteVector): ByteVector
- Definition Classes
- CryptoUtil → CryptoRuntime
- def hmac512(key: ByteVector, data: ByteVector): ByteVector
Calculates
HMAC-SHA512(key, data)
Calculates
HMAC-SHA512(key, data)
- Definition Classes
- CryptoUtil → CryptoRuntime
- def isDEREncoded(signature: ECDigitalSignature): Boolean
- Definition Classes
- CryptoUtil → CryptoRuntime
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isValidPubKey(pubKey: ECPublicKeyApi): Boolean
- Definition Classes
- CryptoUtil → CryptoRuntime
- def isValidSignatureEncoding(signature: ECDigitalSignature): Boolean
- Definition Classes
- CryptoUtil → CryptoRuntime
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def normalize(str: String): String
- Definition Classes
- CryptoUtil → CryptoRuntime
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def pbkdf2WithSha512(pass: ByteVector, salt: ByteVector, iterationCount: Int, derivedKeyLength: Int): ByteVector
- Definition Classes
- CryptoUtil → CryptoRuntime
- def pbkdf2WithSha512(pass: String, salt: String, iterationCount: Int, derivedKeyLength: Int): ByteVector
- Definition Classes
- CryptoRuntime
- def pubKeyTweakAdd(pubkey: ECPublicKey, privkey: ECPrivateKey): ECPublicKey
- Definition Classes
- CryptoUtil → CryptoRuntime
- def publicKey(privateKey: ECPrivateKeyBytes): ECPublicKey
- Definition Classes
- CryptoUtil → CryptoRuntime
- def randomBytes(n: Int): ByteVector
- Definition Classes
- CryptoUtil → CryptoRuntime
- def recoverPublicKey(signature: ECDigitalSignature, message: ByteVector): (ECPublicKey, ECPublicKey)
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.
- signature
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
- Definition Classes
- CryptoUtil → CryptoRuntime
- def ripeMd160(str: String): RipeMd160Digest
- def ripeMd160(bytes: ByteVector): RipeMd160Digest
Performs RIPEMD160(bytes).
Performs RIPEMD160(bytes).
- Definition Classes
- CryptoUtil → CryptoRuntime
- def schnorrComputeSigPoint(data: ByteVector, nonce: SchnorrNonce, pubKey: SchnorrPublicKey, compressed: Boolean): ECPublicKey
- Definition Classes
- CryptoUtil → CryptoRuntime
- def schnorrSign(dataToSign: ByteVector, privateKey: ECPrivateKey, auxRand: ByteVector): SchnorrDigitalSignature
- Definition Classes
- CryptoUtil → CryptoRuntime
- def schnorrSignWithNonce(dataToSign: ByteVector, privateKey: ECPrivateKey, nonceKey: ECPrivateKey): SchnorrDigitalSignature
- Definition Classes
- CryptoUtil → CryptoRuntime
- def schnorrVerify(data: ByteVector, schnorrPubKey: SchnorrPublicKey, signature: SchnorrDigitalSignature): Boolean
- Definition Classes
- CryptoUtil → CryptoRuntime
- def secKeyVerify(privateKeybytes: ByteVector): Boolean
- Definition Classes
- CryptoUtil → CryptoRuntime
- def serializeForHash(str: String): ByteVector
- Definition Classes
- CryptoRuntime
- def sha1(str: String): Sha1Digest
- def sha1(bytes: ByteVector): Sha1Digest
Performs SHA1(bytes).
Performs SHA1(bytes).
- Definition Classes
- CryptoUtil → CryptoRuntime
- def sha256(bytes: ByteVector): Sha256Digest
Takes sha256(bytes).
Takes sha256(bytes).
- Definition Classes
- CryptoUtil → CryptoRuntime
- def sha256(bitVector: BitVector): Sha256Digest
- Definition Classes
- CryptoRuntime
- def sha256(str: String): Sha256Digest
- Definition Classes
- CryptoRuntime
- def sha256DLCAnnouncement(bytes: ByteVector): Sha256Digest
- Definition Classes
- CryptoRuntime
- def sha256DLCAttestation(str: String): Sha256Digest
- Definition Classes
- CryptoRuntime
- def sha256DLCAttestation(bytes: ByteVector): Sha256Digest
- Definition Classes
- CryptoRuntime
- def sha256DLEQ(bytes: ByteVector): Sha256Digest
- Definition Classes
- CryptoRuntime
- def sha256ECDSAAdaptorAux(bytes: ByteVector): Sha256Digest
- Definition Classes
- CryptoRuntime
- def sha256ECDSAAdaptorNonce(bytes: ByteVector): Sha256Digest
- Definition Classes
- CryptoRuntime
- def sha256Hash160(str: String): Sha256Hash160Digest
- def sha256Hash160(bytes: ByteVector): Sha256Hash160Digest
Does the following computation: RIPEMD160(SHA256(hex)).
Does the following computation: RIPEMD160(SHA256(hex)).
- Definition Classes
- CryptoUtil → CryptoRuntime
- def sha256SchnorrAuxRand(bytes: ByteVector): Sha256Digest
- Definition Classes
- CryptoRuntime
- def sha256SchnorrChallenge(bytes: ByteVector): Sha256Digest
- Definition Classes
- CryptoRuntime
- def sha256SchnorrNonce(bytes: ByteVector): Sha256Digest
- Definition Classes
- CryptoRuntime
- def sha3_256(bytes: ByteVector): Sha3_256Digest
Performs SHA3-256(bytes)
Performs SHA3-256(bytes)
- Definition Classes
- CryptoUtil → CryptoRuntime
- def sign(privateKey: ECPrivateKey, dataToSign: ByteVector): ECDigitalSignature
- Definition Classes
- CryptoUtil → CryptoRuntime
- def signWithEntropy(privateKey: ECPrivateKey, bytes: ByteVector, entropy: ByteVector): ECDigitalSignature
- Definition Classes
- CryptoUtil → CryptoRuntime
- def sipHash(item: ByteVector, key: SipHashKey): Long
https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki#hashing-data-objects
https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki#hashing-data-objects
- Definition Classes
- CryptoUtil → CryptoRuntime
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def taggedSha256(str: String, tag: String): Sha256Digest
- def taggedSha256(bytes: ByteVector, tag: String): Sha256Digest
- Definition Classes
- CryptoRuntime
- def tapBranchHash(bytes: ByteVector): Sha256Digest
- Definition Classes
- CryptoRuntime
- def tapLeafHash(bytes: ByteVector): Sha256Digest
- Definition Classes
- CryptoRuntime
- def tapTweakHash(bytes: ByteVector): Sha256Digest
- Definition Classes
- CryptoRuntime
- def toPublicKey(privateKey: ECPrivateKeyBytes): ECPublicKey
Converts a private key -> public key
Converts a private key -> public key
- privateKey
the private key we want the corresponding public key for
- Definition Classes
- CryptoUtil → CryptoRuntime
- def toString(): String
- Definition Classes
- AnyRef → Any
- def tweakMultiply(publicKey: ECPublicKey, tweak: FieldElement): ECPublicKey
- Definition Classes
- CryptoUtil → CryptoRuntime
- def tweakMultiply(point: SecpPoint, tweak: FieldElement): SecpPoint
- Definition Classes
- CryptoRuntime
- def verify(publicKey: ECPublicKeyApi, data: ByteVector, signature: ECDigitalSignature): Boolean
- Definition Classes
- CryptoUtil → CryptoRuntime
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()