feat(base58): unfixed bug with double \0 and incorrect real str_size
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
#include <base/hex.hpp>
|
||||
#include <base/baseN.hpp>
|
||||
#include <base/base58.hpp>
|
||||
#include <base/base64.hpp>
|
||||
#include <base/hash/sha256.hpp>
|
||||
#include <base/baseN.hpp>
|
||||
#include <base/hash/sha256.hpp>
|
||||
#include <base/hex.hpp>
|
||||
|
||||
|
||||
27
include/base/base58.hpp
Normal file
27
include/base/base58.hpp
Normal file
@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace base58
|
||||
{
|
||||
extern const char digits[59];
|
||||
extern const int8_t map[256];
|
||||
|
||||
bool isValid(const char *str, uint64_t str_size) noexcept;
|
||||
bool isValid(std::string_view str) noexcept;
|
||||
|
||||
uint64_t sizeEncoded(std::span<const uint8_t> data) noexcept;
|
||||
uint64_t sizeDecoded(std::string_view str) noexcept;
|
||||
|
||||
void encode(const uint8_t *data, uint64_t data_size, char *str, uint64_t str_size) noexcept;
|
||||
std::string encode(std::span<const uint8_t> data) noexcept;
|
||||
|
||||
void decode(const char *str, uint64_t str_size, uint8_t *data, uint64_t data_size) noexcept;
|
||||
std::vector<uint8_t> decode(std::string_view str) noexcept;
|
||||
|
||||
std::string encodeCheck(std::span<const uint8_t> data) noexcept;
|
||||
std::vector<uint8_t> decodeCheck(std::string_view str);
|
||||
}
|
||||
Reference in New Issue
Block a user