Bitcoin Core  22.99.0
P2P Digital Currency
parse_hd_keypath.cpp
Go to the documentation of this file.
1 // Copyright (c) 2009-2020 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 
6 #include <test/fuzz/fuzz.h>
7 #include <test/fuzz/util.h>
8 #include <util/bip32.h>
9 
10 #include <cstdint>
11 #include <vector>
12 
13 FUZZ_TARGET(parse_hd_keypath)
14 {
15  const std::string keypath_str(buffer.begin(), buffer.end());
16  std::vector<uint32_t> keypath;
17  (void)ParseHDKeypath(keypath_str, keypath);
18 
19  FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
20  const std::vector<uint32_t> random_keypath = ConsumeRandomLengthIntegralVector<uint32_t>(fuzzed_data_provider);
21  (void)FormatHDKeypath(random_keypath);
22  (void)WriteHDKeypath(random_keypath);
23 }
WriteHDKeypath
std::string WriteHDKeypath(const std::vector< uint32_t > &keypath)
Write HD keypaths as strings.
Definition: bip32.cpp:63
bip32.h
util.h
FUZZ_TARGET
FUZZ_TARGET(parse_hd_keypath)
Definition: parse_hd_keypath.cpp:13
FuzzedDataProvider.h
FormatHDKeypath
std::string FormatHDKeypath(const std::vector< uint32_t > &path)
Definition: bip32.cpp:53
fuzz.h
FuzzedDataProvider
Definition: FuzzedDataProvider.h:31
ParseHDKeypath
bool ParseHDKeypath(const std::string &keypath_str, std::vector< uint32_t > &keypath)
Parse an HD keypaths like "m/7/0'/2000".
Definition: bip32.cpp:12