aboutsummaryrefslogtreecommitdiff
path: root/cryptfs/kdf.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-11-29 21:41:38 +0100
committerJakob Unterwurzacher2015-11-29 21:41:38 +0100
commit20b058a33335f48812864513cc13ea0a276aaaa3 (patch)
tree60baeaf7f3fe89e896a3a84a934079769d865215 /cryptfs/kdf.go
parent1d0a442405e8fc7a0742a8f8db2ea0f874f750a5 (diff)
Add single-element cache for DirIV lookup
Another 3x performance boost for applications that walk the directory tree. Excerpt from performance.txt: VERSION UNTAR LS RM v0.4 48 1.5 5 v0.5-rc1 56 7 19 v0.5-rc1-1 54 4.1 9 v0.5-rc1-2 45 1.7 3.4 <---- THIS VERSION
Diffstat (limited to 'cryptfs/kdf.go')
-rw-r--r--cryptfs/kdf.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/cryptfs/kdf.go b/cryptfs/kdf.go
index 73be0bb..db08500 100644
--- a/cryptfs/kdf.go
+++ b/cryptfs/kdf.go
@@ -1,10 +1,10 @@
package cryptfs
import (
- "os"
- "math"
"fmt"
"golang.org/x/crypto/scrypt"
+ "math"
+ "os"
)
const (
@@ -50,5 +50,5 @@ func (s *scryptKdf) DeriveKey(pw string) []byte {
// LogN - N is saved as 2^LogN, but LogN is much easier to work with.
// This function gives you LogN = Log2(N).
func (s *scryptKdf) LogN() int {
- return int(math.Log2(float64(s.N))+0.5)
+ return int(math.Log2(float64(s.N)) + 0.5)
}