25 lines
583 B
C++
25 lines
583 B
C++
#pragma once
|
|
|
|
// Small dependency-free encoding helpers shared across the protocol modules.
|
|
|
|
#include <cstdint>
|
|
#include <span>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace Echoion::Protocol::Util
|
|
{
|
|
|
|
using Bytes = std::vector<uint8_t>;
|
|
using ByteView = std::span<const uint8_t>;
|
|
|
|
// Standard base64 (RFC 4648) with '+' '/' and '=' padding.
|
|
std::string base64Encode(ByteView data);
|
|
Bytes base64Decode(const std::string& text);
|
|
|
|
// Lowercase hex, no separators.
|
|
std::string toHex(ByteView data);
|
|
Bytes fromHex(const std::string& hex);
|
|
|
|
} // namespace Echoion::Protocol::Util
|