Skip to content

Commit

Permalink
Fixed grammar and line spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 committed Oct 31, 2020
1 parent 7f3f889 commit 8d7d6e3
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 15 deletions.
3 changes: 1 addition & 2 deletions sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"encoding/base64"
"errors"
"fmt"

"github.com/bitcoinsv/bsvd/bsvec"
"github.com/bitcoinsv/bsvd/chaincfg/chainhash"
Expand All @@ -30,7 +29,7 @@ func SignMessage(privateKey string, message string) (string, error) {

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

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

import (
"fmt"
"testing"
)

Expand All @@ -24,8 +25,17 @@ func TestSignMessage(t *testing.T) {
},
{
"ef0b8bad0be285099534277fde328f8f19b3be9cadcd4c08e6ac0b5f863745ac",
"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.",
"IFTYA0Vd/fBSl8XwgTDNcQ6LxIl6+Pz7wrOgNs1qyr/zb7R7FZvdISLHp6/TlHvUYqFzWvGbX1WvHPvrYXPkVx8=",
"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.",
"IKmgOFrfWRffRNjrQcJQHSBD7WL2di+4doWdaz/a/p5RUiT7ErpUqbYeLi0yzmONFaV8uLWF2vydTjA8W8KnjZU=",
false,
},
{
Expand Down Expand Up @@ -91,15 +101,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 8d7d6e3

Please sign in to comment.