Versions in this module Expand all Collapse all v0 v0.25.0 Sep 23, 2024 Changes in this version + const MinSigLen + const PrivKeyBytesLen + const PubKeyBytesLenCompressed + const PubKeyBytesLenHybrid + const PubKeyBytesLenUncompressed + var ErrInvalidMAC = errors.New("invalid mac hash") + func Decrypt(priv *PrivateKey, in []byte) ([]byte, error) + func Encrypt(pubkey *PublicKey, in []byte) ([]byte, error) + func GenerateSharedSecret(privkey *PrivateKey, pubkey *PublicKey) []byte + func IsCompressedPubKey(pubKey []byte) bool + func NAF(k []byte) ([]byte, []byte) + func PrivKeyFromBytes(curve elliptic.Curve, pk []byte) (*PrivateKey, *PublicKey) + func SignCompact(curve *KoblitzCurve, key *PrivateKey, hash []byte, isCompressedKey bool) ([]byte, error) + type KoblitzCurve struct + H int + func S256() *KoblitzCurve + func (curve *KoblitzCurve) Add(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int) + func (curve *KoblitzCurve) Double(x1, y1 *big.Int) (*big.Int, *big.Int) + func (curve *KoblitzCurve) IsOnCurve(x, y *big.Int) bool + func (curve *KoblitzCurve) Params() *elliptic.CurveParams + func (curve *KoblitzCurve) Q() *big.Int + func (curve *KoblitzCurve) QPlus1Div4() *big.Int + func (curve *KoblitzCurve) ScalarBaseMult(k []byte) (*big.Int, *big.Int) + func (curve *KoblitzCurve) ScalarMult(Bx, By *big.Int, k []byte) (*big.Int, *big.Int) + type PrivateKey ecdsa.PrivateKey + func NewPrivateKey(curve elliptic.Curve) (*PrivateKey, error) + func (p *PrivateKey) PubKey() *PublicKey + func (p *PrivateKey) Serialize() []byte + func (p *PrivateKey) Sign(hash []byte) (*Signature, error) + func (p *PrivateKey) ToECDSA() *ecdsa.PrivateKey + type PublicKey ecdsa.PublicKey + func ParsePubKey(pubKeyStr []byte, curve *KoblitzCurve) (key *PublicKey, err error) + func RecoverCompact(curve *KoblitzCurve, signature, hash []byte) (*PublicKey, bool, error) + func (p *PublicKey) IsEqual(otherPubKey *PublicKey) bool + func (p *PublicKey) SerializeCompressed() []byte + func (p *PublicKey) SerializeHybrid() []byte + func (p *PublicKey) SerializeUncompressed() []byte + func (p *PublicKey) ToECDSA() *ecdsa.PublicKey + type Signature struct + R *big.Int + S *big.Int + func ParseDERSignature(sigStr []byte, curve elliptic.Curve) (*Signature, error) + func ParseSignature(sigStr []byte, curve elliptic.Curve) (*Signature, error) + func (sig *Signature) IsEqual(otherSig *Signature) bool + func (sig *Signature) Serialize() []byte + func (sig *Signature) Verify(hash []byte, pubKey *PublicKey) bool