2026-02-02 12:24:50 -08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
namespace wowee {
|
|
|
|
|
namespace auth {
|
|
|
|
|
|
|
|
|
|
class Crypto {
|
|
|
|
|
public:
|
|
|
|
|
static std::vector<uint8_t> sha1(const std::vector<uint8_t>& data);
|
|
|
|
|
static std::vector<uint8_t> sha1(const std::string& data);
|
|
|
|
|
|
2026-02-12 02:22:04 -08:00
|
|
|
/**
|
|
|
|
|
* MD5 hash (16 bytes)
|
|
|
|
|
*/
|
|
|
|
|
static std::vector<uint8_t> md5(const std::vector<uint8_t>& data);
|
|
|
|
|
static std::vector<uint8_t> md5(const std::string& data);
|
|
|
|
|
|
2026-02-02 12:24:50 -08:00
|
|
|
/**
|
|
|
|
|
* HMAC-SHA1 message authentication code
|
|
|
|
|
*
|
|
|
|
|
* @param key Secret key
|
|
|
|
|
* @param data Data to authenticate
|
|
|
|
|
* @return 20-byte HMAC-SHA1 hash
|
|
|
|
|
*/
|
|
|
|
|
static std::vector<uint8_t> hmacSHA1(const std::vector<uint8_t>& key,
|
|
|
|
|
const std::vector<uint8_t>& data);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace auth
|
|
|
|
|
} // namespace wowee
|