Documentation
¶
Index ¶
- func DecodedHash(s string) ([]byte, error)
- func DecryptAES256(key []byte, securemess []byte) (decodedmess []byte, err error)
- func DecryptMessage(message []byte, passPhrase string) ([]byte, error)
- func EncodedHash(s string) string
- func EncryptAES256(key []byte, plaintext []byte) (encmess []byte, err error)
- func EncryptMessage(message []byte, passPhrase string) ([]byte, error)
- func FNV32a(text string) uint32
- func GenerateRecoveryPassword(answers []string, salt []byte) string
- func Hash(s string) []byte
- func IndexFromString(text string) uint32
- func SecureRandomStr(length int) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodedHash ¶
DecodedHash returns the decoded hash of the given hex string
func DecryptAES256 ¶
DecryptAES256 ....
func DecryptMessage ¶
DecryptMessage decrypts an encrypted message using a password
func EncodedHash ¶
EncodedHash returns the hex encoded hash of the given string
func EncryptAES256 ¶
EncryptAES256 encrypts a message using AES-256-GCM
key is the encryption key (must be 32 bytes) message is the string to be encrypted returns the (b64 encoded) encrypted message, or an error if the key is not 32 bytes
func EncryptMessage ¶
EncryptMessage encrypts a message using a password
func GenerateRecoveryPassword ¶
GenerateRecoveryPassword derives a strong key from a security answer using PBKDF2-HMAC-SHA256. The salt is unique per key (randomly generated at setup time and persisted in config), preventing cross-key rainbow table attacks. 600 000 iterations matches the OWASP 2023 recommendation for PBKDF2-HMAC-SHA256, making offline brute-force expensive.
func IndexFromString ¶
IndexFromString returns the unique (hash) index of an arbitrary string
func SecureRandomStr ¶
SecureRandomStr returns a random string of the given length
length: the length of the string to return returns: a random string of the given length error: if an error occurs notes: uses crypto/rand to generate random bytes
Types ¶
This section is empty.