Inside Bitcoin
Opening the selected file…
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright (c) 2009-2010 Satoshi Nakamoto2// Copyright (c) 2009-present The Bitcoin Core developers3// Distributed under the MIT software license, see the accompanying4// file COPYING or http://www.opensource.org/licenses/mit-license.php.6/**7* Why base-58 instead of standard base-64 encoding?8* - Don't want 0OIl characters that look the same in some fonts and9* could be used to create visually identical looking data.10* - A string with non-alphanumeric characters is not as easily accepted as input.11* - E-mail usually won't line-break if there's no punctuation to break at.12* - Double-clicking selects the whole string as one word if it's all alphanumeric.13*/14#ifndef BITCOIN_BASE58_H15#define BITCOIN_BASE58_H17#include <span>18#include <string>19#include <vector>21/**22* Encode a byte span as a base58-encoded string23*/24std::string EncodeBase58(std::span<const unsigned char> input);26/**27* Decode a base58-encoded string (str) into a byte vector (vchRet).28* return true if decoding is successful.29*/30[[nodiscard]] bool DecodeBase58(const std::string& str, std::vector<unsigned char>& vchRet, int max_ret_len);32/**33* Encode a byte span into a base58-encoded string, including checksum34*/35std::string EncodeBase58Check(std::span<const unsigned char> input);37/**38* Decode a base58-encoded string (str) that includes a checksum into a byte39* vector (vchRet), return true if decoding is successful40*/41[[nodiscard]] bool DecodeBase58Check(const std::string& str, std::vector<unsigned char>& vchRet, int max_ret_len);43#endif // BITCOIN_BASE58_H
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.