upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/bip32.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/bip32.h')
-rw-r--r--src/bip32.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/bip32.h b/src/bip32.h
index a029444..e9862d5 100644
--- a/src/bip32.h
+++ b/src/bip32.h
@@ -5,7 +5,7 @@
5// 5//
6// This module is deliberately independent from wallet.dat and GUI code. It is 6// This module is deliberately independent from wallet.dat and GUI code. It is
7// the auditable foundation: mnemonic generation/validation, seed derivation, 7// the auditable foundation: mnemonic generation/validation, seed derivation,
8// and hardened private child derivation over secp256k1. 8// and private child derivation over secp256k1.
9 9
10#ifndef BITFLASH_BIP32_H 10#ifndef BITFLASH_BIP32_H
11#define BITFLASH_BIP32_H 11#define BITFLASH_BIP32_H
@@ -16,6 +16,8 @@
16namespace bitflash 16namespace bitflash
17{ 17{
18 18
19static const unsigned int BIP32_HARDENED = 0x80000000U;
20
19struct BIP32PrivateNode 21struct BIP32PrivateNode
20{ 22{
21 std::vector<unsigned char> privateKey; // 32-byte scalar 23 std::vector<unsigned char> privateKey; // 32-byte scalar
@@ -43,6 +45,16 @@ bool BIP32MasterFromSeed(const std::vector<unsigned char>& seed,
43 BIP32PrivateNode& nodeOut, 45 BIP32PrivateNode& nodeOut,
44 std::string& errorOut); 46 std::string& errorOut);
45 47
48bool BIP32DeriveChild(const BIP32PrivateNode& parent,
49 unsigned int childNumber,
50 BIP32PrivateNode& childOut,
51 std::string& errorOut);
52
53bool BIP32DerivePath(const BIP32PrivateNode& root,
54 const std::vector<unsigned int>& path,
55 BIP32PrivateNode& nodeOut,
56 std::string& errorOut);
57
46bool BIP32DeriveHardenedChild(const BIP32PrivateNode& parent, 58bool BIP32DeriveHardenedChild(const BIP32PrivateNode& parent,
47 unsigned int childIndex, 59 unsigned int childIndex,
48 BIP32PrivateNode& childOut, 60 BIP32PrivateNode& childOut,