Documentation ¶
Overview ¶
Package crypto implements cryptographic types and functions used to prove integrity and ownership.
Index ¶
Constants ¶
const ADDR_BYTE_SIZE = 32
ADDR_BYTE_SIZE is the length of the Address in bytes
const HASH_BYTE_SIZE = 32
HASH_BYTE_SIZE is the hash length in bytes used by the Hash type.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address [ADDR_BYTE_SIZE]uint8
An Address is used to publicly identify a Blockchain account
func AddressFromBytes ¶
AddressFromBytes returns an Address given a HASH_BYTE_SIZE byte slice.
func AddressFromString ¶
AddressFromString returns an Address given a (HASH_BYTE_SIZE * 8) bits hexadecimal address string.
type Hash ¶
type Hash [HASH_BYTE_SIZE]uint8
A Hash is a wrapper around the output of a (HASH_BYTE_SIZE * 8) bits hash function.
func HashFromBytes ¶
HashFromBytes returns a Hash given a HASH_BYTE_SIZE byte slice.
func HashFromString ¶
HashFromString returns a Hash given a (HASH_BYTE_SIZE * 8) bits hexadecimal hash string.
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
A PrivateKey is used for signing objects.
func GeneratePrivateKey ¶
func GeneratePrivateKey() (PrivateKey, error)
GeneratePrivateKey returns a PrivateKey randomized using cryptographically secure entropy.
func NewPrivateKeyFromReader ¶
func NewPrivateKeyFromReader(r io.Reader) (PrivateKey, error)
NewPrivateKeyFromReader returns a random PrivateKey from a io.Reader entropy.
func (PrivateKey) PublicKey ¶
func (k PrivateKey) PublicKey() PublicKey
PublicKey returns the PublicKey of the PrivateKey.
type PublicKey ¶
type PublicKey []byte
PublicKey is used to verify a PrivateKey signature.