libbasen v1.1.0
encoding/decoding from arbitrary base
Loading...
Searching...
No Matches
hex.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <span>
5#include <string>
6#include <vector>
7
8namespace hex
9{
13 extern const char digits[17];
14 extern const uint8_t map[256];
15
19 bool isValid(const char *str, size_t str_size) noexcept;
24 bool isValid(std::string_view str) noexcept;
25
31 size_t sizeEncoded(std::span<const uint8_t> data);
36 size_t sizeDecoded(std::string_view str) noexcept;
37
44 void encode(const uint8_t *data, size_t data_size, char *str, size_t str_size);
51 std::string encode(std::span<const uint8_t> data);
52
60 void decode(const char *str, size_t str_size, uint8_t *data, size_t data_size);
67 std::vector<uint8_t> decode(std::string_view str);
68}
Definition hex.hpp:9
void decode(const char *str, size_t str_size, uint8_t *data, size_t data_size)
const uint8_t map[256]
size_t sizeDecoded(std::string_view str) noexcept
void encode(const uint8_t *data, size_t data_size, char *str, size_t str_size)
const char digits[17]
lower case chars
size_t sizeEncoded(std::span< const uint8_t > data)
bool isValid(const char *str, size_t str_size) noexcept