aboutsummaryrefslogtreecommitdiffstats
path: root/whisper/whisperv5/message_test.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2017-03-23 02:48:51 +0800
committerFelix Lange <fjl@twurst.com>2017-03-23 03:49:15 +0800
commitf1534f5797664856218c8347366488f37f1e7924 (patch)
tree6a5d4a7dcfd72489bd4f7df70f5188a636947c24 /whisper/whisperv5/message_test.go
parent9a2720fb35c9802c6dd61f9a49c48620b2ba2ecb (diff)
downloaddexon-f1534f5797664856218c8347366488f37f1e7924.tar.gz
dexon-f1534f5797664856218c8347366488f37f1e7924.tar.zst
dexon-f1534f5797664856218c8347366488f37f1e7924.zip
trie, whisper/whisperv5: use math/rand Read function
Diffstat (limited to 'whisper/whisperv5/message_test.go')
-rw-r--r--whisper/whisperv5/message_test.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/whisper/whisperv5/message_test.go b/whisper/whisperv5/message_test.go
index c6f1ca2ca..1ed7250d3 100644
--- a/whisper/whisperv5/message_test.go
+++ b/whisper/whisperv5/message_test.go
@@ -18,7 +18,7 @@ package whisperv5
import (
"bytes"
- "math/rand"
+ mrand "math/rand"
"testing"
"github.com/ethereum/go-ethereum/crypto"
@@ -34,13 +34,13 @@ func generateMessageParams() (*MessageParams, error) {
// set all the parameters except p.Dst
buf := make([]byte, 1024)
- randomize(buf)
- sz := rand.Intn(400)
+ mrand.Read(buf)
+ sz := mrand.Intn(400)
var p MessageParams
p.PoW = 0.01
p.WorkTime = 1
- p.TTL = uint32(rand.Intn(1024))
+ p.TTL = uint32(mrand.Intn(1024))
p.Payload = make([]byte, sz)
p.Padding = make([]byte, padSizeLimitUpper)
p.KeySym = make([]byte, aesKeyLength)
@@ -132,7 +132,7 @@ func TestMessageEncryption(t *testing.T) {
func TestMessageWrap(t *testing.T) {
seed = int64(1777444222)
- rand.Seed(seed)
+ mrand.Seed(seed)
target := 128.0
params, err := generateMessageParams()
@@ -168,7 +168,7 @@ func TestMessageWrap(t *testing.T) {
func TestMessageSeal(t *testing.T) {
// this test depends on deterministic choice of seed (1976726903)
seed = int64(1976726903)
- rand.Seed(seed)
+ mrand.Seed(seed)
params, err := generateMessageParams()
if err != nil {
@@ -179,8 +179,8 @@ func TestMessageSeal(t *testing.T) {
params.TTL = 1
aesnonce := make([]byte, 12)
salt := make([]byte, 12)
- randomize(aesnonce)
- randomize(salt)
+ mrand.Read(aesnonce)
+ mrand.Read(salt)
env := NewEnvelope(params.TTL, params.Topic, salt, aesnonce, msg)
if err != nil {