mirror of
https://github.com/PeernetOfficial/Cmd.git
synced 2026-07-17 02:47:52 +01:00
Update to latest core
This commit is contained in:
13
Test_test.go
13
Test_test.go
@@ -2,17 +2,13 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/PeernetOfficial/core"
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"lukechampine.com/blake3"
|
||||
)
|
||||
|
||||
/*
|
||||
func TestSignCompact(t *testing.T) {
|
||||
privateKey, publicKey, err := core.Secp256k1NewPrivateKey()
|
||||
if err != nil {
|
||||
@@ -26,19 +22,20 @@ func TestSignCompact(t *testing.T) {
|
||||
time1 := time.Now()
|
||||
|
||||
compact1 = make([]byte, 0)
|
||||
compact1, err = btcec.SignCompact(btcec.S256(), privateKey, chainhash.DoubleHashB(data), true)
|
||||
compact1, err = btcec.SignCompact(btcec.S256(), privateKey, hashData(data), true)
|
||||
|
||||
timeT := time.Since(time1)
|
||||
fmt.Printf("length %d time %s\n", len(compact1), timeT.String())
|
||||
|
||||
time2 := time.Now()
|
||||
|
||||
key2, _, err := btcec.RecoverCompact(btcec.S256(), compact1, chainhash.DoubleHashB(data))
|
||||
key2, _, err := btcec.RecoverCompact(btcec.S256(), compact1, hashData(data))
|
||||
|
||||
timeT2 := time.Since(time2)
|
||||
fmt.Printf("VALID PUBLIC KEY: %t\n", key2.IsEqual(publicKey))
|
||||
fmt.Printf("time %s\n", timeT2.String())
|
||||
}
|
||||
*/
|
||||
|
||||
func TestEncryption1(t *testing.T) {
|
||||
privateKey, publicKey, err := core.Secp256k1NewPrivateKey()
|
||||
@@ -63,6 +60,7 @@ func TestEncryption1(t *testing.T) {
|
||||
fmt.Printf("%d\n", packet1d.Command)
|
||||
}
|
||||
|
||||
/*
|
||||
func BenchmarkHash(b *testing.B) {
|
||||
length := 20000
|
||||
|
||||
@@ -85,6 +83,7 @@ func BenchmarkHash(b *testing.B) {
|
||||
}
|
||||
})
|
||||
}
|
||||
*/
|
||||
|
||||
func TestEncryption2(t *testing.T) {
|
||||
privateKey, publicKey, err := core.Secp256k1NewPrivateKey()
|
||||
|
||||
2
go.mod
2
go.mod
@@ -2,4 +2,4 @@ module github.com/PeernetOfficial/Cmd
|
||||
|
||||
go 1.16
|
||||
|
||||
require github.com/PeernetOfficial/core v0.0.0-20210317015617-ddd3f6518767
|
||||
require github.com/PeernetOfficial/core v0.0.0-20210317104020-b8e408048ceb
|
||||
|
||||
4
go.sum
4
go.sum
@@ -1,5 +1,5 @@
|
||||
github.com/PeernetOfficial/core v0.0.0-20210317015617-ddd3f6518767 h1:6aqb5uDq5KsGMaqbV/e7cwTLetp0YXzV1KGSbq6xDXc=
|
||||
github.com/PeernetOfficial/core v0.0.0-20210317015617-ddd3f6518767/go.mod h1:SNy9riYEKopf8xBxiIJlfaOX7TPwsWGbmNBjJpjOZoA=
|
||||
github.com/PeernetOfficial/core v0.0.0-20210317104020-b8e408048ceb h1:TDBGnn8fGEow63bEuHgwL7u+pHJDG/PajBcFyF/c8LA=
|
||||
github.com/PeernetOfficial/core v0.0.0-20210317104020-b8e408048ceb/go.mod h1:SNy9riYEKopf8xBxiIJlfaOX7TPwsWGbmNBjJpjOZoA=
|
||||
github.com/PeernetOfficial/core/dht v0.0.0-20210316211915-8b329f7258d1 h1:kbSPQTir7JrBAR7OL6TZIwWsRuqroafeXnFpKXOyEvk=
|
||||
github.com/PeernetOfficial/core/dht v0.0.0-20210316211915-8b329f7258d1/go.mod h1:sb2H21VIVTohCXVrDFo/Skl2tN8Yzba+MXSS6NgCYXw=
|
||||
github.com/PeernetOfficial/core/reuseport v0.0.0-20210316211915-8b329f7258d1 h1:m1dEg5E8ZwT3l/F6xiDrU2Q/ZJ9BeVFAZt/OUBxtr4M=
|
||||
|
||||
Reference in New Issue
Block a user