diff options
author | Felix Lange <fjl@twurst.com> | 2017-03-23 02:48:51 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2017-03-23 03:49:15 +0800 |
commit | f1534f5797664856218c8347366488f37f1e7924 (patch) | |
tree | 6a5d4a7dcfd72489bd4f7df70f5188a636947c24 /whisper/whisperv5/message.go | |
parent | 9a2720fb35c9802c6dd61f9a49c48620b2ba2ecb (diff) | |
download | dexon-f1534f5797664856218c8347366488f37f1e7924.tar dexon-f1534f5797664856218c8347366488f37f1e7924.tar.gz dexon-f1534f5797664856218c8347366488f37f1e7924.tar.bz2 dexon-f1534f5797664856218c8347366488f37f1e7924.tar.lz dexon-f1534f5797664856218c8347366488f37f1e7924.tar.xz dexon-f1534f5797664856218c8347366488f37f1e7924.tar.zst dexon-f1534f5797664856218c8347366488f37f1e7924.zip |
trie, whisper/whisperv5: use math/rand Read function
Diffstat (limited to 'whisper/whisperv5/message.go')
-rw-r--r-- | whisper/whisperv5/message.go | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/whisper/whisperv5/message.go b/whisper/whisperv5/message.go index 9677f278e..5f964b072 100644 --- a/whisper/whisperv5/message.go +++ b/whisper/whisperv5/message.go @@ -128,7 +128,7 @@ func (msg *SentMessage) appendPadding(params *MessageParams) { panic("please fix the padding algorithm before releasing new version") } buf := make([]byte, padSize) - randomize(buf[1:]) + mrand.Read(buf[1:]) buf[0] = byte(padSize) if params.Padding != nil { copy(buf[1:], params.Padding) @@ -365,19 +365,3 @@ func (msg *ReceivedMessage) hash() []byte { } return crypto.Keccak256(msg.Raw) } - -// rand.Rand provides a Read method in Go 1.7 and later, -// but we can't use it yet. -func randomize(b []byte) { - cnt := 0 - val := mrand.Int63() - for n := 0; n < len(b); n++ { - b[n] = byte(val) - val >>= 8 - cnt++ - if cnt >= 7 { - cnt = 0 - val = mrand.Int63() - } - } -} |