/* */ #ifndef D_LIBNETTLE_MESSAGE_DIGEST_IMPL_H #define D_LIBNETTLE_MESSAGE_DIGEST_IMPL_H #include "common.h" #include #include #include namespace aria2 { class MessageDigestImpl { public: MessageDigestImpl(const nettle_hash* hashInfo); // 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 nettle_hash* hashInfo_; char* ctx_; }; } // namespace aria2 #endif // D_LIBNETTLE_MESSAGE_DIGEST_IMPL_H