# [−][src]Crate k256

Pure Rust implementation of the secp256k1 (K-256) elliptic curve, including support for the Elliptic Curve Digital Signature Algorithm (ECDSA), Elliptic Curve Diffie-Hellman (ECDH), and general purpose elliptic curve/field arithmetic which can be used to implement protocols based on group operations.

## About secp256k1 (K-256)

secp256k1 is a Koblitz curve commonly used in cryptocurrency applications. The "K-256" name follows NIST notation where P = prime fields, B = binary fields, and K = Koblitz curves (defined over F₂).

The curve is specified as `secp256k1`

by Certicom's SECG in
"SEC 2: Recommended Elliptic Curve Domain Parameters":

https://www.secg.org/sec2-v2.pdf

## ⚠️ Security Warning

The elliptic curve arithmetic contained in this crate has never been independently audited!

This crate has been designed with the goal of ensuring that secret-dependent
operations are performed in constant time (using the `subtle`

crate and
constant-time formulas). However, it has not been thoroughly assessed to ensure
that generated assembly is constant time on common CPU architectures.

USE AT YOUR OWN RISK!

## Minimum Supported Rust Version

Rust **1.44** or higher.

Minimum supported Rust version can be changed in the future, but it will be done with a minor version bump.

## Re-exports

`pub use elliptic_curve;` |

## Modules

ecdh | `ecdh` Elliptic Curve Diffie-Hellman (Ephemeral) Support. |

ecdsa | `ecdsa-core` Elliptic Curve Digital Signature Algorithm (ECDSA). |

## Structs

AffinePoint | `arithmetic` A point on the secp256k1 curve in affine coordinates. |

ProjectivePoint | `arithmetic` A point on the secp256k1 curve in projective coordinates. |

Scalar | `arithmetic` An element in the finite field modulo curve order. |

Secp256k1 | K-256 (secp256k1) elliptic curve. |

## Type Definitions

CompressedPoint | Compressed SEC1-encoded secp256k1 (K-256) point (i.e. public key) |

EncodedPoint | SEC1-encoded secp256k1 (K-256) curve point. |

FieldBytes | secp256k1 (K-256) field element serialized as bytes. |

NonZeroScalar | Non-zero scalar value. |

ScalarBits | secp256k1 field element serialized as bits. |

SecretBytes | `zeroize` Bytes containing a secp256k1 secret scalar |

SecretKey | `zeroize` secp256k1 (K-256) secret key. |