Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
base32.cpp
Go to the documentation of this file.
2#include <CyoDecode.h>
3#include <CyoEncode.h>
4namespace fc
5{
6 std::vector<char> from_base32( const std::string& b32 )
7 {
8 auto len = cyoBase32DecodeGetLength( b32.size() );
9 std::vector<char> v(len);
10 len = cyoBase32Decode( v.data(), b32.c_str(), b32.size() );
11 v.resize( len );
12 return v;
13 }
14
15 std::string to_base32( const char* data, size_t len )
16 {
17 auto s = cyoBase32EncodeGetLength(len);
18 std::vector<char> b32;
19 b32.resize(s);
20 cyoBase32Encode( b32.data(), data, len );
21 b32.resize( b32.size()-1); // strip the nullterm
22 return std::string(b32.begin(),b32.end());
23 }
24
25 std::string to_base32( const std::vector<char>& vec )
26 {
27 return to_base32( vec.data(), vec.size() );
28 }
29}
namespace sysio::chain
Definition authority.cpp:3
fc::string to_base32(const std::vector< char > &vec)
Definition base32.cpp:25
std::vector< char > from_base32(const fc::string &b32)
Definition base32.cpp:6
char * s
size_t len