/* */ #ifndef D_LIBSSL_MESSAGE_DIGEST_IMPL_H #define D_LIBSSL_MESSAGE_DIGEST_IMPL_H #include "common.h" #include #include #include namespace aria2 { class MessageDigestImpl { public: MessageDigestImpl(const EVP_MD* hashFunc); // We don't implement copy ctor. MessageDigestImpl(const MessageDigestImpl&) = delete; // We don't implement assignment operator. MessageDigestImpl& operator==(const MessageDigestImpl&) = delete; ~MessageDigestImpl(); static std::unique_ptr sha1(); static std::unique_ptr create (const std::string& hashType); static bool supports(const std::string& hashType); static size_t getDigestLength(const std::string& hashType); size_t getDigestLength() const; void reset(); void update(const void* data, size_t length); void digest(unsigned char* md); private: const EVP_MD* hashFunc_; EVP_MD_CTX ctx_; }; } // namespace aria2 #endif // D_LIBSSL_MESSAGE_DIGEST_IMPL_H