Skip to content

Commit

Permalink
put fields on curve
Browse files Browse the repository at this point in the history
  • Loading branch information
mitschabaude committed Nov 22, 2023
1 parent 3a40f7d commit 916bc21
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion crypto/elliptic_curve.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { bigIntToBits } from './bigint-helpers.js';
import { FiniteField, Fp, inverse, mod, p, q } from './finite_field.js';
import {
FiniteField,
Fp,
createField,
inverse,
mod,
p,
q,
} from './finite_field.js';
export {
Pallas,
Vesta,
Expand Down Expand Up @@ -501,8 +509,14 @@ function createCurveAffine({
// TODO: lift this limitation by using other formulas (in projectiveScale) for a != 0
if (a !== 0n) throw Error('createCurveAffine only supports a = 0');
let hasCofactor = cofactor !== undefined && cofactor !== 1n;

const Field = createField(p);
const Scalar = createField(order);
return {
name,
Field,
Scalar,

modulus: p,
order,
a,
Expand Down

0 comments on commit 916bc21

Please sign in to comment.