mirror of https://github.com/lightninglabs/loop
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
461 B
Go
18 lines
461 B
Go
6 years ago
|
package test
|
||
|
|
||
|
import (
|
||
|
"github.com/btcsuite/btcd/btcec"
|
||
|
)
|
||
|
|
||
|
// CreateKey returns a deterministically generated key pair.
|
||
|
func CreateKey(index int32) (*btcec.PrivateKey, *btcec.PublicKey) {
|
||
|
// Avoid all zeros, because it results in an invalid key.
|
||
|
privKey, pubKey := btcec.PrivKeyFromBytes(btcec.S256(),
|
||
|
[]byte{0, 0, 0, 0, 0, 0, 0, 0,
|
||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||
|
0, 0, 0, 0, 0, 0, 0, byte(index + 1)})
|
||
|
|
||
|
return privKey, pubKey
|
||
|
}
|