veriblock-pop-cpp
C++11 Libraries for leveraging VeriBlock Proof-Of-Proof blockchain technology.
base59.hpp
1// Copyright (c) 2019-2022 Xenios SEZC
2// https://www.veriblock.org
3// Distributed under the MIT software license, see the accompanying
4// file LICENSE or http://www.opensource.org/licenses/mit-license.php.
5
6#ifndef ALT_INTEGRATION_VERIBLOCK_BASE59_HPP
7#define ALT_INTEGRATION_VERIBLOCK_BASE59_HPP
8
9#include <string>
10#include <vector>
11#include <veriblock/pop/validation_state.hpp>
12
13namespace altintegration {
14
16std::string EncodeBase59(const unsigned char *pbegin,
17 const unsigned char *pend);
18
20std::string EncodeBase59(const uint8_t *buf, size_t size);
21
23template <typename T,
24 typename = typename std::enable_if<sizeof(typename T::value_type) ==
25 1>::type>
26std::string EncodeBase59(const T &container) {
27 const uint8_t *ptr = container.data();
28 return EncodeBase59(ptr, ptr + container.size());
29}
30
32bool DecodeBase59(const std::string &input,
33 std::vector<uint8_t> &out,
34 ValidationState &state);
35
36} // namespace altintegration
37
38#endif
Class that is used for storing validation state.
Defines logging helpers.
Definition: block.hpp:14
std::string EncodeBase59(const unsigned char *pbegin, const unsigned char *pend)
Encode input bytes to base59.
bool DecodeBase59(const std::string &input, std::vector< uint8_t > &out, ValidationState &state)
Decode base59 string into bytes.