summaryrefslogtreecommitdiff
path: root/cryptfs/cryptfs_names.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-10-04 14:36:20 +0200
committerJakob Unterwurzacher2015-10-04 14:49:47 +0200
commit89fef80d32708874c95742db0a7b593bcfd3b31d (patch)
treeadffeac51b1e945e32583b07ab0328a3c2539aad /cryptfs/cryptfs_names.go
parent5bd08abf4095fb553355c9b007c8ae4a4314b970 (diff)
Run go fmt
Diffstat (limited to 'cryptfs/cryptfs_names.go')
-rw-r--r--cryptfs/cryptfs_names.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/cryptfs/cryptfs_names.go b/cryptfs/cryptfs_names.go
index f694fa5..5476b17 100644
--- a/cryptfs/cryptfs_names.go
+++ b/cryptfs/cryptfs_names.go
@@ -3,12 +3,12 @@ package cryptfs
// Filename encryption / decryption function
import (
- "crypto/cipher"
"crypto/aes"
- "fmt"
- "strings"
+ "crypto/cipher"
"encoding/base64"
"errors"
+ "fmt"
+ "strings"
)
const (
@@ -30,7 +30,7 @@ func (be *CryptFS) decryptName(cipherName string) (string, error) {
return "", err
}
- if len(bin) % aes.BlockSize != 0 {
+ if len(bin)%aes.BlockSize != 0 {
return "", errors.New(fmt.Sprintf("Name len=%d is not a multiple of 16", len(bin)))
}
@@ -120,7 +120,7 @@ func (be *CryptFS) pad16(orig []byte) (padded []byte) {
if oldLen == 0 {
panic("Padding zero-length string makes no sense")
}
- padLen := aes.BlockSize - oldLen % aes.BlockSize
+ padLen := aes.BlockSize - oldLen%aes.BlockSize
if padLen == 0 {
padLen = aes.BlockSize
}
@@ -137,11 +137,11 @@ func (be *CryptFS) pad16(orig []byte) (padded []byte) {
// unPad16 - remove padding
func (be *CryptFS) unPad16(orig []byte) ([]byte, error) {
oldLen := len(orig)
- if oldLen % aes.BlockSize != 0 {
+ if oldLen%aes.BlockSize != 0 {
return nil, errors.New("Unaligned size")
}
// The last byte is always a padding byte
- padByte := orig[oldLen -1]
+ padByte := orig[oldLen-1]
// The padding byte's value is the padding length
padLen := int(padByte)
// Padding must be at least 1 byte