Kylin/Encrypt/SecureHashAlgorithm.h
2023-08-01 13:54:17 +08:00

27 lines
699 B
C++

#ifndef SECUREHASHALGORITHM_H
#define SECUREHASHALGORITHM_H
#include <string>
#include <string_view>
class SecureHashAlgorithmPrivate;
class SecureHashAlgorithm {
public:
using Sha256DigestType = uint8_t[32];
enum Type {
SHA256,
};
SecureHashAlgorithm();
~SecureHashAlgorithm();
int update(const unsigned char *input, size_t ilen);
int finish(unsigned char *output);
static int sha256(const unsigned char *input, size_t ilen, unsigned char *output);
static std::string sha256(const std::string_view &input, Sha256DigestType &digest);
private:
SecureHashAlgorithmPrivate *m_d{nullptr};
};
#endif // SECUREHASHALGORITHM_H