diff options
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() - } - } -} |