From fecf8b5436a8012dc5fdf7f01192e7a6d99530bb Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Mon, 8 Jul 2024 10:12:45 +0200 Subject: Use a fixed HashFunction for creation of UUID4 --- src/buildtool/execution_api/common/execution_common.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/buildtool/execution_api/common/execution_common.hpp') diff --git a/src/buildtool/execution_api/common/execution_common.hpp b/src/buildtool/execution_api/common/execution_common.hpp index 6cb0beda..b6bd1fa0 100644 --- a/src/buildtool/execution_api/common/execution_common.hpp +++ b/src/buildtool/execution_api/common/execution_common.hpp @@ -105,8 +105,11 @@ static void EncodeUUIDVariant1(std::string* uuid) { constexpr auto kRawLength = 16UL; constexpr auto kHexDashPos = std::array{8UL, 12UL, 16UL, 20UL}; + // The type of HashFunction is irrelevant here. It is used for + // identification purposes only. SHA256 is used. + HashFunction const hash_function{HashFunction::JustHash::Compatible}; auto value = fmt::format("{}-{}", std::to_string(kRandomConstant), seed); - auto uuid = HashFunction::Instance().ComputeHash(value).Bytes(); + auto uuid = hash_function.ComputeHash(value).Bytes(); EncodeUUIDVersion4(&uuid); EncodeUUIDVariant1(&uuid); Expects(uuid.size() >= kRawLength); -- cgit v1.2.3