mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-08-03 20:24:14 +02:00
AchievementManager: APPROVED_LIST_HASH quality of life improvements
APPROVED_LIST_HASH is moved to a separate file, making tests compilation faster after changing it. The error message prints the hash in a way that it can be directly copy-pasted (though it still needs clang-format).
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include <array>
|
||||
#include <memory>
|
||||
|
||||
#include <fmt/ranges.h>
|
||||
#include <mbedtls/sha1.h>
|
||||
|
||||
#include "Common/Assert.h"
|
||||
@@ -390,17 +391,11 @@ Digest CalculateDigest(const u8* msg, size_t len)
|
||||
|
||||
std::string DigestToString(const Digest& digest)
|
||||
{
|
||||
static constexpr std::array<char, 16> lookup = {'0', '1', '2', '3', '4', '5', '6', '7',
|
||||
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
|
||||
std::string hash;
|
||||
hash.reserve(digest.size() * 2);
|
||||
for (size_t i = 0; i < digest.size(); ++i)
|
||||
{
|
||||
const u8 upper = static_cast<u8>((digest[i] >> 4) & 0xf);
|
||||
const u8 lower = static_cast<u8>(digest[i] & 0xf);
|
||||
hash.push_back(lookup[upper]);
|
||||
hash.push_back(lookup[lower]);
|
||||
}
|
||||
return hash;
|
||||
return fmt::format("{:02X}", fmt::join(digest, ""));
|
||||
}
|
||||
|
||||
std::string DigestToSource(const Digest& digest)
|
||||
{
|
||||
return fmt::format("{{0x{:02X}}}", fmt::join(digest, ", 0x"));
|
||||
}
|
||||
} // namespace Common::SHA1
|
||||
|
||||
Reference in New Issue
Block a user