commit
38e86d4a07
23 files changed
+3219
No files matched your search
@@ -0,0 +1,24 @@
|
||||
#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
|
||||
Reference in new issue
Block a user