-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkey.go
25 lines (19 loc) · 764 Bytes
/
key.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package bip32
import (
"encoding/hex"
"github.com/koba-e964/base58-go"
)
// FirstHardenedChildIndex is the first index of hardened child keys.
// Hardened child keys don't allow for public parent key -> public child key derivation,
// but provide more security than non-hardened child keys.
const FirstHardenedChildIndex uint32 = 0x80000000
const KeyLengthInBytes = 82 // when serialized, public/private keys have this length
var (
publicKeyVersion, _ = hex.DecodeString("0488B21E")
privateKeyVersion, _ = hex.DecodeString("0488ADE4")
testnetPublicKeyVersion, _ = hex.DecodeString("043587CF")
testnetPrivateKeyVersion, _ = hex.DecodeString("04358394")
)
func base58EncodeKeyBytes(a [82]byte) string {
return base58.Encode(a[:], 111)
}