#include "common.hh" #include "hash_method.hh" #include namespace { class Sha256HashMethod : public HashMethod { public: Sha256HashMethod() { SHA256_Init(&ctx_); } void update(void const* data, size_t count) override { SHA256_Update(&ctx_, data, count); } std::string finish() override { uint8_t out[SHA256_DIGEST_LENGTH]; SHA256_Final(out, &ctx_); SHA256_Init(&ctx_); return to_string(out, sizeof(out)); } private: SHA256_CTX ctx_; }; } // namespace std::unique_ptr HashMethod::sha256() { return std::make_unique(); }