summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2021-02-24 18:23:17 -0500
committerrsiddharth <s@ricketyspace.net>2021-02-24 18:23:17 -0500
commit3d5ecc3132577308636bea80922c74505eec93f0 (patch)
tree3abe10443b27d7ea116cb4cb3be88ebe08315617 /lib
parentd8272421760fd310f1f2e237f5c5d48952d3a4ef (diff)
lib: RandomKey -> RandomBytes
Diffstat (limited to 'lib')
-rw-r--r--lib/oracle.go8
-rw-r--r--lib/rand.go2
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/oracle.go b/lib/oracle.go
index e2ee5fe..4def7e2 100644
--- a/lib/oracle.go
+++ b/lib/oracle.go
@@ -14,12 +14,12 @@ var oracleRandom []byte
func init() {
var err error
- oracleKey, err = RandomKey(16)
+ oracleKey, err = RandomBytes(16)
if err != nil {
panic(err)
}
- oracleRandom, err = RandomKey(int(RandomInt(1, 4096)))
+ oracleRandom, err = RandomBytes(int(RandomInt(1, 4096)))
if err != nil {
panic(err)
}
@@ -30,12 +30,12 @@ func init() {
// cipher.
func OracleAESRandomEncrypt(in []byte) []byte {
// Generate random key.
- key, err := RandomKey(16)
+ key, err := RandomBytes(16)
if err != nil {
panic(err)
}
// Generate random initialization vector; needed for AES CBC.
- iv, err := RandomKey(16)
+ iv, err := RandomBytes(16)
if err != nil {
panic(err)
}
diff --git a/lib/rand.go b/lib/rand.go
index 03fd651..8546948 100644
--- a/lib/rand.go
+++ b/lib/rand.go
@@ -27,7 +27,7 @@ func RandomInt(min, max int64) int64 {
}
}
-func RandomKey(size int) ([]byte, error) {
+func RandomBytes(size int) ([]byte, error) {
k := make([]byte, size)
_, err := rand.Read(k)
if err != nil {