1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include "sha1.hh" #include <sha1.h> namespace sha1 { std::array<uint8_t, 20> hash(std::span<uint8_t const> input) { std::array<uint8_t, 20> ret; SHA1_CTX ctx; SHA1Init(&ctx); SHA1Update(&ctx, input.data(), input.size()); SHA1Final(ret.data(), &ctx); return ret; } } // namespace sha1