Skip to content

Commit

Permalink
fix(checksum): disable extended output algorithms (e.g. shake(128|256…
Browse files Browse the repository at this point in the history
…)) -- cherry-pick afbd85e

chore: update tools to v0.5.5
  • Loading branch information
maxirmx committed Dec 1, 2024
1 parent dff6fe6 commit 90894d5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/dwarfs/checksum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,20 @@

namespace dwarfs {

using namespace std::literals::string_view_literals;

namespace {

std::unordered_set<std::string> supported_algorithms{
"xxh3-64",
"xxh3-128",
};

constexpr std::array unsupported_algorithms{
"shake128"sv,
"shake256"sv,
};

class checksum_evp : public checksum::impl {
public:
explicit checksum_evp(::EVP_MD const* evp)
Expand Down Expand Up @@ -76,7 +83,8 @@ class checksum_evp : public checksum::impl {
std::vector<std::string> available;
::EVP_MD_do_all(
[](const ::EVP_MD*, const char* from, const char* to, void* vec) {
if (!to) {
if (!to && std::ranges::find(unsupported_algorithms, from) ==
unsupported_algorithms.end()) {
reinterpret_cast<std::vector<std::string>*>(vec)->emplace_back(
from);
}
Expand Down

0 comments on commit 90894d5

Please sign in to comment.