Skip to content
Snippets Groups Projects
Commit 00ae3089 authored by Benjamin Wenger's avatar Benjamin Wenger
Browse files

Merge branch 'XX-3833/rng' into 'release'

Use the fastRNG instead of rand.Reader

See merge request !198
parents ac5fc84b fe8bcb0b
No related branches found
No related tags found
3 merge requests!233Modify restore to call user-defined bindings callback. Add Sent requests to...,!231Revert "Update store to print changes to the partners list",!198Use the fastRNG instead of rand.Reader
......@@ -11,9 +11,12 @@ package network
// and intraclient state are accessible through the context object.
import (
"crypto/rand"
"encoding/binary"
"fmt"
"math"
"sync/atomic"
"time"
"github.com/pkg/errors"
jww "github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/interfaces"
......@@ -34,9 +37,6 @@ import (
"gitlab.com/xx_network/crypto/csprng"
"gitlab.com/xx_network/primitives/id"
"gitlab.com/xx_network/primitives/ndf"
"math"
"sync/atomic"
"time"
)
// fakeIdentityRange indicates the range generated between
......@@ -266,10 +266,12 @@ func (m *manager) SetFakeEarliestRound(rnd id.Round) {
// GetFakeEarliestRound generates a random earliest round for a fake identity.
func (m *manager) GetFakeEarliestRound() id.Round {
b, err := csprng.Generate(8, rand.Reader)
rng := m.Rng.GetStream()
b, err := csprng.Generate(8, rng)
if err != nil {
jww.FATAL.Panicf("Could not get random number: %v", err)
}
rng.Close()
rangeVal := binary.LittleEndian.Uint64(b) % 800
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment