You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
461 B

  1. package test
  2. import (
  3. "github.com/btcsuite/btcd/btcec"
  4. )
  5. // CreateKey returns a deterministically generated key pair.
  6. func CreateKey(index int32) (*btcec.PrivateKey, *btcec.PublicKey) {
  7. // Avoid all zeros, because it results in an invalid key.
  8. privKey, pubKey := btcec.PrivKeyFromBytes(btcec.S256(),
  9. []byte{0, 0, 0, 0, 0, 0, 0, 0,
  10. 0, 0, 0, 0, 0, 0, 0, 0,
  11. 0, 0, 0, 0, 0, 0, 0, 0,
  12. 0, 0, 0, 0, 0, 0, 0, byte(index + 1)})
  13. return privKey, pubKey
  14. }