Skip to content

Commit

Permalink
Schnorr.kt,Ecdsa.kt: Use println and string interpolation
Browse files Browse the repository at this point in the history
This makes for more readable/idiomatic Kotlin
  • Loading branch information
msgilligan committed Aug 20, 2024
1 parent 453da0b commit b0d42ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ object Ecdsa {
/* Verify a signature. This will return true if it's valid and false if it's not. */
val is_signature_valid = secp.ecdsaVerify(sig2, msg_hash, pubkey2).get()

System.out.printf("Is the signature valid? %s\n", is_signature_valid)
System.out.printf("Secret Key: %s\n", privKey.s.toString(16))
System.out.printf("Public Key (as ECPoint): %s\n", pubkey)
System.out.printf("Public Key (Compressed): %s\n", formatter.formatHex(compressed_pubkey.bytes()))
System.out.printf("Signature: %s\n", formatter.formatHex(serialized_signature.bytes()))
println("Is the signature valid? $is_signature_valid")
println("Secret Key: ${privKey.s.toString(16)}")
println("Public Key (as ECPoint): $pubkey")
println("Public Key (Compressed): ${formatter.formatHex(compressed_pubkey.bytes())}")
println("Signature: ${formatter.formatHex(serialized_signature.bytes())}")

/* It's best practice to try to clear secrets from memory after using them.
* This is done because some bugs can allow an attacker to leak memory, for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ object Schnorr {

val is_signature_valid = secp.schnorrSigVerify(signature, msg_hash2, xOnly2).get()

System.out.printf("Is the signature valid? %s\n", is_signature_valid)
System.out.printf("Secret Key: %s\n", keyPair.s.toString(16))
System.out.printf("Public Key (as ECPoint): %s\n", xOnly2)
System.out.printf("Signature: %s\n", formatter.formatHex(signature))
println("Is the signature valid? $is_signature_valid")
println("Secret Key: ${keyPair.s.toString(16)}")
println("Public Key (as ECPoint): $xOnly2")
println("Signature: ${formatter.formatHex(signature)}")

/* It's best practice to try to clear secrets from memory after using them.
* This is done because some bugs can allow an attacker to leak memory, for
Expand Down

0 comments on commit b0d42ef

Please sign in to comment.