libgocryptfs/internal/contentenc/content_api.go
Jakob Unterwurzacher c74772bc8d Run go fmt
2016-02-06 20:23:36 +01:00

36 lines
725 B
Go

package contentenc
import "github.com/rfjakob/gocryptfs/internal/cryptocore"
const (
// Default plaintext block size
DefaultBS = 4096
)
type ContentEnc struct {
// Cryptographic primitives
cryptoCore *cryptocore.CryptoCore
// Plaintext block size
plainBS uint64
// Ciphertext block size
cipherBS uint64
// All-zero block of size cipherBS, for fast compares
allZeroBlock []byte
}
func New(cc *cryptocore.CryptoCore, plainBS uint64) *ContentEnc {
cipherBS := plainBS + uint64(cc.IVLen) + cryptocore.AuthTagLen
return &ContentEnc{
cryptoCore: cc,
plainBS: plainBS,
cipherBS: cipherBS,
allZeroBlock: make([]byte, cipherBS),
}
}
func (be *ContentEnc) PlainBS() uint64 {
return be.plainBS
}