/* */ #ifndef D_LIBGCRYPT_MESSAGE_DIGEST_IMPL_H #define D_LIBGCRYPT_MESSAGE_DIGEST_IMPL_H #include "common.h" #include #include #include "SharedHandle.h" namespace aria2 { class MessageDigestImpl { private: int hashFunc_; gcry_md_hd_t ctx_; MessageDigestImpl(int hashFunc); // We don't implement copy ctor. MessageDigestImpl(const MessageDigestImpl&); // We don't implement assignment operator. MessageDigestImpl& operator==(const MessageDigestImpl&); public: ~MessageDigestImpl(); static SharedHandle sha1(); static SharedHandle 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); }; } // namespace aria2 #endif // D_LIBGCRYPT_MESSAGE_DIGEST_IMPL_H