From 43bc11a9036157ec3045be7bb4b769b0fef68346 Mon Sep 17 00:00:00 2001 From: "Md. Anisul Haque" Date: Thu, 25 May 2023 01:04:49 +0530 Subject: [PATCH] fix: Apply suggestions from code review Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com> --- hashing/sha256.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hashing/sha256.cpp b/hashing/sha256.cpp index 35b10a18c..a346da8ce 100644 --- a/hashing/sha256.cpp +++ b/hashing/sha256.cpp @@ -33,7 +33,7 @@ class Hash { public: void update(const std::array &blocks); - std::string to_string(); + std::string to_string() const; }; /** @@ -226,7 +226,7 @@ void Hash::update(const std::array &blocks) { * @brief Convert the hash to a hexadecimal string * @return std::string Final hash value */ -std::string Hash::to_string() { +std::string Hash::to_string() const { std::stringstream ss; for (size_t i = 0; i < 8; ++i) { ss << std::hex << std::setfill('0') << std::setw(8) << hash[i]; @@ -251,7 +251,7 @@ static void test_extract_byte() { bool exception = false; try { hashing::sha256::extract_byte(512, 5); - } catch (const std::out_of_range) { + } catch (const std::out_of_range &) { exception = true; } assert(exception); @@ -265,7 +265,7 @@ static void test_get_char() { bool exception = false; try { hashing::sha256::get_char("test", 64); - } catch (const std::out_of_range) { + } catch (const std::out_of_range &) { exception = true; } assert(exception);