Documentation
¶
Index ¶
- Variables
- func Decrypt(data, secret string, passwordBased bool, config CipherConfig) (string, error)
- func Encrypt(data, secret string, passwordBased bool, config CipherConfig) (string, error)
- func GenerateRandomBytes(length int) ([]byte, error)
- func PasswordHash(password string, cost int) (string, error)
- func PasswordVerify(password, hash string) bool
- type AES
- type CipherConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultCipherConfig = CipherConfig{ Cipher: "AES-128-CBC", AllowedCiphers: map[string][]int{ "AES-128-CBC": {16, 16}, "AES-192-CBC": {16, 24}, "AES-256-CBC": {16, 32}, }, KdfHash: "sha256", MacHash: "sha256", AuthKeyInfo: "AuthorizationKey", DerivationIterations: 100000, }
DefaultCipherConfig is the default cipher configuration
Functions ¶
func Decrypt ¶
func Decrypt(data, secret string, passwordBased bool, config CipherConfig) (string, error)
Decrypt decrypts data using a password or a key
func Encrypt ¶
func Encrypt(data, secret string, passwordBased bool, config CipherConfig) (string, error)
Encrypt encrypts data using a password or a key
func GenerateRandomBytes ¶
GenerateRandomBytes generates random bytes of specified length
func PasswordHash ¶
PasswordHash generates a hash of the password
func PasswordVerify ¶
PasswordVerify validates the password against a given hash
Types ¶
Click to show internal directories.
Click to hide internal directories.