doc: improve ECDH example

PR-URL: https://github.com/nodejs/node/pull/22607
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Tobias Nießen 2018-09-03 10:51:13 +02:00
parent 1f679107cc
commit 64cf96d684
No known key found for this signature in database
GPG Key ID: 718207F8FD156B70

View File

@ -703,9 +703,9 @@ If the `inputEncoding` is not provided, `key` is expected to be a [`Buffer`][],
Example (uncompressing a key):
```js
const { ECDH } = require('crypto');
const { createECDH, ECDH } = require('crypto');
const ecdh = ECDH('secp256k1');
const ecdh = createECDH('secp256k1');
ecdh.generateKeys();
const compressedKey = ecdh.getPublicKey('hex', 'compressed');