Documentation
¶
Index ¶
Constants ¶
View Source
const ( // KeySize is the size of the key in bytes (AES-256) KeySize = 32 // SaltSize is the size of the salt in bytes SaltSize = 16 // Iterations is the number of iterations for PBKDF2 Iterations = 100000 )
Variables ¶
This section is empty.
Functions ¶
func DeriveKey ¶
DeriveKey derives a 32-byte key from a password and salt using PBKDF2. If salt is nil, a new random salt is generated. Returns the key and the salt used.
func Encrypt ¶
Encrypt encrypts data using AES-GCM. Returns base64 encoded string containing nonce and ciphertext.
func GenerateRandomBytes ¶
GenerateRandomBytes returns n random bytes.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.