No need for errors, as cipher block will always be valid

This commit is contained in:
Tobie Morgan Hitchcock 2016-08-28 09:28:53 +01:00
parent 25d9927be2
commit 629bd7dd92

View file

@ -33,10 +33,7 @@ func Encrypt(key []byte, src []byte) (dst []byte, err error) {
}
// Initiate cipher
cipher, err := cipher.NewGCM(block)
if err != nil {
return
}
cipher, _ := cipher.NewGCM(block)
nonce := rand.New(12)
@ -61,10 +58,7 @@ func Decrypt(key []byte, src []byte) (dst []byte, err error) {
}
// Initiate cipher
cipher, err := cipher.NewGCM(block)
if err != nil {
return
}
cipher, _ := cipher.NewGCM(block)
return cipher.Open(nil, src[:12], src[12:], nil)