Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions doc/api/crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -703,18 +703,18 @@ If the `inputEncoding` is not provided, `key` is expected to be a [`Buffer`][],
Example (uncompressing a key):

```js
const { ECDH } = require('crypto');
const crypto = require('crypto');

const ecdh = ECDH('secp256k1');
const ecdh = crypto.createECDH('secp256k1');
ecdh.generateKeys();

const compressedKey = ecdh.getPublicKey('hex', 'compressed');

const uncompressedKey = ECDH.convertKey(compressedKey,
'secp256k1',
'hex',
'hex',
'uncompressed');
const uncompressedKey = crypto.ECDH.convertKey(compressedKey,
'secp256k1',
'hex',
'hex',
'uncompressed');

// the converted key and the uncompressed public key should be the same
console.log(uncompressedKey === ecdh.getPublicKey('hex'));
Expand Down