Crypto
- Source:
- Crypto.scala
Type members
Classlikes
Secp256k1 private key, which a 32 bytes value We assume that private keys are compressed i.e. that the corresponding public key is compressed
Secp256k1 private key, which a 32 bytes value We assume that private keys are compressed i.e. that the corresponding public key is compressed
- Value parameters:
- value
value to initialize this key with
- Companion:
- object
- Source:
- Crypto.scala
Secp256k1 Public key We assume that public keys are always compressed
Secp256k1 Public key We assume that public keys are always compressed
- Value parameters:
- value
serialized public key, in compressed format (33 bytes)
- Companion:
- object
- Source:
- Crypto.scala
Value members
Concrete methods
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))
- Value parameters:
- input
array of byte
- Returns:
the 160 bits BTC hash of input
- Source:
- Crypto.scala
256 bits bitcoin hash hash256(input) = SHA256(SHA256(input))
256 bits bitcoin hash hash256(input) = SHA256(SHA256(input))
- Value parameters:
- input
array of byte
- Returns:
the 256 bits BTC hash of input
- Source:
- Crypto.scala
- Value parameters:
- 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.
- Source:
- Crypto.scala
Sign data with a private key, using RCF6979 deterministic signatures
Sign data with a private key, using RCF6979 deterministic signatures
- Value parameters:
- 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 signature in compact format (64 bytes)
- Source:
- Crypto.scala
- Value parameters:
- data
data
- publicKey
public key
- signature
signature
- Returns:
true is signature is valid for this data with this public key
- Source:
- Crypto.scala
Inherited methods
- Value parameters:
- key
serialized public key
- Returns:
true if the key is valid. This check is much more expensive than its lax version since here we check that the public key is a valid point on the secp256k1 curve
- Inherited from:
- CryptoPlatform (hidden)
- Source:
- CryptoPlatform.scala
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.
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.
- Value parameters:
- message
message that was signed
- signature
signature
- Returns:
a recovered public key
- Inherited from:
- CryptoPlatform (hidden)
- Source:
- CryptoPlatform.scala