doc.go 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright (c) 2013-2014 The btcsuite developers
  2. // Copyright (c) 2015-2019 The Decred developers
  3. // Use of this source code is governed by an ISC
  4. // license that can be found in the LICENSE file.
  5. /*
  6. Package secp256k1 implements optimized secp256k1 elliptic curve operations.
  7. This package provides an optimized pure Go implementation of elliptic curve
  8. cryptography operations over the secp256k1 curve as well as data structures and
  9. functions for working with public and private secp256k1 keys. See
  10. https://www.secg.org/sec2-v2.pdf for details on the standard.
  11. In addition, sub packages are provided to produce, verify, parse, and serialize
  12. ECDSA signatures and EC-Schnorr-DCRv0 (a custom Schnorr-based signature scheme
  13. specific to Decred) signatures. See the README.md files in the relevant sub
  14. packages for more details about those aspects.
  15. An overview of the features provided by this package are as follows:
  16. - Private key generation, serialization, and parsing
  17. - Public key generation, serialization and parsing per ANSI X9.62-1998
  18. - Parses uncompressed, compressed, and hybrid public keys
  19. - Serializes uncompressed and compressed public keys
  20. - Specialized types for performing optimized and constant time field operations
  21. - FieldVal type for working modulo the secp256k1 field prime
  22. - ModNScalar type for working modulo the secp256k1 group order
  23. - Elliptic curve operations in Jacobian projective coordinates
  24. - Point addition
  25. - Point doubling
  26. - Scalar multiplication with an arbitrary point
  27. - Scalar multiplication with the base point (group generator)
  28. - Point decompression from a given x coordinate
  29. - Nonce generation via RFC6979 with support for extra data and version
  30. information that can be used to prevent nonce reuse between signing
  31. algorithms
  32. It also provides an implementation of the Go standard library crypto/elliptic
  33. Curve interface via the S256 function so that it may be used with other packages
  34. in the standard library such as crypto/tls, crypto/x509, and crypto/ecdsa.
  35. However, in the case of ECDSA, it is highly recommended to use the ecdsa sub
  36. package of this package instead since it is optimized specifically for secp256k1
  37. and is significantly faster as a result.
  38. Although this package was primarily written for dcrd, it has intentionally been
  39. designed so it can be used as a standalone package for any projects needing to
  40. use optimized secp256k1 elliptic curve cryptography.
  41. Finally, a comprehensive suite of tests is provided to provide a high level of
  42. quality assurance.
  43. Use of secp256k1 in Decred
  44. At the time of this writing, the primary public key cryptography in widespread
  45. use on the Decred network used to secure coins is based on elliptic curves
  46. defined by the secp256k1 domain parameters.
  47. */
  48. package secp256k1