Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmillr committed Nov 22, 2024
1 parent 867b21e commit 2ba0436
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,11 @@ expects arguments `a`, `b`, field `Fp`, curve order `n`, cofactor `h`
and coordinates `Gx`, `Gy` of generator point.

**`k` generation** is done deterministically, following
[RFC6979](https://www.rfc-editor.org/rfc/rfc6979). For this you will need
`hmac` & `hash`, which in our implementations is provided by noble-hashes. If
[RFC6979](https://www.rfc-editor.org/rfc/rfc6979). It is suggested to use `extraEntropy`
option, which incorporates randomness into signatures to increase their security.

For k generation, specifying `hmac` & `hash` is required,
which in our implementations is done by noble-hashes. If
you're using different hashing library, make sure to wrap it in the following interface:

```ts
Expand Down Expand Up @@ -460,7 +463,7 @@ type CurveFn = {
signature: Hex | SignatureType,
msgHash: Hex,
publicKey: Hex,
opts?: { lowS?: boolean; prehash?: boolean }
opts?: { lowS?: boolean; prehash?: boolean; format?: 'compact' | 'der' }
) => boolean;
ProjectivePoint: ProjectivePointConstructor;
Signature: SignatureConstructor;
Expand Down Expand Up @@ -536,6 +539,9 @@ const sig = secq256k1.sign(msg, priv); // Sign msg with private key.
const sig2 = secq256k1.sign(msg, priv, { prehash: true }); // hash(msg)
secq256k1.verify(sig, msg, priv); // Verify if sig is correct.

// Default behavior is "try DER, then try compact if fails". Can be explicit:
secq256k1.verify(sig.toCompactHex(), msg, priv, { format: 'compact' });

const Point = secq256k1.ProjectivePoint;
const point = Point.BASE; // Elliptic curve Point class and BASE point static var.
point.add(point).equals(point.double()); // add(), equals(), double() methods
Expand Down

0 comments on commit 2ba0436

Please sign in to comment.