Documentation ¶
Index ¶
- Constants
- func Blake2bKDF(key []byte, size uint32, salt, info []byte) ([]byte, error)
- func Blake2bMAC(key, data []byte) []byte
- func HMACSHA256(message, key []byte) []byte
- func Hash(contextInfo string, data []byte) ([]byte, error)
- func HashPassword(password, salt []byte) []byte
- func KDF(secret, salt, info []byte, keysNum, keySize int) ([][]byte, error)
- func SimplexHash(data []byte) []byte
- func ValidBlake2bMAC(message, messageMAC, key []byte) bool
- func ValidHMACSHA256(message, messageMAC, key []byte) bool
Constants ¶
const ( // MACSize represents the size of a 16 byte MAC. MACSize = 16 // KeySize represents the size of a 32 byte key. KeySize = 32 )
Variables ¶
This section is empty.
Functions ¶
func Blake2bKDF ¶
Blake2bKDF is a key derivation function. It's suitable to be used with keys with uniform entropy and not for use with passwords/passphrases. salt and info are optional and must be less than 64 bytes in total. NOTE: I SUGGEST NOT USING THIS - instead use HKDF-SHA256.
func Blake2bMAC ¶
Blake2bMAC is a MAC that uses Blake2b's keyed hash mechanism instead of an HMAC construction. The output is of size MACSize.
func HMACSHA256 ¶
HMACSHA256 returns the HMAC-SHA256 authentication code for the given message and key.
func Hash ¶
Hash hashes the data with contextInfo used as the key for blake2's keying mechanism. contextInfo is meant to be a human readable string that ensures each use case of the hash function will have different outputs.
func HashPassword ¶
HashPassword returns a 32 byte cryptographic key given a password and an entropic salt.
func KDF ¶
KDF returns a slice of derive keysNum number of derived keys of size keySize. The given secret must be a uniform entropy secret (ie not a password) and info is an optional non-secret which may be omitted.
Note: in practice you probably don't want to use this particular function but instead use the HKDF directly where you need it.
func SimplexHash ¶
SimplexHash is the simplest usage of a hash function and is suitable if you only have one use case.
func ValidBlake2bMAC ¶
ValidBlake2bMAC reports whether Blake2b messageMAC is a valid MAC tag for message.
func ValidHMACSHA256 ¶
ValidMAC reports whether messageMAC is a valid HMAC tag for message.
Types ¶
This section is empty.