Adjust readme and ed25519 docs

This commit is contained in:
Paul Miller 2023-04-12 02:16:47 +00:00
parent d3d03ff115
commit 71f6948612
No known key found for this signature in database
GPG Key ID: 697079DA6878B89B
2 changed files with 4 additions and 5 deletions

@ -363,7 +363,7 @@ import { randomBytes } from '@noble/hashes/utils';
const Fp = Field(2n ** 255n - 19n); const Fp = Field(2n ** 255n - 19n);
const ed25519 = twistedEdwards({ const ed25519 = twistedEdwards({
a: -1n, a: Fp.create(-1n),
d: Fp.div(-121665n, 121666n), // -121665n/121666n mod p d: Fp.div(-121665n, 121666n), // -121665n/121666n mod p
Fp: Fp, Fp: Fp,
n: 2n ** 252n + 27742317777372353535851937790883648493n, n: 2n ** 252n + 27742317777372353535851937790883648493n,
@ -887,7 +887,6 @@ Upgrading from [@noble/bls12-381](https://github.com/paulmillr/noble-bls12-381):
- PointG2.fromSignature -> Signature.decode, PointG2.toSignature -> Signature.encode - PointG2.fromSignature -> Signature.decode, PointG2.toSignature -> Signature.encode
- Fp2 ORDER was corrected - Fp2 ORDER was corrected
## Resources ## Resources
Useful articles about the library or its primitives: Useful articles about the library or its primitives:

@ -97,13 +97,13 @@ const Fp = Field(ED25519_P, undefined, true);
const ed25519Defaults = { const ed25519Defaults = {
// Param: a // Param: a
a: BigInt(-1), a: BigInt(-1), // Fp.create(-1) is proper; our way still works and is faster
// Equal to -121665/121666 over finite field. // d is equal to -121665/121666 over finite field.
// Negative number is P - number, and division is invert(number, P) // Negative number is P - number, and division is invert(number, P)
d: BigInt('37095705934669439343138083508754565189542113879843219016388785533085940283555'), d: BigInt('37095705934669439343138083508754565189542113879843219016388785533085940283555'),
// Finite field 𝔽p over which we'll do calculations; 2n ** 255n - 19n // Finite field 𝔽p over which we'll do calculations; 2n ** 255n - 19n
Fp, Fp,
// Subgroup order: how many points ed25519 has // Subgroup order: how many points curve has
// 2n ** 252n + 27742317777372353535851937790883648493n; // 2n ** 252n + 27742317777372353535851937790883648493n;
n: BigInt('7237005577332262213973186563042994240857116359379907606001950938285454250989'), n: BigInt('7237005577332262213973186563042994240857116359379907606001950938285454250989'),
// Cofactor // Cofactor