Documentation ¶
Overview ¶
Package crypto provides some convenient methods to compute hashes and to generate cryptographic keys.
Index ¶
- Variables
- func EncodeKey(ultKey *ULTKey) string
- func GetAccountKeypair() (string, string, error)
- func GetAccountKeypairFromSeed(seed []byte) (string, string, error)
- func GetNodeKeypair() (string, string, error)
- func GetOfferID() (string, error)
- func IsValidAccountKey(key string) bool
- func IsValidKey(key string) bool
- func IsValidTxKey(key string) bool
- func SHA256Hash(b []byte) string
- func SHA256HashBytes(b []byte) [32]byte
- func SHA256HashUint64(b []byte) uint64
- func Sign(seed string, data []byte) (string, error)
- func Verify(publicKey, signature string, data []byte) bool
- func VerifyByKey(pk *ULTKey, signature string, data []byte) bool
- type KeyType
- type ULTKey
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrInvalidKey = errors.New("invalid key string")
)
Functions ¶
func GetAccountKeypair ¶
Randomly generate a pair of account public and private key.
func GetAccountKeypairFromSeed ¶
Generate account keypair from provided seed.
func GetNodeKeypair ¶
Randomly generate a pair of node public and private key.
func IsValidAccountKey ¶
Check the validity of supplied acount key string.
func IsValidTxKey ¶
Check the validity of supplied tx key string.
func SHA256Hash ¶
Compute sha256 checksum (32 bytes) and return a string.
func SHA256HashBytes ¶
Compute sha256 checksum (32 bytes) and return a byte array.
func SHA256HashUint64 ¶
Compute sha256 checksum and generate a uint64 number.
Types ¶
Click to show internal directories.
Click to hide internal directories.