Skip to content

Commit 21fed10

Browse files
panvaaduh95
authored andcommitted
benchmark: add crypto class benchmarks
Measure construction and low-cost method paths for crypto classes whose state is stored in native or private slots. Signed-off-by: Filip Skokan <panva.ip@gmail.com> PR-URL: #65518 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
1 parent 87daea4 commit 21fed10

2 files changed

Lines changed: 292 additions & 0 deletions

File tree

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
'use strict';
2+
3+
const common = require('../common.js');
4+
const assert = require('node:assert');
5+
const crypto = require('node:crypto');
6+
const fs = require('node:fs');
7+
const path = require('node:path');
8+
9+
const fixtureDir = path.resolve(__dirname, '../../test/fixtures/keys');
10+
const certificate = fs.readFileSync(path.join(fixtureDir, 'agent1-cert.pem'));
11+
const dhPrime = crypto.getDiffieHellman('modp14').getPrime();
12+
const key = Buffer.alloc(32, 0x01);
13+
const keyObject = crypto.createSecretKey