Inside Bitcoin
Opening the selected file…
Inside Bitcoin
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) 2016-present The Bitcoin Core developers2// Distributed under the MIT software license, see the accompanying3// file COPYING or http://www.opensource.org/licenses/mit-license.php.5#include <base58.h>6#include <bench/bench.h>8#include <array>9#include <cstring>10#include <vector>13static void Base58Encode(benchmark::Bench& bench)14{15static const std::array<unsigned char, 32> buff = {16{1717, 79, 8, 99, 150, 189, 208, 162, 22, 23, 203, 163, 36, 58, 147,18227, 139, 2, 215, 100, 91, 38, 11, 141, 253, 40, 117, 21, 16, 90,19200, 2420}21};22bench.batch(buff.size()).unit("byte").run([&] {23EncodeBase58(buff);24});25}28static void Base58CheckEncode(benchmark::Bench& bench)29{30static const std::array<unsigned char, 32> buff = {31{3217, 79, 8, 99, 150, 189, 208, 162, 22, 23, 203, 163, 36, 58, 147,33227, 139, 2, 215, 100, 91, 38, 11, 141, 253, 40, 117, 21, 16, 90,34200, 2435}36};37bench.batch(buff.size()).unit("byte").run([&] {38EncodeBase58Check(buff);39});40}43static void Base58Decode(benchmark::Bench& bench)44{45const char* addr = "17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem";46std::vector<unsigned char> vch;47bench.batch(strlen(addr)).unit("byte").run([&] {48(void) DecodeBase58(addr, vch, 64);49});50}53BENCHMARK(Base58Encode);54BENCHMARK(Base58CheckEncode);55BENCHMARK(Base58Decode);
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.