diff --git a/examples/chapter11_07a/src/app/led/app_led.h b/examples/chapter11_07a/src/app/led/app_led.h index 7a03672e6..f522e6c43 100644 --- a/examples/chapter11_07a/src/app/led/app_led.h +++ b/examples/chapter11_07a/src/app/led/app_led.h @@ -13,7 +13,7 @@ { #endif - void app_led_task_background (void* pv); + void app_led_task_background(void* pv); void app_led_task_toggle_led0(void* pv); #if defined(__cplusplus) diff --git a/examples/chapter11_07a/src/app/pi_spigot/pi_spigot.cpp b/examples/chapter11_07a/src/app/pi_spigot/pi_spigot.cpp index fce561f4a..ccfbe84bb 100644 --- a/examples/chapter11_07a/src/app/pi_spigot/pi_spigot.cpp +++ b/examples/chapter11_07a/src/app/pi_spigot/pi_spigot.cpp @@ -1,7 +1,7 @@ /////////////////////////////////////////////////////////////////// // // // Copyright Iliass Mahjoub 2022. // -// Copyright Christopher Kormanyos 2019 - 2025. // +// Copyright Christopher Kormanyos 2019 - 2026. // // Distributed under the Boost Software License, // // Version 1.0. (See accompanying file LICENSE_1_0.txt // // or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -49,11 +49,11 @@ namespace local return instance; } - auto pi_output_digits10 = static_cast(UINT8_C(0)); + auto pi_output_digits10 = std::uint32_t { UINT8_C(0) }; using benchmark_port_type = ::mcal::benchmark::benchmark_port_type; - constexpr auto pi_spigot_input_start_address = static_cast(UINT8_C(0)); + constexpr auto pi_spigot_input_start_address = mcal_sram_uintptr_t { UINT8_C(0) }; using pi_spigot_input_container_type = mcal::memory::sram::array void; auto pi_lcd_progress(const std::uint32_t pi_output_digits10) -> void { - char p_str[std::size_t { UINT8_C(20) }]; + char p_str[std::size_t { UINT8_C(16) }]; { std::fill(p_str, p_str + sizeof(p_str), char { INT8_C(0) }); diff --git a/examples/chapter11_07a/src/math/checksums/hash/hash_base.h b/examples/chapter11_07a/src/math/checksums/hash/hash_base.h index 0bdca52c2..3f0375557 100644 --- a/examples/chapter11_07a/src/math/checksums/hash/hash_base.h +++ b/examples/chapter11_07a/src/math/checksums/hash/hash_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2013 - 2025. +// Copyright Christopher Kormanyos 2013 - 2026. // Distributed under the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -63,7 +63,7 @@ if(message_index == message_buffer_static_size()) { - my_perform_algorithm(); + perform_algorithm(); } process_chunk_size = (std::min)(static_cast(count - process_index), @@ -95,7 +95,7 @@ if(message_top > message_buffer_static_size()) { - my_perform_algorithm(); + perform_algorithm(); } // Encode the total number of bits in the final transform buffer. @@ -131,7 +131,7 @@ ); } - my_perform_algorithm(); + perform_algorithm(); } auto get_result(typename result_type::pointer result) -> void @@ -185,15 +185,15 @@ ); } - virtual auto perform_algorithm() -> void = 0; + virtual auto my_perform_algorithm() -> void = 0; - auto my_perform_algorithm() -> void + auto perform_algorithm() -> void { - this->perform_algorithm(); + this->my_perform_algorithm(); - message_index = static_cast(UINT8_C(0)); + message_index = std::uint_least32_t { UINT8_C(0) }; - message_buffer.fill(static_cast(UINT8_C(0))); + message_buffer.fill(std::uint8_t { UINT8_C(0) }); } }; diff --git a/examples/chapter11_07a/src/math/checksums/hash/hash_detail.h b/examples/chapter11_07a/src/math/checksums/hash/hash_detail.h index ed089dd57..b88233b1e 100644 --- a/examples/chapter11_07a/src/math/checksums/hash/hash_detail.h +++ b/examples/chapter11_07a/src/math/checksums/hash/hash_detail.h @@ -1,4 +1,4 @@ -// Copyright Christopher Kormanyos 2013 - 2025. +// Copyright Christopher Kormanyos 2013 - 2026. // Distributed under the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/examples/chapter11_07a/src/math/checksums/hash/hash_sha1.h b/examples/chapter11_07a/src/math/checksums/hash/hash_sha1.h index 260330743..5494614a8 100644 --- a/examples/chapter11_07a/src/math/checksums/hash/hash_sha1.h +++ b/examples/chapter11_07a/src/math/checksums/hash/hash_sha1.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2013 - 2025. +// Copyright Christopher Kormanyos 2013 - 2026. // Distributed under the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -46,17 +46,17 @@ { base_class_type::initialize(); - base_class_type::transform_context[static_cast(UINT8_C(0))] = static_cast(UINT32_C(0x67452301)); - base_class_type::transform_context[static_cast(UINT8_C(1))] = static_cast(UINT32_C(0xEFCDAB89)); - base_class_type::transform_context[static_cast(UINT8_C(2))] = static_cast(UINT32_C(0x98BADCFE)); - base_class_type::transform_context[static_cast(UINT8_C(3))] = static_cast(UINT32_C(0x10325476)); - base_class_type::transform_context[static_cast(UINT8_C(4))] = static_cast(UINT32_C(0xC3D2E1F0)); + base_class_type::transform_context[std::size_t { UINT8_C(0) }] = std::uint32_t { UINT32_C(0x67452301) }; + base_class_type::transform_context[std::size_t { UINT8_C(1) }] = std::uint32_t { UINT32_C(0xEFCDAB89) }; + base_class_type::transform_context[std::size_t { UINT8_C(2) }] = std::uint32_t { UINT32_C(0x98BADCFE) }; + base_class_type::transform_context[std::size_t { UINT8_C(3) }] = std::uint32_t { UINT32_C(0x10325476) }; + base_class_type::transform_context[std::size_t { UINT8_C(4) }] = std::uint32_t { UINT32_C(0xC3D2E1F0) }; } private: static const std::array(UINT8_C(4))> transform_functions; - auto perform_algorithm() -> void override; + auto my_perform_algorithm() -> void override; }; const std::array(UINT8_C(4))> @@ -68,7 +68,7 @@ [](const std::uint32_t* p) -> std::uint32_t { return (static_cast( p[1U] ^ p[2U]) ^ p[3U]); } }; - auto hash_sha1::perform_algorithm() -> void + auto hash_sha1::my_perform_algorithm() -> void { // Apply the hash transformation algorithm to a full data block. @@ -76,10 +76,10 @@ const transform_constants_array_type transform_constants { - static_cast(UINT32_C(0x5A827999)), - static_cast(UINT32_C(0x6ED9EBA1)), - static_cast(UINT32_C(0x8F1BBCDC)), - static_cast(UINT32_C(0xCA62C1D6)) + std::uint32_t { UINT32_C(0x5A827999) }, + std::uint32_t { UINT32_C(0x6ED9EBA1) }, + std::uint32_t { UINT32_C(0x8F1BBCDC) }, + std::uint32_t { UINT32_C(0xCA62C1D6) } }; using transform_block_type = std::array(UINT8_C(16))>; @@ -139,11 +139,14 @@ } // Update the hash state with the transformation results. - std::transform(base_class_type::transform_context.cbegin(), - base_class_type::transform_context.cend (), - hash_tmp.cbegin (), - base_class_type::transform_context.begin (), - std::plus ()); + std::transform + ( + base_class_type::transform_context.cbegin(), + base_class_type::transform_context.cend(), + hash_tmp.cbegin(), + base_class_type::transform_context.begin(), + std::plus() + ); } } } } // namespace math::checksums::hash diff --git a/examples/chapter11_07a/src/math/checksums/hash/hash_sha256.h b/examples/chapter11_07a/src/math/checksums/hash/hash_sha256.h index c51b90e38..d3ba738a5 100644 --- a/examples/chapter11_07a/src/math/checksums/hash/hash_sha256.h +++ b/examples/chapter11_07a/src/math/checksums/hash/hash_sha256.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2013 - 2025. +// Copyright Christopher Kormanyos 2013 - 2026. // Distributed under the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -17,15 +17,12 @@ namespace math { namespace checksums { namespace hash { - template - class hash_sha256 : public hash_base(UINT16_C(256)), + class hash_sha256 : public hash_base(UINT16_C(256)), static_cast(UINT8_C(64)), static_cast(UINT8_C(64))> { private: - using base_class_type = hash_base(UINT16_C(256)), + using base_class_type = hash_base(UINT16_C(256)), static_cast(UINT8_C(64)), static_cast(UINT8_C(64))>; @@ -49,18 +46,18 @@ { base_class_type::initialize(); - base_class_type::transform_context[static_cast(UINT8_C(0))] = static_cast(UINT32_C(0x6A09E667)); - base_class_type::transform_context[static_cast(UINT8_C(1))] = static_cast(UINT32_C(0xBB67AE85)); - base_class_type::transform_context[static_cast(UINT8_C(2))] = static_cast(UINT32_C(0x3C6EF372)); - base_class_type::transform_context[static_cast(UINT8_C(3))] = static_cast(UINT32_C(0xA54FF53A)); - base_class_type::transform_context[static_cast(UINT8_C(4))] = static_cast(UINT32_C(0x510E527F)); - base_class_type::transform_context[static_cast(UINT8_C(5))] = static_cast(UINT32_C(0x9B05688C)); - base_class_type::transform_context[static_cast(UINT8_C(6))] = static_cast(UINT32_C(0x1F83D9AB)); - base_class_type::transform_context[static_cast(UINT8_C(7))] = static_cast(UINT32_C(0x5BE0CD19)); + base_class_type::transform_context[std::size_t { UINT8_C(0) }] = std::uint32_t { UINT32_C(0x6A09E667) }; + base_class_type::transform_context[std::size_t { UINT8_C(1) }] = std::uint32_t { UINT32_C(0xBB67AE85) }; + base_class_type::transform_context[std::size_t { UINT8_C(2) }] = std::uint32_t { UINT32_C(0x3C6EF372) }; + base_class_type::transform_context[std::size_t { UINT8_C(3) }] = std::uint32_t { UINT32_C(0xA54FF53A) }; + base_class_type::transform_context[std::size_t { UINT8_C(4) }] = std::uint32_t { UINT32_C(0x510E527F) }; + base_class_type::transform_context[std::size_t { UINT8_C(5) }] = std::uint32_t { UINT32_C(0x9B05688C) }; + base_class_type::transform_context[std::size_t { UINT8_C(6) }] = std::uint32_t { UINT32_C(0x1F83D9AB) }; + base_class_type::transform_context[std::size_t { UINT8_C(7) }] = std::uint32_t { UINT32_C(0x5BE0CD19) }; } private: - auto perform_algorithm() -> void override; + auto my_perform_algorithm() -> void override; static constexpr auto transform_function1(std::uint32_t x) -> std::uint32_t; // BSIG0 static constexpr auto transform_function2(std::uint32_t x) -> std::uint32_t; // BSIG1 @@ -68,8 +65,7 @@ static constexpr auto transform_function4(std::uint32_t x) -> std::uint32_t; // SSIG1 }; - template - auto hash_sha256::perform_algorithm() -> void + auto hash_sha256::my_perform_algorithm() -> void { // Apply the hash transformation algorithm to a full data block. @@ -163,29 +159,31 @@ ) ); - hash_tmp[static_cast(UINT8_C(7))] = hash_tmp[static_cast(UINT8_C(6))]; - hash_tmp[static_cast(UINT8_C(6))] = hash_tmp[static_cast(UINT8_C(5))]; - hash_tmp[static_cast(UINT8_C(5))] = hash_tmp[static_cast(UINT8_C(4))]; - hash_tmp[static_cast(UINT8_C(4))] = static_cast - ( - hash_tmp[static_cast(UINT8_C(3))] + tmp1 - ); - hash_tmp[static_cast(UINT8_C(3))] = hash_tmp[static_cast(UINT8_C(2))]; - hash_tmp[static_cast(UINT8_C(2))] = hash_tmp[static_cast(UINT8_C(1))]; - hash_tmp[static_cast(UINT8_C(1))] = hash_tmp[static_cast(UINT8_C(0))]; - hash_tmp[static_cast(UINT8_C(0))] = static_cast(tmp1 + tmp2); + hash_tmp[std::size_t { UINT8_C(7) }] = hash_tmp[std::size_t { UINT8_C(6) }]; + hash_tmp[std::size_t { UINT8_C(6) }] = hash_tmp[std::size_t { UINT8_C(5) }]; + hash_tmp[std::size_t { UINT8_C(5) }] = hash_tmp[std::size_t { UINT8_C(4) }]; + hash_tmp[std::size_t { UINT8_C(4) }] = static_cast + ( + hash_tmp[static_cast(UINT8_C(3))] + tmp1 + ); + hash_tmp[std::size_t { UINT8_C(3) }] = hash_tmp[std::size_t { UINT8_C(2) }]; + hash_tmp[std::size_t { UINT8_C(2) }] = hash_tmp[std::size_t { UINT8_C(1) }]; + hash_tmp[std::size_t { UINT8_C(1) }] = hash_tmp[std::size_t { UINT8_C(0) }]; + hash_tmp[std::size_t { UINT8_C(0) }] = static_cast(tmp1 + tmp2); } // Update the hash state with the transformation results. - std::transform(base_class_type::transform_context.cbegin(), - base_class_type::transform_context.cend (), - hash_tmp.cbegin (), - base_class_type::transform_context.begin (), - std::plus ()); + std::transform + ( + base_class_type::transform_context.cbegin(), + base_class_type::transform_context.cend(), + hash_tmp.cbegin(), + base_class_type::transform_context.begin(), + std::plus() + ); } - template - constexpr auto hash_sha256::transform_function1(std::uint32_t x) -> std::uint32_t + constexpr auto hash_sha256::transform_function1(std::uint32_t x) -> std::uint32_t { // BSIG0 return @@ -197,8 +195,7 @@ ); } - template - constexpr auto hash_sha256::transform_function2(std::uint32_t x) -> std::uint32_t + constexpr auto hash_sha256::transform_function2(std::uint32_t x) -> std::uint32_t { // BSIG1 return @@ -210,8 +207,7 @@ ); } - template - constexpr auto hash_sha256::transform_function3(std::uint32_t x) -> std::uint32_t + constexpr auto hash_sha256::transform_function3(std::uint32_t x) -> std::uint32_t { // SSIG0 return @@ -223,8 +219,7 @@ ); } - template - constexpr auto hash_sha256::transform_function4(std::uint32_t x) -> std::uint32_t + constexpr auto hash_sha256::transform_function4(std::uint32_t x) -> std::uint32_t { // SSIG1 return diff --git a/examples/chapter11_07a/src/math/checksums/hash/hash_stream_base.h b/examples/chapter11_07a/src/math/checksums/hash/hash_stream_base.h index 5630fb96b..bd0305c4d 100644 --- a/examples/chapter11_07a/src/math/checksums/hash/hash_stream_base.h +++ b/examples/chapter11_07a/src/math/checksums/hash/hash_stream_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2013 - 2023. +// Copyright Christopher Kormanyos 2013 - 2026. // Distributed under the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -20,8 +20,15 @@ using count_type = std::uint32_t; hash_stream_base() = default; + + hash_stream_base(const hash_stream_base&) = default; + hash_stream_base(hash_stream_base&&) = default; + virtual ~hash_stream_base() = default; + auto operator=(const hash_stream_base&) -> hash_stream_base& = default; + auto operator=(hash_stream_base&&) -> hash_stream_base& = default; + virtual auto initialize() -> void = 0; virtual auto process(const std::uint8_t* message, const count_type count) -> void = 0; diff --git a/examples/chapter11_07a/target/micros/avr/make/avr_flags.gmk b/examples/chapter11_07a/target/micros/avr/make/avr_flags.gmk index a2a0b2a2d..cd9d91518 100644 --- a/examples/chapter11_07a/target/micros/avr/make/avr_flags.gmk +++ b/examples/chapter11_07a/target/micros/avr/make/avr_flags.gmk @@ -1,5 +1,5 @@ # -# Copyright Christopher Kormanyos 2007 - 2025. +# Copyright Christopher Kormanyos 2007 - 2026. # Distributed under the Boost Software License, # Version 1.0. (See accompanying file LICENSE_1_0.txt # or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -12,7 +12,7 @@ GCC_TARGET = avr GCC_PREFIX = avr -GCC_VERSION = 15.1.0 +GCC_VERSION = 15.2.0 TGT_SUFFIX = elf @@ -31,7 +31,7 @@ TGT_ALLFLAGS := $(TGT_ALLFLAGS) INC_PREFIX := -isystem STD_C := c11 -STD_CPP := c++20 +STD_CPP := c++23 else diff --git a/ref_app/ref_app.vcxproj b/ref_app/ref_app.vcxproj index d2fa60723..e477f203a 100644 --- a/ref_app/ref_app.vcxproj +++ b/ref_app/ref_app.vcxproj @@ -1477,6 +1477,7 @@ + diff --git a/ref_app/ref_app.vcxproj.filters b/ref_app/ref_app.vcxproj.filters index f534e96f5..0c0191773 100644 --- a/ref_app/ref_app.vcxproj.filters +++ b/ref_app/ref_app.vcxproj.filters @@ -3042,6 +3042,9 @@ src\mcal_memory + + src\math\checksums\hash + diff --git a/ref_app/src/app/benchmark/app_benchmark.h b/ref_app/src/app/benchmark/app_benchmark.h index faadfbe01..5876ffbc0 100644 --- a/ref_app/src/app/benchmark/app_benchmark.h +++ b/ref_app/src/app/benchmark/app_benchmark.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2007 - 2025. +// Copyright Christopher Kormanyos 2007 - 2026. // Distributed under the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/ref_app/src/app/benchmark/app_benchmark_ecc_generic_ecc.cpp b/ref_app/src/app/benchmark/app_benchmark_ecc_generic_ecc.cpp index 28a39ea13..3e7be6d6c 100644 --- a/ref_app/src/app/benchmark/app_benchmark_ecc_generic_ecc.cpp +++ b/ref_app/src/app/benchmark/app_benchmark_ecc_generic_ecc.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2023. +// Copyright Christopher Kormanyos 2023 - 2026. // Distributed under the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -31,7 +31,7 @@ namespace curve_secp256k1 constexpr char SubGroupOrderN [] = "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141"; // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,cppcoreguidelines-pro-bounds-array-to-pointer-decay,modernize-avoid-c-arrays) constexpr auto SubGroupCoFactorH = static_cast(INT8_C(1)); - using hash_type = math::checksums::hash::hash_sha256; + using hash_type = math::checksums::hash::hash_sha256; } namespace local @@ -41,7 +41,7 @@ namespace local // Declare the secp256k1 digital signature type. using digital_signature_secp256k1_type = - generic_ecc::digital_signature_generic_ecc(UINT16_C(256)), + generic_ecc::digital_signature_generic_ecc -#include + +#include namespace { - using app_benchmark_hash_type = math::checksums::hash::hash_sha1; + using app_benchmark_hash_type = math::checksums::hash::hash_sha1; app_benchmark_hash_type app_benchmark_hash_object; using app_benchmark_hash_count_type = typename app_benchmark_hash_type::count_type; using app_benchmark_hash_result_type = typename app_benchmark_hash_type::result_type; - const mcal::memory::progmem::array::value> - app_benchmark_hash_ctrl MY_PROGMEM = + constexpr std::array::value> + app_benchmark_hash_ctrl = { 0xA9U, 0x99U, 0x3EU, 0x36U, 0x47U, 0x06U, 0x81U, 0x6AU, 0xBAU, 0x3EU, 0x25U, 0x71U, 0x78U, 0x50U, 0xC2U, 0x6CU, @@ -32,17 +33,19 @@ namespace auto app::benchmark::run_hash() -> bool { - static constexpr std::array(UINT8_C(3))> app_benchmark_hash_data = + using app_benchmark_msg_array_type = std::array(UINT8_C(3))>; + + constexpr app_benchmark_msg_array_type app_benchmark_hash_msg = { static_cast('a'), static_cast('b'), static_cast('c') }; - app_benchmark_hash_object.hash(app_benchmark_hash_data.data(), - static_cast(app_benchmark_hash_data.size())); + app_benchmark_hash_object.hash(app_benchmark_hash_msg.data(), + static_cast(std::tuple_size::value)); - auto local_hash_result = app_benchmark_hash_result_type { }; + app_benchmark_hash_result_type local_hash_result { }; app_benchmark_hash_object.get_result(local_hash_result.data()); diff --git a/ref_app/src/app/benchmark/app_benchmark_hash_sha256.cpp b/ref_app/src/app/benchmark/app_benchmark_hash_sha256.cpp index d6c87fa3b..ba2fad237 100644 --- a/ref_app/src/app/benchmark/app_benchmark_hash_sha256.cpp +++ b/ref_app/src/app/benchmark/app_benchmark_hash_sha256.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2013 - 2023. +// Copyright Christopher Kormanyos 2013 - 2026. // Distributed under the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -10,19 +10,20 @@ #if (defined(APP_BENCHMARK_TYPE) && (APP_BENCHMARK_TYPE == APP_BENCHMARK_TYPE_HASH_SHA256)) #include -#include + +#include namespace { - using app_benchmark_hash_type = math::checksums::hash::hash_sha256; + using app_benchmark_hash_type = math::checksums::hash::hash_sha256; app_benchmark_hash_type app_benchmark_hash_object; using app_benchmark_hash_count_type = typename app_benchmark_hash_type::count_type; using app_benchmark_hash_result_type = typename app_benchmark_hash_type::result_type; - const mcal::memory::progmem::array::value> - app_benchmark_hash_ctrl MY_PROGMEM = + constexpr std::array::value> + app_benchmark_hash_ctrl = { 0xBAU, 0x78U, 0x16U, 0xBFU, 0x8FU, 0x01U, 0xCFU, 0xEAU, 0x41U, 0x41U, 0x40U, 0xDEU, 0x5DU, 0xAEU, 0x22U, 0x23U, @@ -33,17 +34,19 @@ namespace auto app::benchmark::run_hash_sha256() -> bool { - static constexpr std::array(UINT8_C(3))> app_benchmark_hash_data = + using app_benchmark_msg_array_type = std::array(UINT8_C(3))>; + + constexpr app_benchmark_msg_array_type app_benchmark_hash_msg = { static_cast('a'), static_cast('b'), static_cast('c') }; - app_benchmark_hash_object.hash(app_benchmark_hash_data.data(), - static_cast(app_benchmark_hash_data.size())); + app_benchmark_hash_object.hash(app_benchmark_hash_msg.data(), + static_cast(std::tuple_size::value)); - auto local_hash_result = app_benchmark_hash_result_type { }; + app_benchmark_hash_result_type local_hash_result { }; app_benchmark_hash_object.get_result(local_hash_result.data()); diff --git a/ref_app/src/math/checksums/hash/hash_base.h b/ref_app/src/math/checksums/hash/hash_base.h index fdde0518f..3f0375557 100644 --- a/ref_app/src/math/checksums/hash/hash_base.h +++ b/ref_app/src/math/checksums/hash/hash_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2013 - 2025. +// Copyright Christopher Kormanyos 2013 - 2026. // Distributed under the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -8,58 +8,62 @@ #ifndef HASH_BASE_2013_09_05_H #define HASH_BASE_2013_09_05_H - #include - #include + #include + + #include + #include + #include + #include namespace math { namespace checksums { namespace hash { - template - class hash_base + template + class hash_base : public hash_stream_base { - public: - using count_type = CountType; + private: + using base_class_type = hash_stream_base; + public: using result_type = std::array(ResultBitCount / static_cast(UINT8_C(8)))>; static_assert ( - std::numeric_limits::is_specialized - && std::numeric_limits::is_integer - && (!std::numeric_limits::is_signed) - && (std::numeric_limits::radix == static_cast(INT8_C(2))) - && (std::numeric_limits::digits >= static_cast(INT8_C(16))) - && (static_cast(std::numeric_limits::digits % static_cast(INT8_C(8))) == static_cast(INT8_C(0))), - "Error: The count type must be an unsigned integer with radix 2, that is 16 bits or wider, and having a multiple of 8 bits" + std::numeric_limits::is_specialized + && std::numeric_limits::is_integer + && (!std::numeric_limits::is_signed) + && (std::numeric_limits::radix == static_cast(INT8_C(2))) + && (std::numeric_limits::digits >= static_cast(INT8_C(32))) + && (static_cast(std::numeric_limits::digits % static_cast(INT8_C(8))) == static_cast(INT8_C(0))), + "Error: The count type must be an unsigned integer with radix 2, that is 32 bits or wider, and having a multiple of 8 bits" ); - virtual ~hash_base() = default; + ~hash_base() override = default; - virtual auto initialize() -> void + auto initialize() -> void override { - message_index = static_cast(UINT8_C(0)); + message_index = static_cast(UINT8_C(0)); message_length_total = static_cast(UINT8_C(0)); message_buffer.fill(static_cast(UINT8_C(0))); } - auto process(const std::uint8_t* message, const count_type count) -> void + auto process(const std::uint8_t* message, const count_type count) -> void override { auto process_index = count_type { }; auto process_chunk_size = count_type { }; while(process_index < count) { - message_index = static_cast(message_index + process_chunk_size); + message_index = static_cast(message_index + process_chunk_size); message_length_total = static_cast (message_length_total + process_chunk_size); process_index = static_cast (process_index + process_chunk_size); if(message_index == message_buffer_static_size()) { - my_perform_algorithm(); + perform_algorithm(); } process_chunk_size = (std::min)(static_cast(count - process_index), @@ -72,10 +76,10 @@ } } - auto finalize() -> void + auto finalize() -> void override { // Create the padding. Begin by setting the leading padding byte to 0x80. - message_buffer[message_index] = static_cast(UINT8_C(0x80)); + message_buffer[static_cast(message_index)] = static_cast(UINT8_C(0x80)); ++message_index; @@ -86,12 +90,12 @@ const auto message_top = static_cast ( - message_index + static_cast(message_length_total_width()) + message_index + static_cast(message_length_total_width()) ); if(message_top > message_buffer_static_size()) { - my_perform_algorithm(); + perform_algorithm(); } // Encode the total number of bits in the final transform buffer. @@ -105,10 +109,10 @@ ri != message_buffer.rbegin() + static_cast(message_length_total_width()); ++ri) { - const std::uint_least16_t the_word = - static_cast + const std::uint_least32_t the_word = + static_cast ( - static_cast(message_length_total) << static_cast(UINT8_C(3)) + static_cast(message_length_total) << static_cast(UINT8_C(3)) ); *ri = static_cast(the_word | carry); @@ -127,7 +131,7 @@ ); } - my_perform_algorithm(); + perform_algorithm(); } auto get_result(typename result_type::pointer result) -> void @@ -149,7 +153,7 @@ } protected: - using message_block_type = std::array(MessageBufferSize)>; + using message_block_type = std::array(MessageBlockBufferSize)>; using context_type = std::array(std::tuple_size::value / sizeof(std::uint32_t))>; @@ -158,7 +162,7 @@ return static_cast(std::tuple_size::value); } - std::uint_least16_t message_index { }; + std::uint_least32_t message_index { }; count_type message_length_total { }; message_block_type message_buffer { }; context_type transform_context { }; @@ -166,30 +170,30 @@ hash_base() = default; hash_base(const hash_base&) = default; - hash_base(hash_base&&) noexcept = default; + hash_base(hash_base&&) = default; auto operator=(const hash_base& other) -> hash_base& = default; - auto operator=(hash_base&& other) noexcept -> hash_base& = default; + auto operator=(hash_base&& other) -> hash_base& = default; private: - static constexpr auto message_length_total_width() noexcept -> std::uint16_t + static constexpr auto message_length_total_width() -> std::uint16_t { return static_cast ( - MessageLengthTotalBitCount / static_cast(UINT8_C(8)) + MessageBlockBitCount / static_cast(UINT8_C(8)) ); } - virtual auto perform_algorithm() -> void = 0; + virtual auto my_perform_algorithm() -> void = 0; - auto my_perform_algorithm() -> void + auto perform_algorithm() -> void { - this->perform_algorithm(); + this->my_perform_algorithm(); - message_index = static_cast(UINT8_C(0)); + message_index = std::uint_least32_t { UINT8_C(0) }; - message_buffer.fill(static_cast(UINT8_C(0))); + message_buffer.fill(std::uint8_t { UINT8_C(0) }); } }; diff --git a/ref_app/src/math/checksums/hash/hash_detail.h b/ref_app/src/math/checksums/hash/hash_detail.h index c382891d1..b88233b1e 100644 --- a/ref_app/src/math/checksums/hash/hash_detail.h +++ b/ref_app/src/math/checksums/hash/hash_detail.h @@ -1,4 +1,4 @@ -// Copyright Christopher Kormanyos 2013 - 2025. +// Copyright Christopher Kormanyos 2013 - 2026. // Distributed under the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -9,6 +9,7 @@ #include #include + #include namespace math { namespace checksums { namespace hash { namespace detail { @@ -36,7 +37,7 @@ ); } - inline auto convert_uint8_input_to_uint32_output(const std::uint8_t* in_begin, const std::uint8_t* in_end, std::uint32_t* out_begin) -> void + constexpr auto convert_uint8_input_to_uint32_output(const std::uint8_t* in_begin, const std::uint8_t* in_end, std::uint32_t* out_begin) -> void { // Decode the input uint8_t source into the output uint32_t destination. // This subroutine assumes that the length of the input is a multiple of 4. @@ -60,7 +61,7 @@ } } - inline auto convert_uint8_input_to_uint32_output_reverse(const std::uint8_t* in_begin, const std::uint8_t* in_end, std::uint32_t* out_begin) -> void + constexpr auto convert_uint8_input_to_uint32_output_reverse(const std::uint8_t* in_begin, const std::uint8_t* in_end, std::uint32_t* out_begin) -> void { // Decode the input uint8_t source into the output uint32_t destination. // This subroutine assumes that the length of the input is a multiple of 4. @@ -84,7 +85,7 @@ } } - inline auto convert_uint32_input_to_uint8_output(const std::uint32_t* in_begin, const std::uint32_t* in_end, std::uint8_t* out_begin) -> void + constexpr auto convert_uint32_input_to_uint8_output(const std::uint32_t* in_begin, const std::uint32_t* in_end, std::uint8_t* out_begin) -> void { // Encode the input uint32_t source into the output uint8_t destination. // This subroutine assumes that the length of the output is a multiple of 4. @@ -104,7 +105,7 @@ } } - inline auto convert_uint32_input_to_uint8_output_reverse(const std::uint32_t* in_begin, const std::uint32_t* in_end, std::uint8_t* out_begin) -> void + constexpr auto convert_uint32_input_to_uint8_output_reverse(const std::uint32_t* in_begin, const std::uint32_t* in_end, std::uint8_t* out_begin) -> void { // Encode the input uint32_t source into the output uint8_t destination. // This subroutine assumes that the length of the output is a multiple of 4. diff --git a/ref_app/src/math/checksums/hash/hash_sha1.h b/ref_app/src/math/checksums/hash/hash_sha1.h index b4a4edd6a..5494614a8 100644 --- a/ref_app/src/math/checksums/hash/hash_sha1.h +++ b/ref_app/src/math/checksums/hash/hash_sha1.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2013 - 2025. +// Copyright Christopher Kormanyos 2013 - 2026. // Distributed under the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -10,23 +10,19 @@ // See also: https://en.wikipedia.org/wiki/SHA-1 + #include + #include - #include #include - #include - namespace math { namespace checksums { namespace hash { - template - class hash_sha1 : public hash_base(UINT8_C(160)), + class hash_sha1 : public hash_base(UINT8_C(160)), static_cast(UINT8_C(64)), static_cast(UINT8_C(64))> { private: - using base_class_type = hash_base(UINT8_C(160)), + using base_class_type = hash_base(UINT8_C(160)), static_cast(UINT8_C(64)), static_cast(UINT8_C(64))>; @@ -34,33 +30,45 @@ "Error: The message buffer size must exactly equal 64"); public: + using transform_function_type = std::uint32_t(*)(const std::uint32_t*); + hash_sha1() = default; hash_sha1(const hash_sha1&) = default; - hash_sha1(hash_sha1&&) noexcept = default; + hash_sha1(hash_sha1&&) = default; ~hash_sha1() override = default; auto operator=(const hash_sha1&) -> hash_sha1& = default; - auto operator=(hash_sha1&&) noexcept -> hash_sha1& = default; + auto operator=(hash_sha1&&) -> hash_sha1& = default; auto initialize() -> void override { base_class_type::initialize(); - base_class_type::transform_context[static_cast(UINT8_C(0))] = static_cast(UINT32_C(0x67452301)); - base_class_type::transform_context[static_cast(UINT8_C(1))] = static_cast(UINT32_C(0xEFCDAB89)); - base_class_type::transform_context[static_cast(UINT8_C(2))] = static_cast(UINT32_C(0x98BADCFE)); - base_class_type::transform_context[static_cast(UINT8_C(3))] = static_cast(UINT32_C(0x10325476)); - base_class_type::transform_context[static_cast(UINT8_C(4))] = static_cast(UINT32_C(0xC3D2E1F0)); + base_class_type::transform_context[std::size_t { UINT8_C(0) }] = std::uint32_t { UINT32_C(0x67452301) }; + base_class_type::transform_context[std::size_t { UINT8_C(1) }] = std::uint32_t { UINT32_C(0xEFCDAB89) }; + base_class_type::transform_context[std::size_t { UINT8_C(2) }] = std::uint32_t { UINT32_C(0x98BADCFE) }; + base_class_type::transform_context[std::size_t { UINT8_C(3) }] = std::uint32_t { UINT32_C(0x10325476) }; + base_class_type::transform_context[std::size_t { UINT8_C(4) }] = std::uint32_t { UINT32_C(0xC3D2E1F0) }; } private: - auto perform_algorithm() -> void override; + static const std::array(UINT8_C(4))> transform_functions; + + auto my_perform_algorithm() -> void override; }; - template - auto hash_sha1::perform_algorithm() -> void + const std::array(UINT8_C(4))> + hash_sha1::transform_functions + { + [](const std::uint32_t* p) -> std::uint32_t { return (static_cast( p[1U] & p[2U]) | static_cast(static_cast(~p[1U]) & p[3U])); }, + [](const std::uint32_t* p) -> std::uint32_t { return static_cast(static_cast(p[1U] ^ p[2U]) ^ p[3U]); }, + [](const std::uint32_t* p) -> std::uint32_t { return static_cast(static_cast(p[1U] & p[2U]) | static_cast(p[1U] & p[3U]) | static_cast(p[2U] & p[3U])); }, + [](const std::uint32_t* p) -> std::uint32_t { return (static_cast( p[1U] ^ p[2U]) ^ p[3U]); } + }; + + auto hash_sha1::my_perform_algorithm() -> void { // Apply the hash transformation algorithm to a full data block. @@ -68,10 +76,10 @@ const transform_constants_array_type transform_constants { - static_cast(UINT32_C(0x5A827999)), - static_cast(UINT32_C(0x6ED9EBA1)), - static_cast(UINT32_C(0x8F1BBCDC)), - static_cast(UINT32_C(0xCA62C1D6)) + std::uint32_t { UINT32_C(0x5A827999) }, + std::uint32_t { UINT32_C(0x6ED9EBA1) }, + std::uint32_t { UINT32_C(0x8F1BBCDC) }, + std::uint32_t { UINT32_C(0xCA62C1D6) } }; using transform_block_type = std::array(UINT8_C(16))>; @@ -85,17 +93,7 @@ transform_block.data() ); - using transform_function_type = std::uint32_t(*)(const std::uint32_t*); - - const std::array(UINT8_C(4))> transform_functions - { - [](const std::uint32_t* p) -> std::uint32_t { return (static_cast( p[1U] & p[2U]) | static_cast(static_cast(~p[1U]) & p[3U])); }, - [](const std::uint32_t* p) -> std::uint32_t { return static_cast(static_cast(p[1U] ^ p[2U]) ^ p[3U]); }, - [](const std::uint32_t* p) -> std::uint32_t { return static_cast(static_cast(p[1U] & p[2U]) | static_cast(p[1U] & p[3U]) | static_cast(p[2U] & p[3U])); }, - [](const std::uint32_t* p) -> std::uint32_t { return (static_cast( p[1U] ^ p[2U]) ^ p[3U]); } - }; - - auto hash_tmp = base_class_type::transform_context; + context_type hash_tmp { base_class_type::transform_context }; auto loop_index = static_cast(UINT8_C(0)); @@ -114,7 +112,7 @@ ^ transform_block[static_cast( loop_counter & static_cast(UINT8_C(0x0F)))] ); - const auto transform_block_index = static_cast(loop_counter & std::uint8_t(UINT8_C(0x0F))); + const auto transform_block_index { static_cast(loop_counter & std::uint8_t(UINT8_C(0x0F))) }; transform_block[transform_block_index] = detail::circular_left_shift(UINT8_C(1))>(the_dword); @@ -141,11 +139,14 @@ } // Update the hash state with the transformation results. - std::transform(base_class_type::transform_context.cbegin(), - base_class_type::transform_context.cend (), - hash_tmp.cbegin (), - base_class_type::transform_context.begin (), - std::plus ()); + std::transform + ( + base_class_type::transform_context.cbegin(), + base_class_type::transform_context.cend(), + hash_tmp.cbegin(), + base_class_type::transform_context.begin(), + std::plus() + ); } } } } // namespace math::checksums::hash diff --git a/ref_app/src/math/checksums/hash/hash_sha256.h b/ref_app/src/math/checksums/hash/hash_sha256.h index c92e0e670..d3ba738a5 100644 --- a/ref_app/src/math/checksums/hash/hash_sha256.h +++ b/ref_app/src/math/checksums/hash/hash_sha256.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2013 - 2025. +// Copyright Christopher Kormanyos 2013 - 2026. // Distributed under the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -10,23 +10,19 @@ // See also: https://en.wikipedia.org/wiki/SHA-2 + #include + #include - #include #include - #include - namespace math { namespace checksums { namespace hash { - template - class hash_sha256 : public hash_base(UINT16_C(256)), + class hash_sha256 : public hash_base(UINT16_C(256)), static_cast(UINT8_C(64)), static_cast(UINT8_C(64))> { private: - using base_class_type = hash_base(UINT16_C(256)), + using base_class_type = hash_base(UINT16_C(256)), static_cast(UINT8_C(64)), static_cast(UINT8_C(64))>; @@ -39,29 +35,29 @@ hash_sha256() = default; hash_sha256(const hash_sha256&) = default; - hash_sha256(hash_sha256&&) noexcept = default; + hash_sha256(hash_sha256&&) = default; ~hash_sha256() override = default; auto operator=(const hash_sha256&) -> hash_sha256& = default; - auto operator=(hash_sha256&&) noexcept -> hash_sha256& = default; + auto operator=(hash_sha256&&) -> hash_sha256& = default; auto initialize() -> void override { base_class_type::initialize(); - base_class_type::transform_context[static_cast(UINT8_C(0))] = static_cast(UINT32_C(0x6A09E667)); - base_class_type::transform_context[static_cast(UINT8_C(1))] = static_cast(UINT32_C(0xBB67AE85)); - base_class_type::transform_context[static_cast(UINT8_C(2))] = static_cast(UINT32_C(0x3C6EF372)); - base_class_type::transform_context[static_cast(UINT8_C(3))] = static_cast(UINT32_C(0xA54FF53A)); - base_class_type::transform_context[static_cast(UINT8_C(4))] = static_cast(UINT32_C(0x510E527F)); - base_class_type::transform_context[static_cast(UINT8_C(5))] = static_cast(UINT32_C(0x9B05688C)); - base_class_type::transform_context[static_cast(UINT8_C(6))] = static_cast(UINT32_C(0x1F83D9AB)); - base_class_type::transform_context[static_cast(UINT8_C(7))] = static_cast(UINT32_C(0x5BE0CD19)); + base_class_type::transform_context[std::size_t { UINT8_C(0) }] = std::uint32_t { UINT32_C(0x6A09E667) }; + base_class_type::transform_context[std::size_t { UINT8_C(1) }] = std::uint32_t { UINT32_C(0xBB67AE85) }; + base_class_type::transform_context[std::size_t { UINT8_C(2) }] = std::uint32_t { UINT32_C(0x3C6EF372) }; + base_class_type::transform_context[std::size_t { UINT8_C(3) }] = std::uint32_t { UINT32_C(0xA54FF53A) }; + base_class_type::transform_context[std::size_t { UINT8_C(4) }] = std::uint32_t { UINT32_C(0x510E527F) }; + base_class_type::transform_context[std::size_t { UINT8_C(5) }] = std::uint32_t { UINT32_C(0x9B05688C) }; + base_class_type::transform_context[std::size_t { UINT8_C(6) }] = std::uint32_t { UINT32_C(0x1F83D9AB) }; + base_class_type::transform_context[std::size_t { UINT8_C(7) }] = std::uint32_t { UINT32_C(0x5BE0CD19) }; } private: - auto perform_algorithm() -> void override; + auto my_perform_algorithm() -> void override; static constexpr auto transform_function1(std::uint32_t x) -> std::uint32_t; // BSIG0 static constexpr auto transform_function2(std::uint32_t x) -> std::uint32_t; // BSIG1 @@ -69,8 +65,7 @@ static constexpr auto transform_function4(std::uint32_t x) -> std::uint32_t; // SSIG1 }; - template - auto hash_sha256::perform_algorithm() -> void + auto hash_sha256::my_perform_algorithm() -> void { // Apply the hash transformation algorithm to a full data block. @@ -164,29 +159,31 @@ ) ); - hash_tmp[static_cast(UINT8_C(7))] = hash_tmp[static_cast(UINT8_C(6))]; - hash_tmp[static_cast(UINT8_C(6))] = hash_tmp[static_cast(UINT8_C(5))]; - hash_tmp[static_cast(UINT8_C(5))] = hash_tmp[static_cast(UINT8_C(4))]; - hash_tmp[static_cast(UINT8_C(4))] = static_cast - ( - hash_tmp[static_cast(UINT8_C(3))] + tmp1 - ); - hash_tmp[static_cast(UINT8_C(3))] = hash_tmp[static_cast(UINT8_C(2))]; - hash_tmp[static_cast(UINT8_C(2))] = hash_tmp[static_cast(UINT8_C(1))]; - hash_tmp[static_cast(UINT8_C(1))] = hash_tmp[static_cast(UINT8_C(0))]; - hash_tmp[static_cast(UINT8_C(0))] = static_cast(tmp1 + tmp2); + hash_tmp[std::size_t { UINT8_C(7) }] = hash_tmp[std::size_t { UINT8_C(6) }]; + hash_tmp[std::size_t { UINT8_C(6) }] = hash_tmp[std::size_t { UINT8_C(5) }]; + hash_tmp[std::size_t { UINT8_C(5) }] = hash_tmp[std::size_t { UINT8_C(4) }]; + hash_tmp[std::size_t { UINT8_C(4) }] = static_cast + ( + hash_tmp[static_cast(UINT8_C(3))] + tmp1 + ); + hash_tmp[std::size_t { UINT8_C(3) }] = hash_tmp[std::size_t { UINT8_C(2) }]; + hash_tmp[std::size_t { UINT8_C(2) }] = hash_tmp[std::size_t { UINT8_C(1) }]; + hash_tmp[std::size_t { UINT8_C(1) }] = hash_tmp[std::size_t { UINT8_C(0) }]; + hash_tmp[std::size_t { UINT8_C(0) }] = static_cast(tmp1 + tmp2); } // Update the hash state with the transformation results. - std::transform(base_class_type::transform_context.cbegin(), - base_class_type::transform_context.cend (), - hash_tmp.cbegin (), - base_class_type::transform_context.begin (), - std::plus ()); + std::transform + ( + base_class_type::transform_context.cbegin(), + base_class_type::transform_context.cend(), + hash_tmp.cbegin(), + base_class_type::transform_context.begin(), + std::plus() + ); } - template - constexpr auto hash_sha256::transform_function1(std::uint32_t x) -> std::uint32_t + constexpr auto hash_sha256::transform_function1(std::uint32_t x) -> std::uint32_t { // BSIG0 return @@ -198,8 +195,7 @@ ); } - template - constexpr auto hash_sha256::transform_function2(std::uint32_t x) -> std::uint32_t + constexpr auto hash_sha256::transform_function2(std::uint32_t x) -> std::uint32_t { // BSIG1 return @@ -211,8 +207,7 @@ ); } - template - constexpr auto hash_sha256::transform_function3(std::uint32_t x) -> std::uint32_t + constexpr auto hash_sha256::transform_function3(std::uint32_t x) -> std::uint32_t { // SSIG0 return @@ -224,8 +219,7 @@ ); } - template - constexpr auto hash_sha256::transform_function4(std::uint32_t x) -> std::uint32_t + constexpr auto hash_sha256::transform_function4(std::uint32_t x) -> std::uint32_t { // SSIG1 return diff --git a/ref_app/src/math/checksums/hash/hash_stream_base.h b/ref_app/src/math/checksums/hash/hash_stream_base.h new file mode 100644 index 000000000..bd0305c4d --- /dev/null +++ b/ref_app/src/math/checksums/hash/hash_stream_base.h @@ -0,0 +1,48 @@ +/////////////////////////////////////////////////////////////////////////////// +// Copyright Christopher Kormanyos 2013 - 2026. +// Distributed under the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt +// or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef HASH_STREAM_BASE_2023_04_30_H + #define HASH_STREAM_BASE_2023_04_30_H + + #include + + #include + + namespace math { namespace checksums { namespace hash { + + class hash_stream_base + { + public: + using count_type = std::uint32_t; + + hash_stream_base() = default; + + hash_stream_base(const hash_stream_base&) = default; + hash_stream_base(hash_stream_base&&) = default; + + virtual ~hash_stream_base() = default; + + auto operator=(const hash_stream_base&) -> hash_stream_base& = default; + auto operator=(hash_stream_base&&) -> hash_stream_base& = default; + + virtual auto initialize() -> void = 0; + + virtual auto process(const std::uint8_t* message, const count_type count) -> void = 0; + + virtual auto finalize() -> void = 0; + + auto hash(const std::uint8_t* message, const count_type count) -> void + { + this->initialize(); + this->process(message, count); + this->finalize(); + } + }; + + } } } // namespace math::checksums::hash + +#endif // HASH_STREAM_BASE_2023_04_30_H diff --git a/ref_app/target/micros/atmega2560/make/atmega2560_flags.gmk b/ref_app/target/micros/atmega2560/make/atmega2560_flags.gmk index 7a29cd54e..0659f644b 100644 --- a/ref_app/target/micros/atmega2560/make/atmega2560_flags.gmk +++ b/ref_app/target/micros/atmega2560/make/atmega2560_flags.gmk @@ -1,5 +1,5 @@ # -# Copyright Christopher Kormanyos 2007 - 2025. +# Copyright Christopher Kormanyos 2007 - 2026. # Distributed under the Boost Software License, # Version 1.0. (See accompanying file LICENSE_1_0.txt # or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -12,7 +12,7 @@ GCC_TARGET = avr GCC_PREFIX = avr -GCC_VERSION = 15.1.0 +GCC_VERSION = 15.2.0 TGT_SUFFIX = elf diff --git a/ref_app/target/micros/atmega4809/make/atmega4809_flags.gmk b/ref_app/target/micros/atmega4809/make/atmega4809_flags.gmk index f9fe81395..6937b98c9 100644 --- a/ref_app/target/micros/atmega4809/make/atmega4809_flags.gmk +++ b/ref_app/target/micros/atmega4809/make/atmega4809_flags.gmk @@ -1,5 +1,5 @@ # -# Copyright Christopher Kormanyos 2007 - 2025. +# Copyright Christopher Kormanyos 2007 - 2026. # Distributed under the Boost Software License, # Version 1.0. (See accompanying file LICENSE_1_0.txt # or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -12,7 +12,7 @@ GCC_TARGET = avr GCC_PREFIX = avr -GCC_VERSION = 15.1.0 +GCC_VERSION = 15.2.0 TGT_SUFFIX = elf diff --git a/ref_app/target/micros/avr/make/avr_flags.gmk b/ref_app/target/micros/avr/make/avr_flags.gmk index eff74bdb5..e9aac1274 100644 --- a/ref_app/target/micros/avr/make/avr_flags.gmk +++ b/ref_app/target/micros/avr/make/avr_flags.gmk @@ -1,5 +1,5 @@ # -# Copyright Christopher Kormanyos 2007 - 2025. +# Copyright Christopher Kormanyos 2007 - 2026. # Distributed under the Boost Software License, # Version 1.0. (See accompanying file LICENSE_1_0.txt # or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -12,7 +12,7 @@ GCC_TARGET = avr GCC_PREFIX = avr -GCC_VERSION = 15.1.0 +GCC_VERSION = 15.2.0 TGT_SUFFIX = elf diff --git a/ref_app/target/micros/stm32f446/make/stm32f446.ld b/ref_app/target/micros/stm32f446/make/stm32f446.ld index c9b7b6ad6..501002012 100644 --- a/ref_app/target/micros/stm32f446/make/stm32f446.ld +++ b/ref_app/target/micros/stm32f446/make/stm32f446.ld @@ -1,5 +1,5 @@ /* - Copyright Christopher Kormanyos 2007 - 2024. + Copyright Christopher Kormanyos 2007 - 2026. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -22,7 +22,7 @@ __initial_stack_pointer = 0x20002000 - 4; MEMORY { VEC(rx) : ORIGIN = 0x08000000, LENGTH = 0x300 - ROM(rx) : ORIGIN = 0x08000300, LENGTH = 32K - 0x300 + ROM(rx) : ORIGIN = 0x08000300, LENGTH = 64K - 0x300 RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 0x7000 }