Functions | |
| void | digitsMap (const char *digits, uint8_t digits_size, uint8_t *map) |
| bool | isValid (const char *str, size_t str_size, const uint8_t *map) noexcept |
| bool | isValid (std::string_view str, const uint8_t *map) noexcept |
| 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 | encode (const uint8_t *data, size_t data_size, char *str, size_t str_size, uint8_t base, const char *digits) |
| std::string | encode (std::span< const uint8_t > data, 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) |
| std::vector< uint8_t > | decode (std::string_view str, uint8_t base, const char *digits, const uint8_t *map) |
| void baseN::digitsMap | ( | const char * | digits, |
| uint8_t | digits_size, | ||
| uint8_t * | map ) |
| digits | char[base] array of digits |
| digits_size | size of digits array. Equals to base |
| map | [out] uint8_t[256] array, where at an index equal to the value of the symbol is the index of this symbol in the digits array. 255 if there is no symbol |
| basen::Exception(ALPH_COLLISION) | if alphabet contain same chars |
|
noexcept |
| str | [in] pointer to string |
| str_size | |
| map | uint8_t[256] array, where at an index equal to the value of the symbol is the index of this symbol in the digits array. 255 if there is no symbol |
|
noexcept |
| str | string or string_view which you want to decode |
| map | uint8_t[256] array, where at an index equal to the value of the symbol is the index of this symbol in the digits array. 255 if there is no symbol |
| size_t baseN::sizeEncoded | ( | std::span< const uint8_t > | data, |
| uint8_t | base ) |
| data | vector or span of data which you want to encode |
| base | from 1 to 255 |
| basen::Exception(BASE) | if base < 2 || base > 254 |
| size_t baseN::sizeDecoded | ( | std::string_view | str, |
| uint8_t | base, | ||
| const char * | digits ) |
| str | string or string_view which you want to decode |
| base | from 1 to 255 |
| digits | char[base] array of digits |
| basen::Exception(BASE) | if base < 2 || base > 254 |
| basen::Exception(OVERFLOW) | if if there is an overflow |
| size_t baseN::encode | ( | const uint8_t * | data, |
| size_t | data_size, | ||
| char * | str, | ||
| size_t | str_size, | ||
| uint8_t | base, | ||
| const char * | digits ) |
| data | [in] pointer to data which you want encode |
| data_size | |
| str | [out] pointer to string for encoded data output |
| str_size | |
| base | from 1 to 255 |
| digits | char[base] array of digits std::vector<uint8_t> data;
std::string str(baseN::sizeEncoded(data, 58), ' ');
// deleting leading zeroes
str.erase(str.begin(), str.begin() + offset);
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) |
| basen::Exception(BASE) | if base < 2 || base > 254 |
| std::string baseN::encode | ( | std::span< const uint8_t > | data, |
| uint8_t | base, | ||
| const char * | digits ) |
| data | vector or span of data which you want to encode |
| base | from 1 to 255 |
| digits | char[base] array of digits std::vector<uint8_t> data;
|
| size_t baseN::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 ) |
| str | [in] pointer to string which you want decode |
| str_size | |
| data | [out] pointer to data for encoded string output |
| data_size | |
| base | from 1 to 255 |
| digits | char[base] array of digits |
| map | uint8_t[256] array, where at an index equal to the value of the symbol is the index of this symbol in the digits array. 255 if there is no symbol std::string str;
std::vector<uint8_t> data(baseN::sizeDecoded(str, 58));
auto offset = baseN::decode(str.data(), str.size(), data.data(), data.size(), 58, base58::digits, base58::map);
// deleting leading zeroes
data.erase(data.begin(), data.begin() + offset);
const uint8_t map[256] 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) |
| basen::Exception(BASE) | if base < 2 || base > 254 |
| basen::Exception(OUT_OF_ALPH) | if out of alphabet |
| std::vector< uint8_t > baseN::decode | ( | std::string_view | str, |
| uint8_t | base, | ||
| const char * | digits, | ||
| const uint8_t * | map ) |
| str | string or string_view which you want to decode |
| base | from 1 to 255 |
| digits | char[base] array of digits |
| map | uint8_t[256] array, where at an index equal to the value of the symbol is the index of this symbol in the digits array. 255 if there is no symbol std::string str;
|