From 6232d13f5321b87ddf12a1aa36b4545da45f173d Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Wed, 17 Nov 2021 22:34:57 +0100 Subject: Travel3: Simple image and video display site Reads the images and videos from filesystem and builds a site in memroy. --- src/hash_method_openssl.cc | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/hash_method_openssl.cc (limited to 'src/hash_method_openssl.cc') diff --git a/src/hash_method_openssl.cc b/src/hash_method_openssl.cc new file mode 100644 index 0000000..08884cb --- /dev/null +++ b/src/hash_method_openssl.cc @@ -0,0 +1,34 @@ +#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(); +} -- cgit v1.2.3-70-g09d2