From e99e8417137a713348d2797ba813bcefe0c3984d Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Fri, 11 Dec 2015 19:54:53 +0100 Subject: Rmdir: handle creating and removing unreadable directories This patch also splits off Mkdir and Rmdir into its own file. Fixes issue #8, thanks to @diseq for the bug report. --- cryptfs/nonce.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'cryptfs') diff --git a/cryptfs/nonce.go b/cryptfs/nonce.go index 9bdbb09..a122ea5 100644 --- a/cryptfs/nonce.go +++ b/cryptfs/nonce.go @@ -1,6 +1,7 @@ package cryptfs import ( + "encoding/binary" "bytes" "crypto/rand" "encoding/hex" @@ -17,6 +18,12 @@ func RandBytes(n int) []byte { return b } +// Return a secure random uint64 +func RandUint64() uint64 { + b := RandBytes(8) + return binary.BigEndian.Uint64(b) +} + var gcmNonce nonce96 type nonce96 struct { -- cgit v1.2.3