diff options
Diffstat (limited to 'internal/contentenc')
| -rw-r--r-- | internal/contentenc/content.go | 6 | ||||
| -rw-r--r-- | internal/contentenc/intrablock.go | 14 | 
2 files changed, 12 insertions, 8 deletions
| diff --git a/internal/contentenc/content.go b/internal/contentenc/content.go index 2298c5e..6ac766f 100644 --- a/internal/contentenc/content.go +++ b/internal/contentenc/content.go @@ -40,10 +40,16 @@ func New(cc *cryptocore.CryptoCore, plainBS uint64) *ContentEnc {  	}  } +// PlainBS returns the plaintext block size  func (be *ContentEnc) PlainBS() uint64 {  	return be.plainBS  } +// CipherBS returns the ciphertext block size +func (be *ContentEnc) CipherBS() uint64 { +	return be.cipherBS +} +  // DecryptBlocks - Decrypt a number of blocks  func (be *ContentEnc) DecryptBlocks(ciphertext []byte, firstBlockNo uint64, fileId []byte) ([]byte, error) {  	cBuf := bytes.NewBuffer(ciphertext) diff --git a/internal/contentenc/intrablock.go b/internal/contentenc/intrablock.go index 330b980..ec9562d 100644 --- a/internal/contentenc/intrablock.go +++ b/internal/contentenc/intrablock.go @@ -16,16 +16,14 @@ func (ib *intraBlock) IsPartial() bool {  	return false  } -// CiphertextRange - get byte range in ciphertext file corresponding to BlockNo -// (complete block) -func (ib *intraBlock) CiphertextRange() (offset uint64, length uint64) { -	return ib.fs.BlockNoToCipherOff(ib.BlockNo), ib.fs.cipherBS +// BlockCipherOff returns the ciphertext offset corresponding to BlockNo +func (ib *intraBlock) BlockCipherOff() (offset uint64) { +	return ib.fs.BlockNoToCipherOff(ib.BlockNo)  } -// PlaintextRange - get byte range in plaintext corresponding to BlockNo -// (complete block) -func (ib *intraBlock) PlaintextRange() (offset uint64, length uint64) { -	return ib.fs.BlockNoToPlainOff(ib.BlockNo), ib.fs.plainBS +// BlockPlainOff returns the plaintext offset corresponding to BlockNo +func (ib *intraBlock) BlockPlainOff() (offset uint64) { +	return ib.fs.BlockNoToPlainOff(ib.BlockNo)  }  // CropBlock - crop a potentially larger plaintext block down to the relevant part | 
