2023-08-01 13:54:17 +08:00
|
|
|
#ifndef __ENCRYPT_H__
|
|
|
|
#define __ENCRYPT_H__
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <string_view>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
class Encrypt {
|
|
|
|
public:
|
2024-08-16 11:41:24 +08:00
|
|
|
using Sha1DigestType = unsigned char[20];
|
2023-08-01 13:54:17 +08:00
|
|
|
static std::string encode64(const char *data, size_t size);
|
|
|
|
static std::string encode64(const std::string_view &data);
|
|
|
|
static std::string decode64(const std::string_view &data);
|
|
|
|
static std::string sha1sum(const std::string_view &data, Sha1DigestType &digest);
|
|
|
|
static std::string sha1sum(const std::vector<char> &data, Sha1DigestType &digest);
|
|
|
|
static std::string sha1sum(const char *data, size_t size, Sha1DigestType &digest);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __ENCRYPT_H__
|