aboutsummaryrefslogtreecommitdiff
path: root/cryptfs
diff options
context:
space:
mode:
Diffstat (limited to 'cryptfs')
-rw-r--r--cryptfs/nonce.go7
1 files changed, 7 insertions, 0 deletions
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 {