Use std::views::zip instead std::views::enumerate and index get in library/src/encryption.cpp

This commit is contained in:
sha512sum 2024-09-14 23:01:20 +00:00
parent 4060a42634
commit 5c2c336a21

View file

@ -136,9 +136,9 @@ inline auto GenerateAuthScramMessageImpl(std::string_view password,
auto storedKey = HashImpl(clientKey, tag); auto storedKey = HashImpl(clientKey, tag);
auto authMessage = std::format("{},{},{}", initialMessage, firstServerMessage, clientFinalMessageBare); auto authMessage = std::format("{},{},{}", initialMessage, firstServerMessage, clientFinalMessageBare);
auto clientSignature = HmacImpl(ToCharStringView(storedKey), ToUnsignedCharStringView(authMessage), tag); auto clientSignature = HmacImpl(ToCharStringView(storedKey), ToUnsignedCharStringView(authMessage), tag);
auto clientProof = std::views::iota(std::size_t{}, clientKey.size()) | // No std::views::enumerate in libc++ auto clientProof = std::views::zip(clientKey, clientSignature) | // No std::views::enumerate in libc++
std::views::transform([&](auto i) { std::views::transform([&](auto arg) {
return clientKey[i] ^ clientSignature[i]; return arg.first ^ arg.second;
}) | }) |
std::ranges::to<std::string>(); std::ranges::to<std::string>();
std::string serverKeyStr = "Server Key"; std::string serverKeyStr = "Server Key";