The core protocol of WoopChain
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
woop/crypto/pki/utils_test.go

23 lines
544 B

package pki
import (
"encoding/binary"
"reflect"
"testing"
"time"
"github.com/harmony-one/bls/ffi/go/bls"
)
func TestGetAddressFromPublicKey(test *testing.T) {
t := time.Now().UnixNano()
priKey := [32]byte{}
binary.LittleEndian.PutUint32(priKey[:], uint32(t))
var privateKey bls.SecretKey
privateKey.SetLittleEndian(priKey[:])
addr1 := GetAddressFromPublicKey(privateKey.GetPublicKey())
addr2 := GetAddressFromPrivateKey(&privateKey)
if !reflect.DeepEqual(addr1, addr2) {
test.Error("two public address should be equal")
}
}