Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
cashaddr.cpp
Go to the documentation of this file.
1// Copyright (c) 2018-2019 The Bitcoin 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#include <cashaddr.h>
7
8#include <string>
9#include <vector>
10
12 std::vector<uint8_t> buffer = {17, 79, 8, 99, 150, 189, 208, 162,
13 22, 23, 203, 163, 36, 58, 147, 227,
14 139, 2, 215, 100, 91, 38, 11, 141,
15 253, 40, 117, 21, 16, 90, 200, 24};
16 bench.batch(buffer.size()).unit("byte").run([&] {
17 cashaddr::Encode("bitcoincash", buffer);
18 });
19}
20
22 const char *addrWithPrefix =
23 "bitcoincash:qprnwmr02d7ky9m693qufj5mgkpf4wvssv0w86tkjd";
24 const char *addrNoPrefix = "qprnwmr02d7ky9m693qufj5mgkpf4wvssv0w86tkjd";
25 bench.run([&] {
26 cashaddr::Decode(addrWithPrefix, "bitcoincash");
27 cashaddr::Decode(addrNoPrefix, "bitcoincash");
28 });
29}
30
#define BENCHMARK(n)
Definition bench.h:65
static void CashAddrEncode(benchmark::Bench &bench)
Definition cashaddr.cpp:11
static void CashAddrDecode(benchmark::Bench &bench)
Definition cashaddr.cpp:21
Main entry point to nanobench's benchmarking facility.
Definition nanobench.h:616
std::pair< std::string, data > Decode(const std::string &str, const std::string &default_prefix)
Decode a cashaddr string.
Definition cashaddr.cpp:214
std::string Encode(const std::string &prefix, const data &payload)
Encode a cashaddr string.
Definition cashaddr.cpp:198
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