From 1b090e6b95fda2cf5039e8a0f134fc11fd221049 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 19 Mar 2026 13:35:43 -1000 Subject: [PATCH] Address review: use 'secure RNG' instead of 'hardware RNG' in comments --- esphome/core/helpers.cpp | 2 +- esphome/core/helpers.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/esphome/core/helpers.cpp b/esphome/core/helpers.cpp index be400bfef2..f01c97e359 100644 --- a/esphome/core/helpers.cpp +++ b/esphome/core/helpers.cpp @@ -158,7 +158,7 @@ uint32_t fnv1_hash(const char *str) { // SplitMix32 PRNG — MurmurHash3 finalizer with golden-ratio increment. // Provides fast, uniform, non-cryptographic random numbers. -// Seeded lazily from the platform's hardware RNG via random_bytes(). +// Seeded lazily from the platform's secure RNG via random_bytes(). // ESP8266 uses os_random() instead (defined in esp8266/helpers.cpp). #ifndef USE_ESP8266 static uint32_t splitmix32_state; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) diff --git a/esphome/core/helpers.h b/esphome/core/helpers.h index 6bf8371f58..43431299de 100644 --- a/esphome/core/helpers.h +++ b/esphome/core/helpers.h @@ -849,7 +849,7 @@ uint32_t random_uint32(); /// Not thread-safe. Must only be called from the main loop. /// Not suitable for cryptographic use; use random_bytes() instead. float random_float(); -/// Generate \p len number of random bytes from the platform's hardware RNG. +/// Generate \p len random bytes using the platform's secure RNG (hardware RNG or OS CSPRNG). /// Thread-safe. Suitable for cryptographic use. bool random_bytes(uint8_t *data, size_t len);