summaryrefslogtreecommitdiff
path: root/cryptfs/cryptfs_content.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-10-04 11:03:40 +0200
committerJakob Unterwurzacher2015-10-04 11:03:40 +0200
commit5229b8f5f5ef8d3e91fe2ab1f415131337161577 (patch)
treeb0dfbb015ef7ffacee9f275afb98c50d3ef5c4ec /cryptfs/cryptfs_content.go
parentfa887417708484eee03daf423a96d024960ed524 (diff)
Add BlockNoPlainOff() and BlockNoCipherOff() + test
Also, fix key, it is now []byte, not [16]byte
Diffstat (limited to 'cryptfs/cryptfs_content.go')
-rw-r--r--cryptfs/cryptfs_content.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/cryptfs/cryptfs_content.go b/cryptfs/cryptfs_content.go
index a903e02..ab5ec78 100644
--- a/cryptfs/cryptfs_content.go
+++ b/cryptfs/cryptfs_content.go
@@ -219,3 +219,13 @@ func (be *CryptFS) MergeBlocks(oldData []byte, newData []byte, offset int) []byt
}
return out[0:outLen]
}
+
+// Get the block number at plain-text offset
+func (be *CryptFS) BlockNoPlainOff(plainOffset uint64) uint64 {
+ return plainOffset / be.plainBS
+}
+
+// Get the block number at ciphter-text offset
+func (be *CryptFS) BlockNoCipherOff(cipherOffset uint64) uint64 {
+ return cipherOffset / be.cipherBS
+}