Documentation
¶
Overview ¶
Package crypto implements functions for hashing, encrypting, and decrypting data.
Encryption, and decryption uses the underlying crypto/aes, crypto/cipher,and crypto/rand packages from the stdlib.
Hashing is supported via use of the speps/go-hashids library.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckCSPRNG ¶
func CheckCSPRNG()
CheckCSPRNG will see if it's possible to generate a cryptographically secure pseudorandom number. If not then this will panic.
Types ¶
type AESGCM ¶ added in v1.1.0
type AESGCM struct {
// contains filtered or unexported fields
}
AESGCM provides authenticated encryption using AES as the cipher wrapped in Galois Counter Mode.
func NewAESGCM ¶ added in v1.1.0
NewAESGCM returns a new block cipher for authenticated encryption. This derives a HMAC-SHA-256 based PBKDF2 key from the given password and salt.
type Hasher ¶
type Hasher struct { // Salt is the additional data to use when generating a hash. Salt string // Length is the minimum length of hashes that should be generated. Length int // Alphabet is the sequence of characters that should be chosen from when a // hash is being generated. If empty then the default a-zA-Z0-9 alphabet // will be used. Alphabet string // contains filtered or unexported fields }
Hasher is the type for generating hash ids based on a sequence of numbers, based on the specified alphabet and length.
func (*Hasher) Hash ¶
Hash returns the hash of the given numbers. This will return an error if the Hasher has not yet been initialized, or any other underlying errors from hashing.