Skip to content

Commit

Permalink
fix: noble test
Browse files Browse the repository at this point in the history
  • Loading branch information
dcposch committed Apr 16, 2024
1 parent 29475ae commit 216bcb7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test-vectors/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@ async function main() {
const wycheproofVectors = wycheproofVectorsJSONL
.split("\n")
.map((line) => JSON.parse(line) as Vector);
console.log(`Loaded ${wycheproofVectors.length} Wycheproof vectors`);

const randomVectors = randomVectorsJSONL
.split("\n")
.map((line) => JSON.parse(line) as Vector);
console.log(`Loaded ${randomVectors.length} random vectors`);

const vectors = [...wycheproofVectors, ...randomVectors];

console.log(`Testing ${vectors.length} vectors`);
for (const vector of vectors) {
// Convert hex strings to Uint8Arrays
const x = Buffer.from(vector.x, "hex");
Expand Down Expand Up @@ -73,7 +76,7 @@ async function main() {
// Verify signature using @noble/curves
const pub = new Uint8Array([0x04, ...x, ...y]);
const resultNoble = p256.verify(sig, hash, pub);
assert(resultSubtle === vector.valid, "@noble/curves " + vector.comment);
assert(resultNoble === vector.valid, "@noble/curves " + vector.comment);
}
}

Expand Down

0 comments on commit 216bcb7

Please sign in to comment.