diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-03-23 16:22:56 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-23 16:22:56 +0800 |
commit | 3fa0fa713bc1508835bdecd7dea78ff09803e327 (patch) | |
tree | 6a5d4a7dcfd72489bd4f7df70f5188a636947c24 /whisper/whisperv5/message.go | |
parent | 525116dbff916825463931361f75e75e955c12e2 (diff) | |
parent | f1534f5797664856218c8347366488f37f1e7924 (diff) | |
download | dexon-3fa0fa713bc1508835bdecd7dea78ff09803e327.tar dexon-3fa0fa713bc1508835bdecd7dea78ff09803e327.tar.gz dexon-3fa0fa713bc1508835bdecd7dea78ff09803e327.tar.bz2 dexon-3fa0fa713bc1508835bdecd7dea78ff09803e327.tar.lz dexon-3fa0fa713bc1508835bdecd7dea78ff09803e327.tar.xz dexon-3fa0fa713bc1508835bdecd7dea78ff09803e327.tar.zst dexon-3fa0fa713bc1508835bdecd7dea78ff09803e327.zip |
Merge pull request #3809 from fjl/all-use-normal-context
all: import "context" instead of "golang.org/x/net/context"
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() - } - } -} |