util

package
v0.0.0-...-c953a64 Latest Latest
Warning

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

Go to latest
Published: May 29, 2020 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(slice []string, value string) bool

Contains will check a given []string to see if a value is inside of it, and returns true if so and false if not.

func CreateHash

func CreateHash(toHash []byte) string

CreateHash will return a hashed string of a given string

func Decrypt

func Decrypt(ciphertext []byte, key []byte) (plaintext []byte, err error)

Decrypt decrypts data using 256-bit AES-GCM. This both hides the content of the data and provides a check that it hasn't been altered. Expects input form nonce|ciphertext|tag where '|' indicates concatenation.

func Encrypt

func Encrypt(plaintext []byte, key []byte) (ciphertext []byte, err error)

Encrypt encrypts data using 256-bit AES-GCM. This both hides the content of the data and provides a check that it hasn't been altered. Output takes the form nonce|ciphertext|tag where '|' indicates concatenation.

func NewEncryptionKey

func NewEncryptionKey() []byte

NewEncryptionKey generates a random 256-bit key for Encrypt() and Decrypt().

func ValidateHostName

func ValidateHostName(name string) (bool, error)

ValidateHostName will use regex to determine if the given URL or IP address is valid.

Types

This section is empty.

Jump to

Keyboard shortcuts

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