// Encrypt encrypts data using the passphrase.
Encrypt encrypts data using the passphrase.
// Encrypt encrypts data using the passphrase .
func Encrypt(data []byte, passphrase string) ([]byte, error) {
	block, err := aes.NewCipher(createHash(passphrase))
	if err != nil {
		return []byte{}, err
	}
	gcm, err := cipher.NewGCM(block)
	if err != nil {
		return []byte{}, err
	}
	nonce := make([]byte, gcm.NonceSize())
	if _, err = io.ReadFull(rand.Reader, nonce); err != nil {
		return []byte{}, err
	}
	ciphered := gcm.Seal(nonce, nonce, data, nil)
	return ciphered, nil
}
func Encrypt ( data [ ] byte , passphrase string ) ( [ ] byte , error ) { block , err := aes . NewCipher ( createHash ( passphrase ) ) if err != nil { return [ ] byte { } , err } gcm , err := cipher . NewGCM ( block ) if err != nil { return [ ] byte { } , err } nonce := make ( [ ] byte , gcm . NonceSize ( ) ) if _ , err = io . ReadFull ( rand . Reader , nonce ) ; err != nil { return [ ] byte { } , err } ciphered := gcm . Seal ( nonce , nonce , data , nil ) return ciphered , nil }
Encrypt encrypts data using the passphrase.
Encrypt encrypts data using the passphrase .