Documentation ¶
Index ¶
- Variables
- func Checksum(data []byte) []byte
- func CompareChecksum(hash, pass []byte) bool
- func Decrypt(ct []byte, key []byte) (clt []byte, err error)
- func DeriveKey(pw []byte, salt []byte) (key []byte)
- func Encrypt(src []byte, key []byte) (enc []byte, err error)
- func PassChecksum(data []byte) []byte
- func RandBytes(len int) []byte
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoNonce = fmt.Errorf("ciphertext smaller than nonce")
Functions ¶
func Checksum ¶
Checksum wraps the sha256.Sum256 method to return a []byte instead of a [32]byte array.
func CompareChecksum ¶
func Decrypt ¶
Decrypt decrypts ct with key with the AES encryption algorithm. It automatically extracts the salt from the ct.
func DeriveKey ¶
DeriveKey generates an AES algorithm key from pw, using the SHA-256 hash algorithm and the provided salt.
func Encrypt ¶
Encrypt encrypts src with key using the AES encryption algorithm. It automatically generates a random salt and appends to the front of the ciphertext.
func PassChecksum ¶
Checksum wraps the bcrypt.GenerateFromPassword method and returns the data's checksum.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.