This commit is contained in:
Paul Miller 2022-12-17 00:25:58 +00:00
parent 80edb3323a
commit 31f780027a
No known key found for this signature in database
GPG Key ID: 697079DA6878B89B

@ -70,14 +70,17 @@ const someonesPubkey = secp256k1.getPublicKey(secp256k1.utils.randomPrivateKey()
const shared = secp256k1.getSharedSecret(key, someonesPubkey); const shared = secp256k1.getSharedSecret(key, someonesPubkey);
``` ```
### Overview ## API
- [Overview](#overview)
- [edwards: Twisted Edwards curve](#edwards-twisted-edwards-curve) - [edwards: Twisted Edwards curve](#edwards-twisted-edwards-curve)
- [montgomery: Montgomery curve](#montgomery-montgomery-curve) - [montgomery: Montgomery curve](#montgomery-montgomery-curve)
- [weierstrass: Short Weistrass curve](#weierstrass-short-weistrass-curve) - [weierstrass: Short Weistrass curve](#weierstrass-short-weistrass-curve)
- [modular](#modular) - [modular](#modular)
- [utils](#utils) - [utils](#utils)
### Overview
* All arithmetics is done with JS bigints in finite fields * All arithmetics is done with JS bigints in finite fields
* Curve variables, order (number of points on curve), field prime (over which the modular division would be done) * Curve variables, order (number of points on curve), field prime (over which the modular division would be done)
are required are required
@ -101,9 +104,10 @@ const shared = secp256k1.getSharedSecret(key, someonesPubkey);
- `add()`, `subtract()`, `equals()` - `add()`, `subtract()`, `equals()`
- `multiply()` - `multiply()`
Every group also has `BASE` (generator) and `ZERO` (infinity) static properties. Every group also has `BASE` (generator) and `ZERO` (infinity) static properties.
* Every curve exports `CURVE` object
* Every curve exports `utils`: * Every curve exports `utils`:
* `randomPrivateKey()` * `randomPrivateKey()` specific for the curve, avoiding modulo bias
* `mod` & `invert` methods: basically utilities from `modular` with default `P` * `mod()` & `invert()` methods: function from `modular` with default `P` set to CURVE
### edwards: Twisted Edwards curve ### edwards: Twisted Edwards curve