From a7f12ca1797f0e1192204825a829307a7cfd764e Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Mon, 29 Apr 2019 17:58:37 -0600 Subject: [PATCH] need to export encryption --- src/crypt/crypt.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/crypt/crypt.go b/src/crypt/crypt.go index 2be57936..b64b9bc6 100644 --- a/src/crypt/crypt.go +++ b/src/crypt/crypt.go @@ -9,15 +9,15 @@ import ( "golang.org/x/crypto/pbkdf2" ) -type encryption struct { +type Encryption struct { key []byte passphrase []byte salt []byte } -// New generates a new encryption, using the supplied passphrase and +// New generates a new Encryption, using the supplied passphrase and // an optional supplied salt. -func New(passphrase []byte, salt []byte) (e encryption, err error) { +func New(passphrase []byte, salt []byte) (e Encryption, err error) { e.passphrase = passphrase if salt == nil { e.salt = make([]byte, 8) @@ -31,12 +31,12 @@ func New(passphrase []byte, salt []byte) (e encryption, err error) { return } -func (e encryption) Salt() []byte { +func (e Encryption) Salt() []byte { return e.salt } -// Encrypt will generate an encryption, prefixed with the IV -func (e encryption) Encrypt(plaintext []byte) (encrypted []byte, err error) { +// Encrypt will generate an Encryption, prefixed with the IV +func (e Encryption) Encrypt(plaintext []byte) (encrypted []byte, err error) { // generate a random iv each time // http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf // Section 8.2 @@ -55,8 +55,8 @@ func (e encryption) Encrypt(plaintext []byte) (encrypted []byte, err error) { return } -// Decrypt an encryption -func (e encryption) Decrypt(encrypted []byte) (plaintext []byte, err error) { +// Decrypt an Encryption +func (e Encryption) Decrypt(encrypted []byte) (plaintext []byte, err error) { b, err := aes.NewCipher(e.key) if err != nil { return