std::string operator()( const KeyType& key ) const { using data_type = typename KeyType::data_type; constexpr int position = Storage::template position<KeyType>(); constexpr bool is_default = position == DefaultPosition; checksummed_data<data_type> wrapper; wrapper.data = key.serialize(); wrapper.check = checksummed_data<data_type>::calculate_checksum(wrapper.data, !is_default ? Prefixes[position] : nullptr); auto packed = raw::pack( wrapper ); auto data_str = to_base58( packed.data(), packed.size() ); if (!is_default) { data_str = string(Prefixes[position]) + "_" + data_str; } return data_str; }
char *p2sh_to_base58(const tal_t *ctx, bool test_net, const struct ripemd160 *p2sh) { return to_base58(ctx, test_net ? 196 : 5, p2sh); }
char *bitcoin_to_base58(const tal_t *ctx, bool test_net, const struct bitcoin_address *addr) { return to_base58(ctx, test_net ? 111 : 0, &addr->addr); }
std::string public_key::to_base58() const { public_key_data key = serialize(); return to_base58( key ); }
void pack( fc::value& v, const fc::signature_t& s ) { fc::vector<char> ve = fc::raw::pack( s ); v = to_base58( ve.data(), ve.size() ); }
void pack( fc::value& v, const fc::private_key_t& s ) { fc::vector<char> ve = fc::raw::pack( s ); v = to_base58( ve.data(), ve.size() ); }
void pack( fc::value& v, const fc::public_key_t& s ) { fc::vector<char> ve = fc::raw::pack( s ); v = to_base58( ve.data(), size_t(ve.size()) ); }