aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/utils.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/common/utils.go b/common/utils.go
index 63d25a3..e46b3e9 100644
--- a/common/utils.go
+++ b/common/utils.go
@@ -19,3 +19,13 @@ func NewRandomHash() Hash {
}
return x
}
+
+// GenerateRandomBytes generates bytes randomly.
+func GenerateRandomBytes() []byte {
+ randomness := make([]byte, 32)
+ _, err := rand.Read(randomness)
+ if err != nil {
+ panic(err)
+ }
+ return randomness
+}