Skip to content
Snippets Groups Projects
Commit 582a0a1c authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Use the fastRNG instead of rand.Reader

parent 8eb016d2
No related branches found
No related tags found
3 merge requests!510Release,!207WIP: Client Restructure,!203Symmetric broadcast
...@@ -24,9 +24,11 @@ package cmix ...@@ -24,9 +24,11 @@ package cmix
import ( import (
"bytes" "bytes"
"crypto/rand"
"encoding/binary" "encoding/binary"
"fmt" "fmt"
"sync/atomic"
"time"
jww "github.com/spf13/jwalterweatherman" jww "github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/cmix/identity/receptionID/store" "gitlab.com/elixxir/client/cmix/identity/receptionID/store"
"gitlab.com/elixxir/client/stoppable" "gitlab.com/elixxir/client/stoppable"
...@@ -37,8 +39,6 @@ import ( ...@@ -37,8 +39,6 @@ import (
"gitlab.com/xx_network/crypto/csprng" "gitlab.com/xx_network/crypto/csprng"
"gitlab.com/xx_network/primitives/id" "gitlab.com/xx_network/primitives/id"
"gitlab.com/xx_network/primitives/netTime" "gitlab.com/xx_network/primitives/netTime"
"sync/atomic"
"time"
) )
const ( const (
...@@ -424,10 +424,12 @@ func (c *client) follow(report ClientErrorReport, rng csprng.Source, ...@@ -424,10 +424,12 @@ func (c *client) follow(report ClientErrorReport, rng csprng.Source,
// getFakeEarliestRound generates a random earliest round for a fake identity. // getFakeEarliestRound generates a random earliest round for a fake identity.
func (c *client) getFakeEarliestRound() id.Round { func (c *client) getFakeEarliestRound() id.Round {
b, err := csprng.Generate(8, rand.Reader) rng := c.rng.GetStream()
b, err := csprng.Generate(8, rng)
if err != nil { if err != nil {
jww.FATAL.Panicf("Could not get random number: %+v", err) jww.FATAL.Panicf("Could not get random number: %v", err)
} }
rng.Close()
rangeVal := binary.LittleEndian.Uint64(b) % 800 rangeVal := binary.LittleEndian.Uint64(b) % 800
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment