diff options
Diffstat (limited to 'src/bip32.h')
| -rw-r--r-- | src/bip32.h | 14 |
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 @@ | |||
| 16 | namespace bitflash | 16 | namespace bitflash |
| 17 | { | 17 | { |
| 18 | 18 | ||
| 19 | static const unsigned int BIP32_HARDENED = 0x80000000U; | ||
| 20 | |||
| 19 | struct BIP32PrivateNode | 21 | struct 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 | ||
| 48 | bool BIP32DeriveChild(const BIP32PrivateNode& parent, | ||
| 49 | unsigned int childNumber, | ||
| 50 | BIP32PrivateNode& childOut, | ||
| 51 | std::string& errorOut); | ||
| 52 | |||
| 53 | bool BIP32DerivePath(const BIP32PrivateNode& root, | ||
| 54 | const std::vector<unsigned int>& path, | ||
| 55 | BIP32PrivateNode& nodeOut, | ||
| 56 | std::string& errorOut); | ||
| 57 | |||
| 46 | bool BIP32DeriveHardenedChild(const BIP32PrivateNode& parent, | 58 | bool BIP32DeriveHardenedChild(const BIP32PrivateNode& parent, |
| 47 | unsigned int childIndex, | 59 | unsigned int childIndex, |
| 48 | BIP32PrivateNode& childOut, | 60 | BIP32PrivateNode& childOut, |