func PrivKeyFromBytes(pk []byte) (*PrivateKey, *PublicKey) {
	x, y := ec.S256().ScalarBaseMult(pk)
	priv := &ecdsa.PrivateKey{
		PublicKey: ecdsa.PublicKey{
			Curve: ec.S256(),
			X:     x,
			Y:     y,
		},
		D: new(big.Int).SetBytes(pk),
	}
	return (*PrivateKey)(priv), (*PublicKey)(&priv.PublicKey)
}
PrivKeyFromBytes returns a private and public key for `curve' based on the private key passed
as an argument as a byte slice.
package asymmetric
import (
	"crypto/ecdsa"
	"encoding/hex"
	"fmt"
	"math/big"
	"sync"
	"time"
	hsp "github.com/SQLess/HashStablePack/marshalhash"
	ec "github.com/btcsuite/btcd/btcec"
	mine "github.com/SQLess/SQLess/pow/cpuminer"
	"github.com/SQLess/SQLess/utils/log"
)
const PrivateKeyBytesLen = ec.PrivKeyBytesLen
const PublicKeyBytesLen = ec.PubKeyBytesLenCompressed
const PublicKeyFormatHeader byte = 0x2
var parsedPublicKeyCache sync.Map
type PrivateKey ec.PrivateKey
type PublicKey ec.PublicKey
func (k PublicKey) Msgsize() (s int) {
	s = hsp.BytesPrefixSize + ec.PubKeyBytesLenCompressed
	return
}
func (k *PublicKey) MarshalHash() (keyBytes []byte, err error) {
	return k.MarshalBinary()
}
func (k *PublicKey) MarshalBinary() (keyBytes []byte, err error) {
	return k.Serialize(), nil
}
func (k *PublicKey) UnmarshalBinary(keyBytes []byte) (err error) {
	pubKeyI, ok := parsedPublicKeyCache.Load(string(keyBytes))
	if ok {
		*k = *pubKeyI.(*PublicKey)
	} else {
		pubNew, err := ParsePubKey(keyBytes)
		if err == nil {
			*k = *pubNew
			parsedPublicKeyCache.Store(string(keyBytes), pubNew)
		}
	}
	return
}
func (k PublicKey) MarshalYAML() (interface{}, error) {
	return fmt.Sprintf("%x", k.Serialize()), nil
}
func (k *PublicKey) UnmarshalYAML(unmarshal func(interface{}) error) error {
	var str string
	if err := unmarshal(&str); err != nil {
		return err
	}
	pubKeyBytes, err := hex.DecodeString(str)
	if err != nil {
		return err
	}
	err = k.UnmarshalBinary(pubKeyBytes)
	return err
}
func (k *PublicKey) IsEqual(public *PublicKey) bool {
	return (*ec.PublicKey)(k).IsEqual((*ec.PublicKey)(public))
}
func (k *PublicKey) Serialize() []byte {
	return (*ec.PublicKey)(k).SerializeCompressed()
}
func ParsePubKey(pubKeyStr []byte) (*PublicKey, error) {
	key, err := ec.ParsePubKey(pubKeyStr, ec.S256())
	return (*PublicKey)(key), err
}