Documentation ¶
Index ¶
- func Decrypt(ciphertext []byte, key []byte) (plaintext []byte, err error)
- func DecryptFromHex(hexCiphertext string, hexKey string) ([]byte, error)
- func Encrypt(plaintext []byte, key []byte) (ciphertext []byte, err error)
- func EncryptAndHex(plaintext []byte, hexKey string) (string, error)
- func GenerateHMAC(data []byte, key []byte) []byte
- func GenerateHMACFromHex(data []byte, hexKey string) (string, error)
- func GenerateRandomStringFromLetters(length int, letterRunes []rune) string
- func NewEncryptionKey() (*[32]byte, error)
- func NewEncryptionKeyInHex() (string, error)
- func VerifyHMAC(data []byte, key []byte, suppliedMAC []byte) bool
- func VerifyHMACFromHex(data []byte, hexKey string, suppliedHexMAC string) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateHMAC ¶
GenerateHMAC produces a SHA-512/256 hash using 256-bit key
func GenerateHMACFromHex ¶
GenerateHMACFromHex produces a SHA-512/256 hash using 256-bit key
func GenerateRandomStringFromLetters ¶ added in v0.11.2
GenerateRandomStringFromLetters generates a random string of the given length using the provided runes this function panics if - the provided length is less than 1 - if the provided runes are empty - if os fails to read random bytes
func NewEncryptionKey ¶
NewEncryptionKey generates a random 256-bit key
func NewEncryptionKeyInHex ¶
func VerifyHMAC ¶
VerifyHMAC checks the supplied MAC against the hash of the data using the key
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.