noble-curves/benchmark/modular.js

11 lines
399 B
JavaScript
Raw Normal View History

2023-02-27 21:41:23 +03:00
import { run, mark } from 'micro-bmark';
import { secp256k1 } from '../secp256k1.js';
run(async () => {
console.log(`\x1b[36mmodular, secp256k1 field\x1b[0m`);
const { Fp } = secp256k1.CURVE;
await mark('invert a', 30000, () => Fp.inv(2n ** 232n - 5910n));
await mark('invert b', 30000, () => Fp.inv(2n ** 231n - 5910n));
await mark('sqrt', 15000, () => Fp.sqrt(2n ** 231n - 5910n));
});