From ce80f234c75b85383a20b19cae393aec0f2b1a50 Mon Sep 17 00:00:00 2001 From: Emmanuel Odeke Date: Fri, 28 Jul 2017 13:01:28 -0600 Subject: [PATCH] README: add godoc instead of tedious MD regeneration Add a godoc reference to delegate indexing and references to that service, thus keeping our library and usages upto date, instead of relying on generated markdown that goes stale especially for changing API signatures, and becomes tedious where someone has to remember to always regenerate the README markdown and then commit it. Fixes #24 --- Makefile | 6 +- README.md | 839 +----------------------------------------------------- 2 files changed, 5 insertions(+), 840 deletions(-) diff --git a/Makefile b/Makefile index 537b6396..8387f060 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,10 @@ -.PHONEY: all docs test install get_vendor_deps ensure_tools codegen wordlist +.PHONEY: all test install get_vendor_deps ensure_tools codegen wordlist GOTOOLS = \ github.com/Masterminds/glide \ github.com/jteeuwen/go-bindata/go-bindata REPO:=github.com/tendermint/go-crypto -docs: - @go get github.com/davecheney/godoc2md - godoc2md $(REPO) > README.md - all: get_vendor_deps install test install: diff --git a/README.md b/README.md index ada19208..da76fe82 100644 --- a/README.md +++ b/README.md @@ -1,837 +1,6 @@ +# go-crypto [![GoDoc](https://godoc.org/github.com/tendermint/go-crypto?status.svg)](https://godoc.org/github.com/tendermint/go-crypto) +go-crypto is the cryptographic package adapted for Tendermint's uses -# crypto -`import "github.com/tendermint/go-crypto"` - -* [Overview](#pkg-overview) -* [Index](#pkg-index) -* [Subdirectories](#pkg-subdirectories) - -## Overview - - - -## Index -* [Constants](#pkg-constants) -* [func CRandBytes(numBytes int) []byte](#CRandBytes) -* [func CRandHex(numDigits int) string](#CRandHex) -* [func CReader() io.Reader](#CReader) -* [func DecodeArmor(armorStr string) (blockType string, headers map[string]string, data []byte, err error)](#DecodeArmor) -* [func DecryptSymmetric(ciphertext []byte, secret []byte) (plaintext []byte, err error)](#DecryptSymmetric) -* [func EncodeArmor(blockType string, headers map[string]string, data []byte) string](#EncodeArmor) -* [func EncryptSymmetric(plaintext []byte, secret []byte) (ciphertext []byte)](#EncryptSymmetric) -* [func MixEntropy(seedBytes []byte)](#MixEntropy) -* [func Ripemd160(bytes []byte) []byte](#Ripemd160) -* [func Sha256(bytes []byte) []byte](#Sha256) -* [type PrivKey](#PrivKey) - * [func PrivKeyFromBytes(privKeyBytes []byte) (privKey PrivKey, err error)](#PrivKeyFromBytes) -* [type PrivKeyEd25519](#PrivKeyEd25519) - * [func GenPrivKeyEd25519() PrivKeyEd25519](#GenPrivKeyEd25519) - * [func GenPrivKeyEd25519FromSecret(secret []byte) PrivKeyEd25519](#GenPrivKeyEd25519FromSecret) - * [func (privKey PrivKeyEd25519) Bytes() []byte](#PrivKeyEd25519.Bytes) - * [func (privKey PrivKeyEd25519) Equals(other PrivKey) bool](#PrivKeyEd25519.Equals) - * [func (privKey PrivKeyEd25519) Generate(index int) PrivKeyEd25519](#PrivKeyEd25519.Generate) - * [func (p PrivKeyEd25519) MarshalJSON() ([]byte, error)](#PrivKeyEd25519.MarshalJSON) - * [func (privKey PrivKeyEd25519) PubKey() PubKey](#PrivKeyEd25519.PubKey) - * [func (privKey PrivKeyEd25519) Sign(msg []byte) Signature](#PrivKeyEd25519.Sign) - * [func (privKey PrivKeyEd25519) String() string](#PrivKeyEd25519.String) - * [func (privKey PrivKeyEd25519) ToCurve25519() *[32]byte](#PrivKeyEd25519.ToCurve25519) - * [func (p *PrivKeyEd25519) UnmarshalJSON(enc []byte) error](#PrivKeyEd25519.UnmarshalJSON) -* [type PrivKeyS](#PrivKeyS) - * [func (p PrivKeyS) Empty() bool](#PrivKeyS.Empty) - * [func (p PrivKeyS) MarshalJSON() ([]byte, error)](#PrivKeyS.MarshalJSON) - * [func (p *PrivKeyS) UnmarshalJSON(data []byte) (err error)](#PrivKeyS.UnmarshalJSON) -* [type PrivKeySecp256k1](#PrivKeySecp256k1) - * [func GenPrivKeySecp256k1() PrivKeySecp256k1](#GenPrivKeySecp256k1) - * [func GenPrivKeySecp256k1FromSecret(secret []byte) PrivKeySecp256k1](#GenPrivKeySecp256k1FromSecret) - * [func (privKey PrivKeySecp256k1) Bytes() []byte](#PrivKeySecp256k1.Bytes) - * [func (privKey PrivKeySecp256k1) Equals(other PrivKey) bool](#PrivKeySecp256k1.Equals) - * [func (p PrivKeySecp256k1) MarshalJSON() ([]byte, error)](#PrivKeySecp256k1.MarshalJSON) - * [func (privKey PrivKeySecp256k1) PubKey() PubKey](#PrivKeySecp256k1.PubKey) - * [func (privKey PrivKeySecp256k1) Sign(msg []byte) Signature](#PrivKeySecp256k1.Sign) - * [func (privKey PrivKeySecp256k1) String() string](#PrivKeySecp256k1.String) - * [func (p *PrivKeySecp256k1) UnmarshalJSON(enc []byte) error](#PrivKeySecp256k1.UnmarshalJSON) -* [type PubKey](#PubKey) - * [func PubKeyFromBytes(pubKeyBytes []byte) (pubKey PubKey, err error)](#PubKeyFromBytes) -* [type PubKeyEd25519](#PubKeyEd25519) - * [func (pubKey PubKeyEd25519) Address() []byte](#PubKeyEd25519.Address) - * [func (pubKey PubKeyEd25519) Bytes() []byte](#PubKeyEd25519.Bytes) - * [func (pubKey PubKeyEd25519) Equals(other PubKey) bool](#PubKeyEd25519.Equals) - * [func (pubKey PubKeyEd25519) KeyString() string](#PubKeyEd25519.KeyString) - * [func (p PubKeyEd25519) MarshalJSON() ([]byte, error)](#PubKeyEd25519.MarshalJSON) - * [func (pubKey PubKeyEd25519) String() string](#PubKeyEd25519.String) - * [func (pubKey PubKeyEd25519) ToCurve25519() *[32]byte](#PubKeyEd25519.ToCurve25519) - * [func (p *PubKeyEd25519) UnmarshalJSON(enc []byte) error](#PubKeyEd25519.UnmarshalJSON) - * [func (pubKey PubKeyEd25519) VerifyBytes(msg []byte, sig_ Signature) bool](#PubKeyEd25519.VerifyBytes) -* [type PubKeyS](#PubKeyS) - * [func (p PubKeyS) Empty() bool](#PubKeyS.Empty) - * [func (p PubKeyS) MarshalJSON() ([]byte, error)](#PubKeyS.MarshalJSON) - * [func (p *PubKeyS) UnmarshalJSON(data []byte) (err error)](#PubKeyS.UnmarshalJSON) -* [type PubKeySecp256k1](#PubKeySecp256k1) - * [func (pubKey PubKeySecp256k1) Address() []byte](#PubKeySecp256k1.Address) - * [func (pubKey PubKeySecp256k1) Bytes() []byte](#PubKeySecp256k1.Bytes) - * [func (pubKey PubKeySecp256k1) Equals(other PubKey) bool](#PubKeySecp256k1.Equals) - * [func (pubKey PubKeySecp256k1) KeyString() string](#PubKeySecp256k1.KeyString) - * [func (p PubKeySecp256k1) MarshalJSON() ([]byte, error)](#PubKeySecp256k1.MarshalJSON) - * [func (pubKey PubKeySecp256k1) String() string](#PubKeySecp256k1.String) - * [func (p *PubKeySecp256k1) UnmarshalJSON(enc []byte) error](#PubKeySecp256k1.UnmarshalJSON) - * [func (pubKey PubKeySecp256k1) VerifyBytes(msg []byte, sig_ Signature) bool](#PubKeySecp256k1.VerifyBytes) -* [type Signature](#Signature) - * [func SignatureFromBytes(sigBytes []byte) (sig Signature, err error)](#SignatureFromBytes) -* [type SignatureEd25519](#SignatureEd25519) - * [func (sig SignatureEd25519) Bytes() []byte](#SignatureEd25519.Bytes) - * [func (sig SignatureEd25519) Equals(other Signature) bool](#SignatureEd25519.Equals) - * [func (sig SignatureEd25519) IsZero() bool](#SignatureEd25519.IsZero) - * [func (p SignatureEd25519) MarshalJSON() ([]byte, error)](#SignatureEd25519.MarshalJSON) - * [func (sig SignatureEd25519) String() string](#SignatureEd25519.String) - * [func (p *SignatureEd25519) UnmarshalJSON(enc []byte) error](#SignatureEd25519.UnmarshalJSON) -* [type SignatureS](#SignatureS) - * [func (p SignatureS) Empty() bool](#SignatureS.Empty) - * [func (p SignatureS) MarshalJSON() ([]byte, error)](#SignatureS.MarshalJSON) - * [func (p *SignatureS) UnmarshalJSON(data []byte) (err error)](#SignatureS.UnmarshalJSON) -* [type SignatureSecp256k1](#SignatureSecp256k1) - * [func (sig SignatureSecp256k1) Bytes() []byte](#SignatureSecp256k1.Bytes) - * [func (sig SignatureSecp256k1) Equals(other Signature) bool](#SignatureSecp256k1.Equals) - * [func (sig SignatureSecp256k1) IsZero() bool](#SignatureSecp256k1.IsZero) - * [func (p SignatureSecp256k1) MarshalJSON() ([]byte, error)](#SignatureSecp256k1.MarshalJSON) - * [func (sig SignatureSecp256k1) String() string](#SignatureSecp256k1.String) - * [func (p *SignatureSecp256k1) UnmarshalJSON(enc []byte) error](#SignatureSecp256k1.UnmarshalJSON) - - -#### Package files -[armor.go](/src/github.com/tendermint/go-crypto/armor.go) [hash.go](/src/github.com/tendermint/go-crypto/hash.go) [priv_key.go](/src/github.com/tendermint/go-crypto/priv_key.go) [pub_key.go](/src/github.com/tendermint/go-crypto/pub_key.go) [random.go](/src/github.com/tendermint/go-crypto/random.go) [signature.go](/src/github.com/tendermint/go-crypto/signature.go) [symmetric.go](/src/github.com/tendermint/go-crypto/symmetric.go) - - -## Constants -``` go -const ( - TypeEd25519 = byte(0x01) - TypeSecp256k1 = byte(0x02) - NameEd25519 = "ed25519" - NameSecp256k1 = "secp256k1" -) -``` -Types of implementations - - - - -## func [CRandBytes](/src/target/random.go?s=698:734#L28) -``` go -func CRandBytes(numBytes int) []byte -``` -This uses the OS and the Seed(s). - - - -## func [CRandHex](/src/target/random.go?s=924:959#L38) -``` go -func CRandHex(numDigits int) string -``` -RandHex(24) gives 96 bits of randomness, strong enough for most purposes. - - - -## func [CReader](/src/target/random.go?s=1078:1102#L43) -``` go -func CReader() io.Reader -``` -Returns a crand.Reader mixed with user-supplied entropy - - - -## func [DecodeArmor](/src/target/armor.go?s=596:699#L18) -``` go -func DecodeArmor(armorStr string) (blockType string, headers map[string]string, data []byte, err error) -``` - - -## func [DecryptSymmetric](/src/target/symmetric.go?s=1048:1133#L23) -``` go -func DecryptSymmetric(ciphertext []byte, secret []byte) (plaintext []byte, err error) -``` -secret must be 32 bytes long. Use something like Sha256(Bcrypt(passphrase)) -The ciphertext is (secretbox.Overhead + 24) bytes longer than the plaintext. - - - -## func [EncodeArmor](/src/target/armor.go?s=125:206#L1) -``` go -func EncodeArmor(blockType string, headers map[string]string, data []byte) string -``` - - -## func [EncryptSymmetric](/src/target/symmetric.go?s=356:430#L6) -``` go -func EncryptSymmetric(plaintext []byte, secret []byte) (ciphertext []byte) -``` -secret must be 32 bytes long. Use something like Sha256(Bcrypt(passphrase)) -The ciphertext is (secretbox.Overhead + 24) bytes longer than the plaintext. -NOTE: call crypto.MixEntropy() first. - - - -## func [MixEntropy](/src/target/random.go?s=407:440#L13) -``` go -func MixEntropy(seedBytes []byte) -``` -Mix additional bytes of randomness, e.g. from hardware, user-input, etc. -It is OK to call it multiple times. It does not diminish security. - - - -## func [Ripemd160](/src/target/hash.go?s=185:220#L4) -``` go -func Ripemd160(bytes []byte) []byte -``` - - -## func [Sha256](/src/target/hash.go?s=78:110#L1) -``` go -func Sha256(bytes []byte) []byte -``` - - - -## type [PrivKey](/src/target/priv_key.go?s=326:435#L5) -``` go -type PrivKey interface { - Bytes() []byte - Sign(msg []byte) Signature - PubKey() PubKey - Equals(PrivKey) bool -} -``` -PrivKey is part of PrivAccount and state.PrivValidator. - - - - - - - -### func [PrivKeyFromBytes](/src/target/priv_key.go?s=1302:1373#L50) -``` go -func PrivKeyFromBytes(privKeyBytes []byte) (privKey PrivKey, err error) -``` - - - - -## type [PrivKeyEd25519](/src/target/priv_key.go?s=1502:1530#L58) -``` go -type PrivKeyEd25519 [64]byte -``` -Implements PrivKey - - - - - - - -### func [GenPrivKeyEd25519](/src/target/priv_key.go?s=3003:3042#L116) -``` go -func GenPrivKeyEd25519() PrivKeyEd25519 -``` - -### func [GenPrivKeyEd25519FromSecret](/src/target/priv_key.go?s=3290:3352#L125) -``` go -func GenPrivKeyEd25519FromSecret(secret []byte) PrivKeyEd25519 -``` -NOTE: secret should be the output of a KDF like bcrypt, -if it's derived from user input. - - - - - -### func (PrivKeyEd25519) [Bytes](/src/target/priv_key.go?s=1532:1576#L60) -``` go -func (privKey PrivKeyEd25519) Bytes() []byte -``` - - - -### func (PrivKeyEd25519) [Equals](/src/target/priv_key.go?s=1973:2029#L75) -``` go -func (privKey PrivKeyEd25519) Equals(other PrivKey) bool -``` - - - -### func (PrivKeyEd25519) [Generate](/src/target/priv_key.go?s=2761:2825#L106) -``` go -func (privKey PrivKeyEd25519) Generate(index int) PrivKeyEd25519 -``` -Deterministically generates new priv-key bytes from key. - - - - -### func (PrivKeyEd25519) [MarshalJSON](/src/target/priv_key.go?s=2156:2209#L83) -``` go -func (p PrivKeyEd25519) MarshalJSON() ([]byte, error) -``` - - - -### func (PrivKeyEd25519) [PubKey](/src/target/priv_key.go?s=1826:1871#L70) -``` go -func (privKey PrivKeyEd25519) PubKey() PubKey -``` - - - -### func (PrivKeyEd25519) [Sign](/src/target/priv_key.go?s=1635:1691#L64) -``` go -func (privKey PrivKeyEd25519) Sign(msg []byte) Signature -``` - - - -### func (PrivKeyEd25519) [String](/src/target/priv_key.go?s=2613:2658#L101) -``` go -func (privKey PrivKeyEd25519) String() string -``` - - - -### func (PrivKeyEd25519) [ToCurve25519](/src/target/priv_key.go?s=2399:2453#L94) -``` go -func (privKey PrivKeyEd25519) ToCurve25519() *[32]byte -``` - - - -### func (\*PrivKeyEd25519) [UnmarshalJSON](/src/target/priv_key.go?s=2250:2306#L87) -``` go -func (p *PrivKeyEd25519) UnmarshalJSON(enc []byte) error -``` - - - -## type [PrivKeyS](/src/target/priv_key.go?s=929:962#L30) -``` go -type PrivKeyS struct { - PrivKey -} -``` -PrivKeyS add json serialization to PrivKey - - - - - - - - - - -### func (PrivKeyS) [Empty](/src/target/priv_key.go?s=1241:1271#L46) -``` go -func (p PrivKeyS) Empty() bool -``` - - - -### func (PrivKeyS) [MarshalJSON](/src/target/priv_key.go?s=964:1011#L34) -``` go -func (p PrivKeyS) MarshalJSON() ([]byte, error) -``` - - - -### func (\*PrivKeyS) [UnmarshalJSON](/src/target/priv_key.go?s=1057:1114#L38) -``` go -func (p *PrivKeyS) UnmarshalJSON(data []byte) (err error) -``` - - - -## type [PrivKeySecp256k1](/src/target/priv_key.go?s=3635:3665#L136) -``` go -type PrivKeySecp256k1 [32]byte -``` -Implements PrivKey - - - - - - - -### func [GenPrivKeySecp256k1](/src/target/priv_key.go?s=5071:5114#L194) -``` go -func GenPrivKeySecp256k1() PrivKeySecp256k1 -``` - -### func [GenPrivKeySecp256k1FromSecret](/src/target/priv_key.go?s=5436:5502#L204) -``` go -func GenPrivKeySecp256k1FromSecret(secret []byte) PrivKeySecp256k1 -``` -NOTE: secret should be the output of a KDF like bcrypt, -if it's derived from user input. - - - - - -### func (PrivKeySecp256k1) [Bytes](/src/target/priv_key.go?s=3667:3713#L138) -``` go -func (privKey PrivKeySecp256k1) Bytes() []byte -``` - - - -### func (PrivKeySecp256k1) [Equals](/src/target/priv_key.go?s=4235:4293#L158) -``` go -func (privKey PrivKeySecp256k1) Equals(other PrivKey) bool -``` - - - -### func (PrivKeySecp256k1) [MarshalJSON](/src/target/priv_key.go?s=4426:4481#L166) -``` go -func (p PrivKeySecp256k1) MarshalJSON() ([]byte, error) -``` - - - -### func (PrivKeySecp256k1) [PubKey](/src/target/priv_key.go?s=4032:4079#L151) -``` go -func (privKey PrivKeySecp256k1) PubKey() PubKey -``` - - - -### func (PrivKeySecp256k1) [Sign](/src/target/priv_key.go?s=3772:3830#L142) -``` go -func (privKey PrivKeySecp256k1) Sign(msg []byte) Signature -``` - - - -### func (PrivKeySecp256k1) [String](/src/target/priv_key.go?s=4673:4720#L177) -``` go -func (privKey PrivKeySecp256k1) String() string -``` - - - -### func (\*PrivKeySecp256k1) [UnmarshalJSON](/src/target/priv_key.go?s=4522:4580#L170) -``` go -func (p *PrivKeySecp256k1) UnmarshalJSON(enc []byte) error -``` - - - -## type [PubKey](/src/target/pub_key.go?s=361:506#L7) -``` go -type PubKey interface { - Address() []byte - Bytes() []byte - KeyString() string - VerifyBytes(msg []byte, sig Signature) bool - Equals(PubKey) bool -} -``` -PubKey is part of Account and Validator. - - - - - - - -### func [PubKeyFromBytes](/src/target/pub_key.go?s=1203:1270#L45) -``` go -func PubKeyFromBytes(pubKeyBytes []byte) (pubKey PubKey, err error) -``` - - - - -## type [PubKeyEd25519](/src/target/pub_key.go?s=1396:1423#L53) -``` go -type PubKeyEd25519 [32]byte -``` -Implements PubKey - - - - - - - - - - -### func (PubKeyEd25519) [Address](/src/target/pub_key.go?s=1425:1469#L55) -``` go -func (pubKey PubKeyEd25519) Address() []byte -``` - - - -### func (PubKeyEd25519) [Bytes](/src/target/pub_key.go?s=1789:1831#L68) -``` go -func (pubKey PubKeyEd25519) Bytes() []byte -``` - - - -### func (PubKeyEd25519) [Equals](/src/target/pub_key.go?s=3064:3117#L119) -``` go -func (pubKey PubKeyEd25519) Equals(other PubKey) bool -``` - - - -### func (PubKeyEd25519) [KeyString](/src/target/pub_key.go?s=2983:3029#L115) -``` go -func (pubKey PubKeyEd25519) KeyString() string -``` -Must return the full bytes in hex. -Used for map keying, etc. - - - - -### func (PubKeyEd25519) [MarshalJSON](/src/target/pub_key.go?s=2279:2331#L87) -``` go -func (p PubKeyEd25519) MarshalJSON() ([]byte, error) -``` - - - -### func (PubKeyEd25519) [String](/src/target/pub_key.go?s=2823:2866#L109) -``` go -func (pubKey PubKeyEd25519) String() string -``` - - - -### func (PubKeyEd25519) [ToCurve25519](/src/target/pub_key.go?s=2585:2637#L100) -``` go -func (pubKey PubKeyEd25519) ToCurve25519() *[32]byte -``` -For use with golang/crypto/nacl/box -If error, returns nil. - - - - -### func (\*PubKeyEd25519) [UnmarshalJSON](/src/target/pub_key.go?s=2372:2427#L91) -``` go -func (p *PubKeyEd25519) UnmarshalJSON(enc []byte) error -``` - - - -### func (PubKeyEd25519) [VerifyBytes](/src/target/pub_key.go?s=1888:1960#L72) -``` go -func (pubKey PubKeyEd25519) VerifyBytes(msg []byte, sig_ Signature) bool -``` - - - -## type [PubKeyS](/src/target/pub_key.go?s=841:872#L25) -``` go -type PubKeyS struct { - PubKey -} -``` -PubKeyS add json serialization to PubKey - - - - - - - - - - -### func (PubKeyS) [Empty](/src/target/pub_key.go?s=1144:1173#L41) -``` go -func (p PubKeyS) Empty() bool -``` - - - -### func (PubKeyS) [MarshalJSON](/src/target/pub_key.go?s=874:920#L29) -``` go -func (p PubKeyS) MarshalJSON() ([]byte, error) -``` - - - -### func (\*PubKeyS) [UnmarshalJSON](/src/target/pub_key.go?s=964:1020#L33) -``` go -func (p *PubKeyS) UnmarshalJSON(data []byte) (err error) -``` - - - -## type [PubKeySecp256k1](/src/target/pub_key.go?s=3401:3430#L132) -``` go -type PubKeySecp256k1 [33]byte -``` -Implements PubKey. -Compressed pubkey (just the x-cord), -prefixed with 0x02 or 0x03, depending on the y-cord. - - - - - - - - - - -### func (PubKeySecp256k1) [Address](/src/target/pub_key.go?s=3497:3543#L135) -``` go -func (pubKey PubKeySecp256k1) Address() []byte -``` -Implements Bitcoin style addresses: RIPEMD160(SHA256(pubkey)) - - - - -### func (PubKeySecp256k1) [Bytes](/src/target/pub_key.go?s=3774:3818#L145) -``` go -func (pubKey PubKeySecp256k1) Bytes() []byte -``` - - - -### func (PubKeySecp256k1) [Equals](/src/target/pub_key.go?s=4897:4952#L192) -``` go -func (pubKey PubKeySecp256k1) Equals(other PubKey) bool -``` - - - -### func (PubKeySecp256k1) [KeyString](/src/target/pub_key.go?s=4814:4862#L188) -``` go -func (pubKey PubKeySecp256k1) KeyString() string -``` -Must return the full bytes in hex. -Used for map keying, etc. - - - - -### func (PubKeySecp256k1) [MarshalJSON](/src/target/pub_key.go?s=4405:4459#L171) -``` go -func (p PubKeySecp256k1) MarshalJSON() ([]byte, error) -``` - - - -### func (PubKeySecp256k1) [String](/src/target/pub_key.go?s=4650:4695#L182) -``` go -func (pubKey PubKeySecp256k1) String() string -``` - - - -### func (\*PubKeySecp256k1) [UnmarshalJSON](/src/target/pub_key.go?s=4500:4557#L175) -``` go -func (p *PubKeySecp256k1) UnmarshalJSON(enc []byte) error -``` - - - -### func (PubKeySecp256k1) [VerifyBytes](/src/target/pub_key.go?s=3875:3949#L149) -``` go -func (pubKey PubKeySecp256k1) VerifyBytes(msg []byte, sig_ Signature) bool -``` - - - -## type [Signature](/src/target/signature.go?s=204:304#L3) -``` go -type Signature interface { - Bytes() []byte - IsZero() bool - String() string - Equals(Signature) bool -} -``` -Signature is a part of Txs and consensus Votes. - - - - - - - -### func [SignatureFromBytes](/src/target/signature.go?s=1031:1098#L40) -``` go -func SignatureFromBytes(sigBytes []byte) (sig Signature, err error) -``` - - - - -## type [SignatureEd25519](/src/target/signature.go?s=1221:1251#L48) -``` go -type SignatureEd25519 [64]byte -``` -Implements Signature - - - - - - - - - - -### func (SignatureEd25519) [Bytes](/src/target/signature.go?s=1253:1295#L50) -``` go -func (sig SignatureEd25519) Bytes() []byte -``` - - - -### func (SignatureEd25519) [Equals](/src/target/signature.go?s=1520:1576#L58) -``` go -func (sig SignatureEd25519) Equals(other Signature) bool -``` - - - -### func (SignatureEd25519) [IsZero](/src/target/signature.go?s=1352:1393#L54) -``` go -func (sig SignatureEd25519) IsZero() bool -``` - - - -### func (SignatureEd25519) [MarshalJSON](/src/target/signature.go?s=1701:1756#L66) -``` go -func (p SignatureEd25519) MarshalJSON() ([]byte, error) -``` - - - -### func (SignatureEd25519) [String](/src/target/signature.go?s=1420:1463#L56) -``` go -func (sig SignatureEd25519) String() string -``` - - - -### func (\*SignatureEd25519) [UnmarshalJSON](/src/target/signature.go?s=1797:1855#L70) -``` go -func (p *SignatureEd25519) UnmarshalJSON(enc []byte) error -``` - - - -## type [SignatureS](/src/target/signature.go?s=648:685#L20) -``` go -type SignatureS struct { - Signature -} -``` -SignatureS add json serialization to Signature - - - - - - - - - - -### func (SignatureS) [Empty](/src/target/signature.go?s=966:998#L36) -``` go -func (p SignatureS) Empty() bool -``` - - - -### func (SignatureS) [MarshalJSON](/src/target/signature.go?s=687:736#L24) -``` go -func (p SignatureS) MarshalJSON() ([]byte, error) -``` - - - -### func (\*SignatureS) [UnmarshalJSON](/src/target/signature.go?s=780:839#L28) -``` go -func (p *SignatureS) UnmarshalJSON(data []byte) (err error) -``` - - - -## type [SignatureSecp256k1](/src/target/signature.go?s=2013:2043#L80) -``` go -type SignatureSecp256k1 []byte -``` -Implements Signature - - - - - - - - - - -### func (SignatureSecp256k1) [Bytes](/src/target/signature.go?s=2045:2089#L82) -``` go -func (sig SignatureSecp256k1) Bytes() []byte -``` - - - -### func (SignatureSecp256k1) [Equals](/src/target/signature.go?s=2318:2376#L90) -``` go -func (sig SignatureSecp256k1) Equals(other Signature) bool -``` - - - -### func (SignatureSecp256k1) [IsZero](/src/target/signature.go?s=2146:2189#L86) -``` go -func (sig SignatureSecp256k1) IsZero() bool -``` - - - -### func (SignatureSecp256k1) [MarshalJSON](/src/target/signature.go?s=2502:2559#L97) -``` go -func (p SignatureSecp256k1) MarshalJSON() ([]byte, error) -``` - - - -### func (SignatureSecp256k1) [String](/src/target/signature.go?s=2216:2261#L88) -``` go -func (sig SignatureSecp256k1) String() string -``` - - - -### func (\*SignatureSecp256k1) [UnmarshalJSON](/src/target/signature.go?s=2597:2657#L101) -``` go -func (p *SignatureSecp256k1) UnmarshalJSON(enc []byte) error -``` - - - - - - - -- - - -Generated by [godoc2md](http://godoc.org/github.com/davecheney/godoc2md) +## Importing it +`import "github.com/tendermint/go-crypto"` \ No newline at end of file