Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
rohenaz committed Nov 1, 2020
2 parents 003f7f9 + 8d7d6e3 commit 7360a7e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
4 changes: 4 additions & 0 deletions sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ func SignMessage(privateKey string, message string) (string, error) {

// Create the hash
messageHash := chainhash.DoubleHashB(buf.Bytes())
<<<<<<< HEAD
// fmt.Printf("%x", messageHash)
=======

>>>>>>> 8d7d6e33b2784fbeaf5bd30a409422d3bd573994
// Get the private key
var ecdsaPrivateKey *bsvec.PrivateKey
if ecdsaPrivateKey, err = PrivateKeyFromString(privateKey); err != nil {
Expand Down
19 changes: 10 additions & 9 deletions sign_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package bitcoin

import (
"fmt"
"testing"
)

Expand Down Expand Up @@ -97,15 +98,15 @@ func TestSignMessage(t *testing.T) {
}

// ExampleSignMessage example using SignMessage()
// func ExampleSignMessage() {
// signature, err := SignMessage("ef0b8bad0be285099534277fde328f8f19b3be9cadcd4c08e6ac0b5f863745ac", "This is a test message")
// if err != nil {
// fmt.Printf("error occurred: %s", err.Error())
// return
// }
// fmt.Printf("signature created: %s", signature)
// // Output:signature created: H+zZagsyz7ioC/ZOa5EwsaKice0vs2BvZ0ljgkFHxD3vGsMlGeD4sXHEcfbI4h8lP29VitSBdf4A+nHXih7svf4=
// }
func ExampleSignMessage() {
signature, err := SignMessage("ef0b8bad0be285099534277fde328f8f19b3be9cadcd4c08e6ac0b5f863745ac", "This is a test message")
if err != nil {
fmt.Printf("error occurred: %s", err.Error())
return
}
fmt.Printf("signature created: %s", signature)
// Output:signature created: H+zZagsyz7ioC/ZOa5EwsaKice0vs2BvZ0ljgkFHxD3vGsMlGeD4sXHEcfbI4h8lP29VitSBdf4A+nHXih7svf4=
}

// BenchmarkSignMessage benchmarks the method SignMessage()
func BenchmarkSignMessage(b *testing.B) {
Expand Down
13 changes: 11 additions & 2 deletions verify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,17 @@ func TestVerifyMessage(t *testing.T) {
},
{
"1LN5p7Eg9Zju1b4g4eFPTBMPoMZGCxzrET",
"IFTYA0Vd/fBSl8XwgTDNcQ6LxIl6+Pz7wrOgNs1qyr/zb7R7FZvdISLHp6/TlHvUYqFzWvGbX1WvHPvrYXPkVx8=",
"This time I'm writing a new message that is obnixiously long af. This time I'm writing a new message that is obnixiously long af. This time I'm writing a new message that is obnixiously long af. This time I'm writing a new message that is obnixiously long af. This time I'm writing a new message that is obnixiously long af. This time I'm writing a new message that is obnixiously long af. This time I'm writing a new message that is obnixiously long af. This time I'm writing a new message that is obnixiously long af. This time I'm writing a new message that is obnixiously long af. This time I'm writing a new message that is obnixiously long af. This time I'm writing a new message that is obnixiously long af. This time I'm writing a new message that is obnixiously long af. This time I'm writing a new message that is obnixiously long af. This time I'm writing a new message that is obnixiously long af.",
"IKmgOFrfWRffRNjrQcJQHSBD7WL2di+4doWdaz/a/p5RUiT7ErpUqbYeLi0yzmONFaV8uLWF2vydTjA8W8KnjZU=",
"This time I'm writing a new message that is obnoxiously long af. This time I'm writing a " +
"new message that is obnoxiously long af. This time I'm writing a new message that is obnoxiously " +
"long af. This time I'm writing a new message that is obnoxiously long af. This time I'm writing a " +
"new message that is obnoxiously long af. This time I'm writing a new message that is obnoxiously " +
"long af. This time I'm writing a new message that is obnoxiously long af. This time I'm writing a " +
"new message that is obnoxiously long af. This time I'm writing a new message that is obnoxiously " +
"long af. This time I'm writing a new message that is obnoxiously long af. This time I'm writing a " +
"new message that is obnoxiously long af. This time I'm writing a new message that is obnoxiously " +
"long af. This time I'm writing a new message that is obnoxiously long af. This time I'm writing a " +
"new message that is obnoxiously long af.",
false,
},
{
Expand Down

0 comments on commit 7360a7e

Please sign in to comment.