2013-06-13 12:45:48 -05:00
|
|
|
btcec
|
|
|
|
=====
|
|
|
|
|
2021-03-04 17:12:45 -05:00
|
|
|
[](https://github.com/btcsuite/btcd/actions)
|
2017-05-25 11:29:23 -05:00
|
|
|
[](http://copyfree.org)
|
2021-11-18 18:25:56 -08:00
|
|
|
[](https://pkg.go.dev/github.com/btcsuite/btcd/btcec/v2)
|
2013-12-23 11:41:02 -06:00
|
|
|
|
2013-12-28 15:04:12 -06:00
|
|
|
Package btcec implements elliptic curve cryptography needed for working with
|
|
|
|
Bitcoin (secp256k1 only for now). It is designed so that it may be used with the
|
2014-08-10 15:10:55 -05:00
|
|
|
standard crypto/ecdsa packages provided with go. A comprehensive suite of test
|
|
|
|
is provided to ensure proper functionality. Package btcec was originally based
|
|
|
|
on work from ThePiachu which is licensed under the same terms as Go, but it has
|
2015-05-01 01:28:01 -05:00
|
|
|
signficantly diverged since then. The btcsuite developers original is licensed
|
|
|
|
under the liberal ISC license.
|
2013-06-13 13:27:23 -05:00
|
|
|
|
2015-02-06 10:09:24 -06:00
|
|
|
Although this package was primarily written for btcd, it has intentionally been
|
2013-06-13 13:27:23 -05:00
|
|
|
designed so it can be used as a standalone package for any projects needing to
|
|
|
|
use secp256k1 elliptic curve cryptography.
|
|
|
|
|
2015-10-23 11:34:50 -05:00
|
|
|
## Installation and Updating
|
2013-06-13 13:27:23 -05:00
|
|
|
|
|
|
|
```bash
|
2021-11-18 18:25:56 -08:00
|
|
|
$ go install -u -v github.com/btcsuite/btcd/btcec/v2
|
2013-06-13 13:27:23 -05:00
|
|
|
```
|
|
|
|
|
2014-08-10 15:13:11 -05:00
|
|
|
## Examples
|
|
|
|
|
2021-11-18 18:25:56 -08:00
|
|
|
* [Sign Message](https://pkg.go.dev/github.com/btcsuite/btcd/btcec/v2#example-package--SignMessage)
|
2014-08-10 15:13:11 -05:00
|
|
|
Demonstrates signing a message with a secp256k1 private key that is first
|
|
|
|
parsed form raw bytes and serializing the generated signature.
|
|
|
|
|
2021-11-18 18:25:56 -08:00
|
|
|
* [Verify Signature](https://pkg.go.dev/github.com/btcsuite/btcd/btcec/v2#example-package--VerifySignature)
|
2014-08-10 15:13:11 -05:00
|
|
|
Demonstrates verifying a secp256k1 signature against a public key that is
|
|
|
|
first parsed from raw bytes. The signature is also parsed from raw bytes.
|
|
|
|
|
2013-06-13 13:27:23 -05:00
|
|
|
## License
|
|
|
|
|
2014-08-10 15:12:28 -05:00
|
|
|
Package btcec is licensed under the [copyfree](http://copyfree.org) ISC License
|
|
|
|
except for btcec.go and btcec_test.go which is under the same license as Go.
|
2013-06-13 13:27:23 -05:00
|
|
|
|