Skip to content

Commit 8d7d6e3

Browse files
committed
Fixed grammar and line spacing
1 parent 7f3f889 commit 8d7d6e3

File tree

3 files changed

+33
-15
lines changed

3 files changed

+33
-15
lines changed

sign.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"bytes"
55
"encoding/base64"
66
"errors"
7-
"fmt"
87

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

3130
// Create the hash
3231
messageHash := chainhash.DoubleHashB(buf.Bytes())
33-
fmt.Printf("%x", messageHash)
32+
3433
// Get the private key
3534
var ecdsaPrivateKey *bsvec.PrivateKey
3635
if ecdsaPrivateKey, err = PrivateKeyFromString(privateKey); err != nil {

sign_test.go

+21-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package bitcoin
22

33
import (
4+
"fmt"
45
"testing"
56
)
67

@@ -24,8 +25,17 @@ func TestSignMessage(t *testing.T) {
2425
},
2526
{
2627
"ef0b8bad0be285099534277fde328f8f19b3be9cadcd4c08e6ac0b5f863745ac",
27-
"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.",
28-
"IFTYA0Vd/fBSl8XwgTDNcQ6LxIl6+Pz7wrOgNs1qyr/zb7R7FZvdISLHp6/TlHvUYqFzWvGbX1WvHPvrYXPkVx8=",
28+
"This time I'm writing a new message that is obnoxiously long af. This time I'm writing a " +
29+
"new message that is obnoxiously long af. This time I'm writing a new message that is obnoxiously " +
30+
"long af. This time I'm writing a new message that is obnoxiously long af. This time I'm writing a " +
31+
"new message that is obnoxiously long af. This time I'm writing a new message that is obnoxiously " +
32+
"long af. This time I'm writing a new message that is obnoxiously long af. This time I'm writing a " +
33+
"new message that is obnoxiously long af. This time I'm writing a new message that is obnoxiously " +
34+
"long af. This time I'm writing a new message that is obnoxiously long af. This time I'm writing a " +
35+
"new message that is obnoxiously long af. This time I'm writing a new message that is obnoxiously " +
36+
"long af. This time I'm writing a new message that is obnoxiously long af. This time I'm writing a " +
37+
"new message that is obnoxiously long af.",
38+
"IKmgOFrfWRffRNjrQcJQHSBD7WL2di+4doWdaz/a/p5RUiT7ErpUqbYeLi0yzmONFaV8uLWF2vydTjA8W8KnjZU=",
2939
false,
3040
},
3141
{
@@ -91,15 +101,15 @@ func TestSignMessage(t *testing.T) {
91101
}
92102

93103
// ExampleSignMessage example using SignMessage()
94-
// func ExampleSignMessage() {
95-
// signature, err := SignMessage("ef0b8bad0be285099534277fde328f8f19b3be9cadcd4c08e6ac0b5f863745ac", "This is a test message")
96-
// if err != nil {
97-
// fmt.Printf("error occurred: %s", err.Error())
98-
// return
99-
// }
100-
// fmt.Printf("signature created: %s", signature)
101-
// // Output:signature created: H+zZagsyz7ioC/ZOa5EwsaKice0vs2BvZ0ljgkFHxD3vGsMlGeD4sXHEcfbI4h8lP29VitSBdf4A+nHXih7svf4=
102-
// }
104+
func ExampleSignMessage() {
105+
signature, err := SignMessage("ef0b8bad0be285099534277fde328f8f19b3be9cadcd4c08e6ac0b5f863745ac", "This is a test message")
106+
if err != nil {
107+
fmt.Printf("error occurred: %s", err.Error())
108+
return
109+
}
110+
fmt.Printf("signature created: %s", signature)
111+
// Output:signature created: H+zZagsyz7ioC/ZOa5EwsaKice0vs2BvZ0ljgkFHxD3vGsMlGeD4sXHEcfbI4h8lP29VitSBdf4A+nHXih7svf4=
112+
}
103113

104114
// BenchmarkSignMessage benchmarks the method SignMessage()
105115
func BenchmarkSignMessage(b *testing.B) {

verify_test.go

+11-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,17 @@ func TestVerifyMessage(t *testing.T) {
3434
},
3535
{
3636
"1LN5p7Eg9Zju1b4g4eFPTBMPoMZGCxzrET",
37-
"IFTYA0Vd/fBSl8XwgTDNcQ6LxIl6+Pz7wrOgNs1qyr/zb7R7FZvdISLHp6/TlHvUYqFzWvGbX1WvHPvrYXPkVx8=",
38-
"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.",
37+
"IKmgOFrfWRffRNjrQcJQHSBD7WL2di+4doWdaz/a/p5RUiT7ErpUqbYeLi0yzmONFaV8uLWF2vydTjA8W8KnjZU=",
38+
"This time I'm writing a new message that is obnoxiously long af. This time I'm writing a " +
39+
"new message that is obnoxiously long af. This time I'm writing a new message that is obnoxiously " +
40+
"long af. This time I'm writing a new message that is obnoxiously long af. This time I'm writing a " +
41+
"new message that is obnoxiously long af. This time I'm writing a new message that is obnoxiously " +
42+
"long af. This time I'm writing a new message that is obnoxiously long af. This time I'm writing a " +
43+
"new message that is obnoxiously long af. This time I'm writing a new message that is obnoxiously " +
44+
"long af. This time I'm writing a new message that is obnoxiously long af. This time I'm writing a " +
45+
"new message that is obnoxiously long af. This time I'm writing a new message that is obnoxiously " +
46+
"long af. This time I'm writing a new message that is obnoxiously long af. This time I'm writing a " +
47+
"new message that is obnoxiously long af.",
3948
false,
4049
},
4150
{

0 commit comments

Comments
 (0)