Example #1
0
//test signatures
func TestCrypto2(t *testing.T) {
	a := "5a42c0643bdb465d90bf673b99c14f5fa02db71513249d904573d2b8b63d353d"
	b, err := hex.DecodeString(a)
	if err != nil {
		t.Fatal(err)
	}

	if len(b) != 32 {
		t.Fatal()
	}

	seckey := cipher.NewSecKey(b)
	pubkey := cipher.PubKeyFromSecKey(seckey)

	addr := cipher.AddressFromPubKey(pubkey)
	_ = addr

	test := []byte("test message")
	hash := cipher.SumSHA256(test)
	err = cipher.TestSecKeyHash(seckey, hash)
	if err != nil {
		t.Fatal()
	}

}
Example #2
0
func TestAddress2(t *testing.T) {
	a := "5a42c0643bdb465d90bf673b99c14f5fa02db71513249d904573d2b8b63d353d"
	b, err := hex.DecodeString(a)
	if err != nil {
		t.Fail()
	}

	if len(b) != 32 {
		t.Fail()
	}

	seckey := cipher.NewSecKey(b)
	pubkey := cipher.PubKeyFromSecKey(seckey)
	addr := cipher.AddressFromPubKey(pubkey)
	_ = addr

	///func SignHash(hash cipher.SHA256, sec SecKey) (Sig, error) {

}