From ac8fa77eb0eac67147216ec089c6945f88d5838d Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Sat, 31 Mar 2018 23:22:43 +0200 Subject: [PATCH] srand init fixed --- src/main.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 0dbc02af..4afbff26 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -188,8 +188,7 @@ void wifi_sniffer_loop(void * pvParameters) { configASSERT( ( ( uint32_t ) pvParameters ) == 1 ); // FreeRTOS check uint8_t channel = 1; - srand((uint32_t) temperatureRead()); // use chip temperature for pseudorandom generator init - int nloop=0, lorawait=0, salt=rand() % 256; // random int between 0 and 255 used for salting MAC hashes + int nloop=0, lorawait=0; ESP_LOGI(TAG, "Scan initialized, salt value: %i", salt); while (true) { @@ -385,6 +384,10 @@ void setup() { antenna_init(); #endif + // initialize pseudorandom generator and salt value + srand((uint32_t) temperatureRead()); // use chip temperature for pseudorandom generator init + salt = rand() % 256; // get new random int between 0 and 255 for salting MAC hashes + // initialize display init_display(PROGNAME, PROGVERSION); u8x8.setPowerSave(!cfg.screenon); // set display off if disabled