Skip to content

Commit

Permalink
Typos
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmillr committed Feb 15, 2021
1 parent dd86968 commit f65bcec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
11 changes: 6 additions & 5 deletions math.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// To verify curve params, see pairing-friendly-curves spec:
// https://tools.ietf.org/html/draft-irtf-cfrg-pairing-friendly-curves-02
// To verify curve parameters, see pairing-friendly-curves spec:
// https://tools.ietf.org/html/draft-irtf-cfrg-pairing-friendly-curves-09
// Basic math is done over finite fields over q.
// More complicated math is done over polynominal extension fields.
// To simplify calculations in Fq12, we construct extension tower:
Expand All @@ -9,12 +9,13 @@
// Fq6(w) / (w2 - γ) where γ = v

export const CURVE = {
// a characteristic
// characteristic
P: 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaabn,
// an order
// order
r: 0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001n,
// a cofactor
// cofactor
h: 0x396c8c005555e1568c00aaab0000aaabn,
// generator's coordinates
Gx: 0x17f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bbn,
Gy: 0x08b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1n,
b: 4n,
Expand Down
5 changes: 2 additions & 3 deletions test/point.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as fc from "fast-check";
import { Fq, Fq2, PointG1, PointG2, clearCofactorG2 } from "..";
import { CURVE } from "../math";

const NUM_RUNS = Number(process.env.RUNS_COUNT || 10); // reduce to 1 to shorten test time

Expand Down Expand Up @@ -409,8 +410,6 @@ describe("bls12-381 Point", () => {
expect(G.multiply(k).equals(G.multiplyUnsafe(k))).toEqual(true)
}
});
// https://tools.ietf.org/html/draft-irtf-cfrg-hash-to-curve-07#section-8.8.2
const H_EFF = 0xbc69f08f2ee75b3584c6a0ea91b352888e2a8e9145ad7689986ff031508ffe1329c2f178731db956d82bf015d1212b02ec0ec69d7477c1ae954cbc06689f6a359894c0adebbf6b4e8020005aaa95551n;
it("PSI cofactor cleaning same as multiplication", () => {
const points = [
new PointG2(
Expand Down Expand Up @@ -449,7 +448,7 @@ describe("bls12-381 Point", () => {
0x19fbb8b214bd1368a21fbe627574a25e0157459480bbd3a3e7febe5fec82b9ef1cdf49d4c2f12e68d44429403106aeden])),
];
for (let p of points) {
expect(p.multiplyUnsafe(H_EFF).equals(clearCofactorG2(p))).toEqual(true);
expect(p.multiplyUnsafe(CURVE.h_eff).equals(clearCofactorG2(p))).toEqual(true);
}
});
});

0 comments on commit f65bcec

Please sign in to comment.