Bitcoin Core 31.99.0
P2P Digital Currency
Functions
bip32.cpp File Reference
#include <util/bip32.h>
#include <tinyformat.h>
#include <util/strencodings.h>
#include <algorithm>
#include <cstdint>
#include <optional>
#include <span>
#include <sstream>
#include <string_view>
Include dependency graph for bip32.cpp:

Go to the source code of this file.

Functions

util::Expected< KeyPathElement, std::string > ParseKeyPathElement (std::span< const char > elem)
 Parse a single key path element like "0", "0'", or "0h". More...
 
bool ParseHDKeypath (const std::string &keypath_str, std::vector< uint32_t > &keypath)
 Parse an HD keypaths like "m/7/0'/2000". More...
 
std::string FormatHDKeypath (const std::vector< uint32_t > &path, bool apostrophe)
 
std::string WriteHDKeypath (const std::vector< uint32_t > &keypath, bool apostrophe)
 Write HD keypaths as strings. More...
 
bool HasHardenedDerivation (std::span< const uint32_t > keypath)
 Whether a parsed HD keypath contains at least one hardened derivation step. More...
 

Function Documentation

◆ FormatHDKeypath()

std::string FormatHDKeypath ( const std::vector< uint32_t > &  path,
bool  apostrophe 
)

Definition at line 62 of file bip32.cpp.

Here is the caller graph for this function:

◆ HasHardenedDerivation()

bool HasHardenedDerivation ( std::span< const uint32_t >  keypath)

Whether a parsed HD keypath contains at least one hardened derivation step.

Definition at line 77 of file bip32.cpp.

Here is the caller graph for this function:

◆ ParseHDKeypath()

bool ParseHDKeypath ( const std::string &  keypath_str,
std::vector< uint32_t > &  keypath 
)

Parse an HD keypaths like "m/7/0'/2000".

Definition at line 41 of file bip32.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ParseKeyPathElement()

util::Expected< KeyPathElement, std::string > ParseKeyPathElement ( std::span< const char >  elem)

Parse a single key path element like "0", "0'", or "0h".

Returns the derivation index and hardened status, or an error message.

Definition at line 17 of file bip32.cpp.

Here is the caller graph for this function:

◆ WriteHDKeypath()

std::string WriteHDKeypath ( const std::vector< uint32_t > &  keypath,
bool  apostrophe 
)

Write HD keypaths as strings.

Definition at line 72 of file bip32.cpp.

Here is the call graph for this function:
Here is the caller graph for this function: