mirror of
https://github.com/esphome/esphome.git
synced 2025-11-19 08:15:49 +00:00
API encryption (#2254)
This commit is contained in:
@@ -55,6 +55,15 @@ double random_double() { return random_uint32() / double(UINT32_MAX); }
|
||||
|
||||
float random_float() { return float(random_double()); }
|
||||
|
||||
void fill_random(uint8_t *data, size_t len) {
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
esp_fill_random(data, len);
|
||||
#else
|
||||
int err = os_get_random(data, len);
|
||||
assert(err == 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
static uint32_t fast_random_seed = 0; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
|
||||
void fast_random_set_seed(uint32_t seed) { fast_random_seed = seed; }
|
||||
|
||||
Reference in New Issue
Block a user