mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 09:00:51 +00:00
The seed must be static in getRandomHexChars().
This commit is contained in:
parent
9826038f0b
commit
e4d65e35e6
@ -431,10 +431,10 @@ int d2string(char *buf, size_t len, double value) {
|
|||||||
void getRandomHexChars(char *p, unsigned int len) {
|
void getRandomHexChars(char *p, unsigned int len) {
|
||||||
char *charset = "0123456789abcdef";
|
char *charset = "0123456789abcdef";
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
unsigned char seed[20]; /* A seed to have a different sequence each run. */
|
|
||||||
|
|
||||||
/* Global state. */
|
/* Global state. */
|
||||||
static int seed_initialized = 0;
|
static int seed_initialized = 0;
|
||||||
|
static unsigned char seed[20]; /* The SHA1 seed, from /dev/urandom. */
|
||||||
static uint64_t counter = 0; /* The counter we hash with the seed. */
|
static uint64_t counter = 0; /* The counter we hash with the seed. */
|
||||||
|
|
||||||
if (!seed_initialized) {
|
if (!seed_initialized) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user