Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
base58.cpp
Go to the documentation of this file.
1// Copyright (c) 2016 The Bitcoin Core developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#include <bench/bench.h>
6
7#include <base58.h>
8
9#include <array>
10#include <vector>
11
13 static const std::vector<uint8_t> buffer = {
14 17, 79, 8, 99, 150, 189, 208, 162, 22, 23, 203,
15 163, 36, 58, 147, 227, 139, 2, 215, 100, 91, 38,
16 11, 141, 253, 40, 117, 21, 16, 90, 200, 24};
17 bench.batch(buffer.size()).unit("byte").run([&] { EncodeBase58(buffer); });
18}
19
21 static const std::vector<uint8_t> buffer = {
22 17, 79, 8, 99, 150, 189, 208, 162, 22, 23, 203,
23 163, 36, 58, 147, 227, 139, 2, 215, 100, 91, 38,
24 11, 141, 253, 40, 117, 21, 16, 90, 200, 24};
25 bench.batch(buffer.size()).unit("byte").run([&] {
27 });
28}
29
31 const char *addr = "17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem";
32 std::vector<uint8_t> vch;
33 bench.batch(strlen(addr)).unit("byte").run([&] {
34 (void)DecodeBase58(addr, vch, 64);
35 });
36}
37
std::string EncodeBase58(Span< const uint8_t > input)
Why base-58 instead of standard base-64 encoding?
Definition base58.cpp:101
std::string EncodeBase58Check(Span< const uint8_t > input)
Encode a byte span into a base58-encoded string, including checksum.
Definition base58.cpp:152
static bool DecodeBase58(const char *psz, std::vector< uint8_t > &vch, int max_ret_len)
Definition base58.cpp:38
static void Base58Decode(benchmark::Bench &bench)
Definition base58.cpp:30
static void Base58Encode(benchmark::Bench &bench)
Definition base58.cpp:12
static void Base58CheckEncode(benchmark::Bench &bench)
Definition base58.cpp:20
#define BENCHMARK(n)
Definition bench.h:65
Main entry point to nanobench's benchmarking facility.
Definition nanobench.h:616
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition random.h:85