From 89f326be30098acb063c76f822d36fb249341615 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 27 Dec 2025 15:12:30 -1000 Subject: [PATCH] reduce --- esphome/core/hash_base.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/esphome/core/hash_base.h b/esphome/core/hash_base.h index c45c4df70bb..cc4fcdf9202 100644 --- a/esphome/core/hash_base.h +++ b/esphome/core/hash_base.h @@ -26,13 +26,7 @@ class HashBase { void get_bytes(uint8_t *output) { memcpy(output, this->digest_, this->get_size()); } /// Retrieve the hash as hex characters - void get_hex(char *output) { - for (size_t i = 0; i < this->get_size(); i++) { - uint8_t byte = this->digest_[i]; - output[i * 2] = format_hex_char(byte >> 4); - output[i * 2 + 1] = format_hex_char(byte & 0x0F); - } - } + void get_hex(char *output) { format_hex_to(output, this->get_size() * 2 + 1, this->digest_, this->get_size()); } /// Compare the hash against a provided byte-encoded hash bool equals_bytes(const uint8_t *expected) { return memcmp(this->digest_, expected, this->get_size()) == 0; }