crypto

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DigestSize    = 32
	PublicKeySize = 32
	SecretKeySize = 32
	SignatureSize = 64
)

Variables

This section is empty.

Functions

func GenerateKeyPair

func GenerateKeyPair(seed []byte) (SecretKey, PublicKey)

func Verify

func Verify(publicKey PublicKey, signature Signature, data []byte) bool

Types

type Digest

type Digest [DigestSize]byte

func FastHash

func FastHash(data []byte) (Digest, error)

func Keccak256

func Keccak256(data []byte) Digest

func NewDigestFromBase58

func NewDigestFromBase58(s string) (Digest, error)

func SecureHash

func SecureHash(data []byte) (Digest, error)

func (Digest) MarshalBinary

func (d Digest) MarshalBinary() ([]byte, error)

func (Digest) MarshalJSON

func (d Digest) MarshalJSON() ([]byte, error)

func (Digest) String

func (d Digest) String() string

func (*Digest) UnmarshalBinary

func (d *Digest) UnmarshalBinary(data []byte) error

func (*Digest) UnmarshalJSON

func (d *Digest) UnmarshalJSON(value []byte) error

type PublicKey

type PublicKey [PublicKeySize]byte

func GeneratePublicKey

func GeneratePublicKey(sk SecretKey) PublicKey

func NewPublicKeyFromBase58

func NewPublicKeyFromBase58(s string) (PublicKey, error)

func (PublicKey) MarshalBinary

func (k PublicKey) MarshalBinary() ([]byte, error)

func (PublicKey) MarshalJSON

func (k PublicKey) MarshalJSON() ([]byte, error)

func (*PublicKey) UnmarshalBinary

func (k *PublicKey) UnmarshalBinary(data []byte) error

func (*PublicKey) UnmarshalJSON

func (k *PublicKey) UnmarshalJSON(value []byte) error

type SecretKey

type SecretKey [SecretKeySize]byte

func GenerateSecretKey

func GenerateSecretKey(seed []byte) SecretKey

func NewSecretKeyFromBase58

func NewSecretKeyFromBase58(s string) (SecretKey, error)

func (SecretKey) MarshalBinary

func (k SecretKey) MarshalBinary() ([]byte, error)

func (SecretKey) MarshalJSON

func (k SecretKey) MarshalJSON() ([]byte, error)

func (SecretKey) String added in v0.1.2

func (k SecretKey) String() string

func (*SecretKey) UnmarshalBinary

func (k *SecretKey) UnmarshalBinary(data []byte) error

func (*SecretKey) UnmarshalJSON

func (k *SecretKey) UnmarshalJSON(value []byte) error

type Signature

type Signature [SignatureSize]byte

func NewSignatureFromBase58

func NewSignatureFromBase58(s string) (Signature, error)

func Sign

func Sign(secretKey SecretKey, data []byte) Signature

func (Signature) MarshalBinary

func (s Signature) MarshalBinary() ([]byte, error)

func (Signature) MarshalJSON

func (s Signature) MarshalJSON() ([]byte, error)

func (Signature) String added in v0.1.2

func (s Signature) String() string

func (*Signature) UnmarshalBinary

func (s *Signature) UnmarshalBinary(data []byte) error

func (*Signature) UnmarshalJSON

func (s *Signature) UnmarshalJSON(value []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL