From e49cbac46a627a5867f949a3334f745a5707f4cc Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 19 Sep 2025 22:51:14 -0600 Subject: [PATCH] optimize --- esphome/components/sha256/sha256.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/esphome/components/sha256/sha256.cpp b/esphome/components/sha256/sha256.cpp index 699579251e..94f623f2fa 100644 --- a/esphome/components/sha256/sha256.cpp +++ b/esphome/components/sha256/sha256.cpp @@ -98,7 +98,9 @@ void SHA256::get_hex(char *output) { return; } for (size_t i = 0; i < 32; i++) { - sprintf(output + i * 2, "%02x", this->ctx_->hash[i]); + uint8_t byte = this->ctx_->hash[i]; + output[i * 2] = format_hex_char(byte >> 4); + output[i * 2 + 1] = format_hex_char(byte & 0x0F); } }