mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
5d0d611eb0
Split test-crypto-dh.js so that it is less likely to timeout on less powerful bots. PR-URL: https://github.com/nodejs/node/pull/40451 Refs: https://github.com/nodejs/reliability/issues/86 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
16 lines
513 B
JavaScript
16 lines
513 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
const assert = require('assert');
|
|
const crypto = require('crypto');
|
|
|
|
const alice = crypto.createDiffieHellmanGroup('modp5');
|
|
const bob = crypto.createDiffieHellmanGroup('modp5');
|
|
alice.generateKeys();
|
|
bob.generateKeys();
|
|
const aSecret = alice.computeSecret(bob.getPublicKey()).toString('hex');
|
|
const bSecret = bob.computeSecret(alice.getPublicKey()).toString('hex');
|
|
assert.strictEqual(aSecret, bSecret);
|