libbasen v1.1.0
encoding/decoding from arbitrary base
Loading...
Searching...
No Matches
base58.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 base58
9{
13 extern const char digits[59];
14 extern const uint8_t map[256];
15
16 bool isValid(const char *str, size_t str_size) noexcept;
17 bool isValid(std::string_view str) noexcept;
18
22 size_t sizeEncoded(std::span<const uint8_t> data);
23 size_t sizeDecoded(std::string_view str) noexcept;
24
29 size_t encode(const uint8_t *data, size_t data_size, char *str, size_t str_size);
30 std::string encode(std::span<const uint8_t> data);
31
36 size_t decode(const char *str, size_t str_size, uint8_t *data, size_t data_size);
37 std::vector<uint8_t> decode(std::string_view str);
38
43 std::string encodeCheck(std::span<const uint8_t> data);
50 std::vector<uint8_t> decodeCheck(std::string_view str);
51}
Definition base58.hpp:9
std::vector< uint8_t > decodeCheck(std::string_view str)
std::string encodeCheck(std::span< const uint8_t > data)
size_t decode(const char *str, size_t str_size, uint8_t *data, size_t data_size)
bool isValid(const char *str, size_t str_size) noexcept
const char digits[59]
bitcoin alphabet
size_t sizeDecoded(std::string_view str) noexcept
const uint8_t map[256]
size_t encode(const uint8_t *data, size_t data_size, char *str, size_t str_size)
size_t sizeEncoded(std::span< const uint8_t > data)