libbasen v1.1.0
encoding/decoding from arbitrary base
Loading...
Searching...
No Matches
baseN.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 baseN
9{
16 void digitsMap(const char *digits, uint8_t digits_size, uint8_t *map);
23 bool isValid(const char *str, size_t str_size, const uint8_t *map) noexcept;
29 bool isValid(std::string_view str, const uint8_t *map) noexcept;
30
37 size_t sizeEncoded(std::span<const uint8_t> data, uint8_t base);
46 size_t sizeDecoded(std::string_view str, uint8_t base, const char *digits);
47
67 size_t encode(const uint8_t *data, size_t data_size, char *str, size_t str_size, uint8_t base, const char *digits);
78 std::string encode(std::span<const uint8_t> data, uint8_t base, const char *digits);
79
101 size_t decode(const char *str, size_t str_size, uint8_t *data, size_t data_size, uint8_t base, const char *digits, const uint8_t *map);
113 std::vector<uint8_t> decode(std::string_view str, uint8_t base, const char *digits, const uint8_t *map);
114}
Definition baseN.hpp:9
bool isValid(const char *str, size_t str_size, const uint8_t *map) noexcept
void digitsMap(const char *digits, uint8_t digits_size, uint8_t *map)
size_t encode(const uint8_t *data, size_t data_size, char *str, size_t str_size, uint8_t base, const char *digits)
size_t sizeEncoded(std::span< const uint8_t > data, uint8_t base)
size_t sizeDecoded(std::string_view str, uint8_t base, const char *digits)
size_t decode(const char *str, size_t str_size, uint8_t *data, size_t data_size, uint8_t base, const char *digits, const uint8_t *map)