Documentation ¶
Index ¶
- func DecryptAES(encrypted, key, iv string) (string, error)
- func EncryptAES(plaintext, key, iv string) (string, error)
- func GenerateAESIV() (string, error)
- func GenerateAESKey() (string, error)
- func GeneratePasswd(opts *GeneratePasswdOpts) (string, error)
- func HashArgon2(plaintext string) (encodedhash string, err error)
- func VerifyArgon2(plaintext, encodedhash string) (match bool, err error)
- type Argon2Params
- type GeneratePasswdOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecryptAES ¶
DecryptAES decrypts the provided base64-encoded ciphertext using AES decryption with the given key and initialization vector (IV). It returns the decrypted plaintext as a string.
func EncryptAES ¶
EncryptAES encrypts the provided plaintext using AES encryption with the given key and initialization vector (IV). It returns the encrypted ciphertext as a base64-encoded string.
func GenerateAESIV ¶
GenerateAESIV generates a random AES initialization vector (IV) and returns it as a base64-encoded string.
func GenerateAESKey ¶
GenerateAESKey generates a random AES encryption key and returns it as a base64-encoded string.
func GeneratePasswd ¶
func GeneratePasswd(opts *GeneratePasswdOpts) (string, error)
GeneratePasswd generates a random password based on the provided options. It returns the generated password as a string.
func HashArgon2 ¶
HashArgon2 computes the Argon2 hash of the given plaintext password. It returns the encoded hash as a string.
func VerifyArgon2 ¶
VerifyArgon2 verifies the given plaintext password against the provided encoded hash. It returns true if the password matches the hash, and false otherwise.
Types ¶
type Argon2Params ¶
type Argon2Params struct {
// contains filtered or unexported fields
}
Argon2Params defines the parameters for Argon2 hashing.
type GeneratePasswdOpts ¶
type GeneratePasswdOpts struct { Lowercase bool // Include lowercase characters in the generated password. Uppercase bool // Include uppercase characters in the generated password. Numbers bool // Include numeric characters in the generated password. Symbols bool // Include symbol characters in the generated password. Length int // Length of the generated password. }
GeneratePasswdOpts defines the options for password generation.