srand init fixed

This commit is contained in:
Klaus K Wilting 2018-03-31 23:22:43 +02:00
parent cf2a620e8a
commit ac8fa77eb0

View File

@ -188,8 +188,7 @@ void wifi_sniffer_loop(void * pvParameters) {
configASSERT( ( ( uint32_t ) pvParameters ) == 1 ); // FreeRTOS check configASSERT( ( ( uint32_t ) pvParameters ) == 1 ); // FreeRTOS check
uint8_t channel = 1; uint8_t channel = 1;
srand((uint32_t) temperatureRead()); // use chip temperature for pseudorandom generator init int nloop=0, lorawait=0;
int nloop=0, lorawait=0, salt=rand() % 256; // random int between 0 and 255 used for salting MAC hashes
ESP_LOGI(TAG, "Scan initialized, salt value: %i", salt); ESP_LOGI(TAG, "Scan initialized, salt value: %i", salt);
while (true) { while (true) {
@ -385,6 +384,10 @@ void setup() {
antenna_init(); antenna_init();
#endif #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 // initialize display
init_display(PROGNAME, PROGVERSION); init_display(PROGNAME, PROGVERSION);
u8x8.setPowerSave(!cfg.screenon); // set display off if disabled u8x8.setPowerSave(!cfg.screenon); // set display off if disabled