chunk_id
large_stringlengths
36
36
doc_type
large_stringclasses
2 values
category
large_stringclasses
17 values
document
large_stringclasses
50 values
version_raw
large_stringclasses
590 values
chunk_index
int64
0
262
text
large_stringlengths
11
5.69k
file_path
large_stringclasses
882 values
f772b90e-d40c-51e1-a692-ef5da40aa130
docs
nodejs
nodejs_crypto
8x
55
* Returns: [<boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` or `false` depending on the validity of the signature for the data and public key. Verifies the provided data using the given `object` and `signature`. The `object` argument can be either a string cont...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
21504566-81d5-5c58-ad2a-2759fbfc4944
docs
nodejs
nodejs_crypto
8x
56
used to verify the message as specified in section 3.1 of [RFC 4055](https://www.rfc-editor.org/rfc/rfc4055.txt). * `saltLength`: [<integer>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) - salt length for when padding is `RSA_PKCS1_PSS_PADDING`. The special value `crypto.co...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
b194b168-caaa-5948-8a00-f8a2e1dd3575
docs
nodejs
nodejs_crypto
8x
57
## `crypto` module methods and properties[#](#crypto_crypto_module_methods_and_properties) ### crypto.constants[#](#crypto_crypto_constants) Added in: v6.3.0 * Returns: [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) An object containing commonly used constants for...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
e7cc4353-9927-53e5-bcca-811e66c9bbbd
docs
nodejs
nodejs_crypto
8x
58
become deprecated in a future Node.js release. ### crypto.fips[#](#crypto_crypto_fips) Added in: v6.0.0 Property for checking and controlling whether a FIPS compliant crypto provider is currently in use. Setting to true requires a FIPS build of Node.js. ### crypto.createCipher(algorithm, password[, options])[#](#cr...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
f45ad71a-96c3-5839-846c-f27910c70e77
docs
nodejs
nodejs_crypto
8x
59
* `options` [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) * Returns: [<Cipher>](crypto.html#crypto_class_cipher) Creates and returns a `Cipher` object that uses the given `algorithm` and ...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
7d92f4b8-d2fa-51a4-a82d-96de0c4e2177
docs
nodejs
nodejs_crypto
8x
60
iteration, and no salt. The lack of salt allows dictionary attacks as the same password always creates the same key. The low iteration count and non-cryptographically secure hash algorithm allow passwords to be tested very rapidly. In line with OpenSSL's recommendation to use PBKDF2 instead of [`EVP_BytesToKey`](https...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
27730083-ce95-570f-8c4d-838a742ff4b9
docs
nodejs
nodejs_crypto
8x
61
### crypto.createCipheriv(algorithm, key, iv[, options])[#](#crypto_crypto_createcipheriv_algorithm_key_iv_options) History | Version | Changes | | --- | --- | | v8.12.0 | The `iv` parameter may now be `null` for ciphers which do not need an initialization vector. | | v0.1.94 | Added in: v0.1.94 | * `algorithm` [<st...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
e99e3bb4-22a4-580e-95d3-c2fe0a7c9e1e
docs
nodejs
nodejs_crypto
8x
62
* `iv` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [<DataView>](https://developer.mozilla.org/en-US/docs/Web/J...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
b3bc9420-9fd6-5bd9-aae4-36db5c1d085b
docs
nodejs
nodejs_crypto
8x
63
[initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded strings, [Buffers](buffer.html), `TypedArray`, or `DataView`s. If the cipher does not need an initialization vector, `iv` may be `null`. ### crypto.createCredentials(details)[#](#crypto_crypto_createcr...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
59ecfcc2-38a4-5677-9d40-ac27d68d8c71
docs
nodejs
nodejs_crypto
8x
64
[`tls.createSecureContext()`](tls.html#tls_tls_createsecurecontext_options) which has the exact same arguments and return value. Returns a `tls.SecureContext`, as-if [`tls.createSecureContext()`](tls.html#tls_tls_createsecurecontext_options) had been called. ### crypto.createDecipher(algorithm, password[, options])[#...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
1d42f2e7-cf7b-5d49-850d-4d834006cdf7
docs
nodejs
nodejs_crypto
8x
65
* `options` [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) * Returns: [<Decipher>](crypto.html#crypto_class_decipher) Creates and returns a `Decipher` object that uses the given `algorithm...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
20b606fb-7785-5fc1-84e1-ba42b462f649
docs
nodejs
nodejs_crypto
8x
66
[`EVP_BytesToKey`](https://www.openssl.org/docs/man1.0.2/crypto/EVP_BytesToKey.html) it is recommended that developers derive a key and IV on their own using [`crypto.pbkdf2()`](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback) and to use [`crypto.createDecipheriv()`](#crypto_crypto_createdecipheri...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
1af19cd2-7ef5-59d4-809f-3aa76dab9065
docs
nodejs
nodejs_crypto
8x
67
* `key` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [<DataView>](https://developer.mozilla.org/en-US/docs/Web/...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
f6e7c0be-5932-50e4-8ce7-3b1d1aa04ac3
docs
nodejs
nodejs_crypto
8x
68
Creates and returns a `Decipher` object that uses the given `algorithm`, `key` and initialization vector (`iv`). Optional `options` argument controls stream behavior. The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On recent OpenSSL releases, `openssl list-cipher-algorithms` will display the ava...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
2000c651-066c-524a-b4dd-c21d42a76572
docs
nodejs
nodejs_crypto
8x
69
| v8.0.0 | The `prime` argument can be a `Uint8Array` now. | | v6.0.0 | The default for the encoding parameters changed from `binary` to `utf8`. | | v0.11.12 | Added in: v0.11.12 | * `prime` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Buffer>](buffer.html#buffer_...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
8df3abf0-34bd-5080-a058-3127aa91defa
docs
nodejs
nodejs_crypto
8x
70
* `generator` [<number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/Java...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
b7d8cfb7-ca5c-52f9-9e69-f657890cd9c0
docs
nodejs
nodejs_crypto
8x
71
If `primeEncoding` is specified, `prime` is expected to be a string; otherwise a [`Buffer`](buffer.html), `TypedArray`, or `DataView` is expected. If `generatorEncoding` is specified, `generator` is expected to be a string; otherwise a number, [`Buffer`](buffer.html), `TypedArray`, or `DataView` is expected. ### cryp...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
f4e37f22-6d68-5e28-82fb-29a7272ddb0b
docs
nodejs
nodejs_crypto
8x
72
* `generator` [<number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/Java...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
18e90341-56d0-5a78-9021-42356e1a9895
docs
nodejs
nodejs_crypto
8x
73
predefined curve specified by the `curveName` string. Use [`crypto.getCurves()`](#crypto_crypto_getcurves) to obtain a list of available curve names. On recent OpenSSL releases, `openssl ecparam -list_curves` will also display the name and description of each available elliptic curve. ### crypto.createHash(algorithm[,...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
fcc511bd-677c-5520-a7ec-23e6cbb038f9
docs
nodejs
nodejs_crypto
8x
74
version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. On recent releases of OpenSSL, `openssl list-message-digest-algorithms` will display the available digest algorithms. Example: generating the sha256 sum of a file ```None const filename = process.argv[2]; const crypto = require('crypto'); c...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
eaa6ceed-852d-523a-9b7a-745b4b9d32af
docs
nodejs
nodejs_crypto
8x
75
* `key` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [<DataView>](https://developer.mozilla.org/en-US/docs/Web/...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
fa617890-eb62-577f-a999-27485fee2912
docs
nodejs
nodejs_crypto
8x
76
The `key` is the HMAC key used to generate the cryptographic HMAC hash. Example: generating the sha256 HMAC of a file ```None const filename = process.argv[2]; const crypto = require('crypto'); const fs = require('fs'); const hmac = crypto.createHmac('sha256', 'a secret'); const input = fs.createReadStream(filename...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
48de21f7-a289-5f2a-be3b-cd9d198e8067
docs
nodejs
nodejs_crypto
8x
77
Creates and returns a `Sign` object that uses the given `algorithm`. Use [`crypto.getHashes()`](#crypto_crypto_gethashes) to obtain an array of names of the available signing algorithms. Optional `options` argument controls the `stream.Writable` behavior. ### crypto.createVerify(algorithm[, options])[#](#crypto_crypto...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
355ac249-5e56-54a7-92d4-6d52ddf8c2ee
docs
nodejs
nodejs_crypto
8x
78
### crypto.getCiphers()[#](#crypto_crypto_getciphers) Added in: v0.9.3 * Returns: [<string[]>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) An array with the names of the supported cipher algorithms. Example: ```None const ciphers = crypto.getCiphers(); console.log(ciphers)...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
aa68eaf5-b139-5b76-9cfa-bcc78ae649ae
docs
nodejs
nodejs_crypto
8x
79
* Returns: [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Creates a predefined `DiffieHellman` key exchange object. The supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in [RFC 2412](https://www.rfc-editor.org/rfc/rfc2412.txt), but see [Caveats](#crypt...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
3c187ac0-ce30-5e17-b49b-fade4ef0e919
docs
nodejs
nodejs_crypto
8x
80
Example (obtaining a shared secret): ```None const crypto = require('crypto'); const alice = crypto.getDiffieHellman('modp14'); const bob = crypto.getDiffieHellman('modp14'); alice.generateKeys(); bob.generateKeys(); const aliceSecret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); const bobSecret = bob.comp...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
b97d3bae-3548-5a94-8417-b95fa1f308f0
docs
nodejs
nodejs_crypto
8x
81
### crypto.pbkdf2(password, salt, iterations, keylen, digest, callback)[#](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback) History | Version | Changes | | --- | --- | | v8.0.0 | The `digest` parameter is always required now. | | v6.0.0 | Calling this function without passing the `digest` parame...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
b12f119d-2079-522a-8eac-55a5a402b00f
docs
nodejs
nodejs_crypto
8x
82
* `digest` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) * `callback` [<Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) + `err` [<Error>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Obj...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
c22a1517-e7d9-5189-800a-1bb1bdfb8264
docs
nodejs
nodejs_crypto
8x
83
higher the number of iterations, the more secure the derived key will be, but will take a longer amount of time to complete. The `salt` should also be as unique as possible. It is recommended that the salts are random and their lengths are at least 16 bytes. See [NIST SP 800-132](http://nvlpubs.nist.gov/nistpubs/Legac...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
eb9b846a-23ea-5d9e-b935-6487a54c8a6d
docs
nodejs
nodejs_crypto
8x
84
### crypto.pbkdf2Sync(password, salt, iterations, keylen, digest)[#](#crypto_crypto_pbkdf2sync_password_salt_iterations_keylen_digest) History | Version | Changes | | --- | --- | | v6.0.0 | Calling this function without passing the `digest` parameter is deprecated now and will emit a warning. | | v6.0.0 | The default...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
3343751f-6a40-529f-8947-3f2d735411b4
docs
nodejs
nodejs_crypto
8x
85
Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2) implementation. A selected HMAC digest algorithm specified by `digest` is applied to derive a key of the requested byte length (`keylen`) from the `password`, `salt` and `iterations`. If an error occurs an Error will be thrown, otherwise the deri...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
6f7cef24-8f7f-527e-92a2-3b8e214125b9
docs
nodejs
nodejs_crypto
8x
86
An array of supported digest functions can be retrieved using [`crypto.getHashes()`](#crypto_crypto_gethashes). ### crypto.privateDecrypt(privateKey, buffer)[#](#crypto_crypto_privatedecrypt_privatekey_buffer) Added in: v0.11.14 * `privateKey` [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refere...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
32409ce9-f68d-55f8-94b8-467383c7ca1c
docs
nodejs
nodejs_crypto
8x
87
* `buffer` [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [<DataView>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) * Returns: [<Buffer>](buffer.html#buffer_class_bu...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
768546dc-241c-5dae-a4d5-ddc732a941c8
docs
nodejs
nodejs_crypto
8x
88
+ `key` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A PEM encoded private key. + `passphrase` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) An optional passphrase for the private key. + `padding` [<crypto.constan...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
40b9a5f9-8549-5765-873c-594927b6883a
docs
nodejs
nodejs_crypto
8x
89
treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`. ### crypto.publicDecrypt(key, buffer)[#](#crypto_crypto_publicdecrypt_key_buffer) Added in: v1.1.0 * `key` [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | [<string>](https://developer.mozilla...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
9ca5842f-d470-5dad-b567-77798c4037d8
docs
nodejs
nodejs_crypto
8x
90
* `buffer` [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [<DataView>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) * Returns: [<Buffer>](buffer.html#buffer_class_bu...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
3f2eb03c-a2c6-5a9c-940c-b98b1126a8ad
docs
nodejs
nodejs_crypto
8x
91
+ `key` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A PEM encoded public or private key. + `passphrase` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) An optional passphrase for the private key. + `padding` [<cryp...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
c75c3b50-2445-50c0-9d90-fc570c327422
docs
nodejs
nodejs_crypto
8x
92
[`Buffer`](buffer.html) with encrypted content. `key` can be an object or a string. If `key` is a string, it is treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`. Because RSA public keys can be derived from private keys, a private key may be passed instead of a public key. ### crypto.random...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
975437ba-bd26-5d43-ad2e-535c0eb73b3a
docs
nodejs
nodejs_crypto
8x
93
If a `callback` function is provided, the bytes are generated asynchronously and the `callback` function is invoked with two arguments: `err` and `buf`. If an error occurs, `err` will be an Error object; otherwise it is null. The `buf` argument is a [`Buffer`](buffer.html) containing the generated bytes. ```None // As...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
abbce236-de71-5e5a-b3e7-a48f3f6dc27b
docs
nodejs
nodejs_crypto
8x
94
This should normally never take longer than a few milliseconds. The only time when generating the random bytes may conceivably block for a longer period of time is right after boot, when the whole system is still low on entropy. Note that this API uses libuv's threadpool, which can have surprising and negative perform...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
7f70c7b5-a5e4-5102-9a20-d5aacc1e1911
docs
nodejs
nodejs_crypto
8x
95
* `offset` [<number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) **Default:** `0` * `size` [<number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) **Default:** `buffer.length - offset` * Returns: [<Buffer>](buffer.html#buffer_class_buffer...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
d6cdb200-dba5-550b-90de-22790ebbcd46
docs
nodejs
nodejs_crypto
8x
96
* `buffer` [<Buffer>](buffer.html#buffer_class_buffer) | [<Uint8Array>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) Must be supplied. * `offset` [<number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) **Default:** `0` * `size` [<nu...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
f64c05ba-49b0-5951-829c-653a95609f1c
docs
nodejs
nodejs_crypto
8x
97
console.log(buf.toString('hex')); }); crypto.randomFill(buf, 5, (err, buf) => { if (err) throw err; console.log(buf.toString('hex')); }); // The above is equivalent to the following: crypto.randomFill(buf, 5, 5, (err, buf) => { if (err) throw err; console.log(buf.toString('hex')); }); ``` Note that this AP...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
012ddad9-fa42-5cb0-a060-22f14a0d6322
docs
nodejs
nodejs_crypto
8x
98
* `flags` [<crypto.constants>](crypto.html#crypto_crypto_constants_1) **Default:** `crypto.constants.ENGINE_METHOD_ALL` Load and set the `engine` for some or all OpenSSL functions (selected by flags). `engine` could be either an id or a path to the engine's shared library. The optional `flags` argument uses `ENGINE_...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
abc2887f-41cf-5530-835d-919aadd40d55
docs
nodejs
nodejs_crypto
8x
99
### crypto.timingSafeEqual(a, b)[#](#crypto_crypto_timingsafeequal_a_b) Added in: v6.6.0 * `a` [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [<DataView>](https://developer.mozilla.org/en-US/docs/Web/JavaScrip...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
3c5ee890-0a81-549a-a820-62a7d1645a8e
docs
nodejs
nodejs_crypto
8x
100
[capability urls](https://www.w3.org/TR/capability-urls/). `a` and `b` must both be `Buffer`s, `TypedArray`s, or `DataView`s, and they must have the same length. *Note*: Use of `crypto.timingSafeEqual` does not guarantee that the *surrounding* code is timing-safe. Care should be taken to ensure that the surrounding c...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
24d5bc11-6986-5456-926f-b4ee88fa9465
docs
nodejs
nodejs_crypto
8x
101
default was changed after Node.js v0.8 to use [`Buffer`](buffer.html) objects by default instead. ### Recent ECDH Changes[#](#crypto_recent_ecdh_changes) Usage of `ECDH` with non-dynamically generated key pairs has been simplified. Now, [`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_privatekey_encoding) can be c...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
eb8971f8-894a-5cd1-9364-d870905462da
docs
nodejs
nodejs_crypto
8x
102
should be called. The main drawback of using [`ecdh.setPublicKey()`](#crypto_ecdh_setpublickey_publickey_encoding) is that it can be used to put the ECDH key pair into an inconsistent state. ### Support for weak or compromised algorithms[#](#crypto_support_for_weak_or_compromised_algorithms) The `crypto` module still...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
b45bd75e-bfee-58ae-a7d2-b0c603f58947
docs
nodejs
nodejs_crypto
8x
103
at least 2048 bits and that of the curve of ECDSA and ECDH at least 224 bits, to be safe to use for several years. * The DH groups of `modp1`, `modp2` and `modp5` have a key size smaller than 2048 bits and are not recommended. See the reference for other recommendations and details. ## Crypto Constants[#](#cryp...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
1e7918b7-3a4d-5ddc-ad04-fd102d7a4493
docs
nodejs
nodejs_crypto
8x
104
| `SSL_OP_CIPHER_SERVER_PREFERENCE` | Attempts to use the server's preferences instead of the client's when selecting a cipher. Behavior depends on protocol version. See <https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html>. | | `SSL_OP_CISCO_ANYCONNECT` | Instructs OpenSSL to use Cisco's "speshul" versi...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
7453d4b1-816a-5be0-a90e-b2dba1ccc002
docs
nodejs
nodejs_crypto
8x
105
| `SSL_OP_MSIE_SSLV2_RSA_PADDING` | Instructs OpenSSL to disable the workaround for a man-in-the-middle protocol-version vulnerability in the SSL 2.0 server implementation. | | `SSL_OP_NETSCAPE_CA_DN_BUG` | | | `SSL_OP_NETSCAPE_CHALLENGE_BUG` | | | `SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG` | | | `SSL_OP_NETSCAPE_REUS...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
55f8caa0-39f4-5d10-ae5e-315dd7d9a979
docs
nodejs
nodejs_crypto
8x
106
`SSL_OP_PKCS1_CHECK_1` | || `SSL_OP_PKCS1_CHECK_2` | | | `SSL_OP_SINGLE_DH_USE` | Instructs OpenSSL to always create a new key when using temporary/ephemeral DH parameters. | | `SSL_OP_SINGLE_ECDH_USE` | Instructs OpenSSL to always create a new key when using temporary/ephemeral ECDH parameters. | `SSL_OP_SSLEAY_08...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
86608619-1c83-53bc-b011-07dba658e5fc
docs
nodejs
nodejs_crypto
8x
107
| `ENGINE_METHOD_CIPHERS` | Limit engine usage to CIPHERS | | `ENGINE_METHOD_DIGESTS` | Limit engine usage to DIGESTS | | `ENGINE_METHOD_STORE` | Limit engine usage to STORE | | `ENGINE_METHOD_PKEY_METHS` | Limit engine usage to PKEY\_METHDS | | `ENGINE_METHOD_PKEY_ASN1_METHS` | Limit engine usage to PKEY\_ASN1\_METHS ...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
59dae8b6-21d0-5656-89e3-b5d3921f08e0
docs
nodejs
nodejs_crypto
8x
108
| `RSA_PSS_SALTLEN_MAX_SIGN` | Sets the salt length for `RSA_PKCS1_PSS_PADDING` to the maximum permissible value when signing data. | | `RSA_PSS_SALTLEN_AUTO` | Causes the salt length for `RSA_PKCS1_PSS_PADDING` to be determined automatically when verifying a signature. | | `POINT_CONVERSION_COMPRESSED` | | | `POINT_C...
large_dataset/raw/docs/nodejs/crypto/crypto_8x.md
74a7bebf-05ce-56d5-be32-4c1501a4477e
docs
nodejs
nodejs_crypto
9x
0
# Crypto# Source: https://nodejs.org/docs/latest-v9.x/api/crypto.html Version: 9.x [Stability: 2](documentation.html#documentation_stability_index) - Stable The `crypto` module provides cryptographic functionality that includes a set of wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify functions....
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
ed75ce89-c12a-5a38-a5d1-7aa14a05f357
docs
nodejs
nodejs_crypto
9x
1
console.log('crypto support is disabled!'); } ``` ## Class: Certificate[#](#crypto_class_certificate) Added in: v0.11.8 SPKAC is a Certificate Signing Request mechanism originally implemented by Netscape and was specified formally as part of [HTML5's `keygen` element](https://developer.mozilla.org/en-US/docs/Web/H...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
2eb255ac-801e-50a0-8df2-59e807883988
docs
nodejs
nodejs_crypto
9x
2
* `spkac` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [<DataView>](https://developer.mozilla.org/en-US/docs/We...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
5757579f-f7d6-59b9-9b46-1aa8d0032b75
docs
nodejs
nodejs_crypto
9x
3
* `spkac` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [<DataView>](https://developer.mozilla.org/en-US/docs/We...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
6a3be72f-9aa5-5664-99c7-239ec9349a61
docs
nodejs
nodejs_crypto
9x
4
### Certificate.verifySpkac(spkac)[#](#crypto_certificate_verifyspkac_spkac) Added in: v9.0.0 * `spkac` [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [<DataView>](https://developer.mozilla.org/en-US/docs/Web/...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
4e408a2b-d3ce-5038-abb8-31d0ec8e46af
docs
nodejs
nodejs_crypto
9x
5
#### new crypto.Certificate()[#](#crypto_new_crypto_certificate) Instances of the `Certificate` class can be created using the `new` keyword or by calling `crypto.Certificate()` as a function: ```None const crypto = require('crypto'); const cert1 = new crypto.Certificate(); const cert2 = crypto.Certificate(); ``` #...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
854a6939-d529-5171-add5-be612e78a078
docs
nodejs
nodejs_crypto
9x
6
const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string ``` #### certificate.exportPublicKey(spkac)[#](#crypto_certificate_exportpublickey_spkac) Added in: v0.11.8 * `spkac` [<string>](https://developer.mozilla...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
3db790b8-8ba8-5e29-81d5-fb11736c3074
docs
nodejs
nodejs_crypto
9x
7
#### certificate.verifySpkac(spkac)[#](#crypto_certificate_verifyspkac_spkac_1) Added in: v0.11.8 * `spkac` [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [<DataView>](https://developer.mozilla.org/en-US/docs/...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
4451dbdb-16a9-5cbc-87ca-4afc2391e1c4
docs
nodejs
nodejs_crypto
9x
8
data is written to produce encrypted data on the readable side, or * Using the [`cipher.update()`](#crypto_cipher_update_data_inputencoding_outputencoding) and [`cipher.final()`](#crypto_cipher_final_outputencoding) methods to produce the encrypted data. The [`crypto.createCipher()`](#crypto_crypto_createcipher_al...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
ad8aef81-5cb9-50b4-a0e7-e140b2593f0d
docs
nodejs
nodejs_crypto
9x
9
``` Example: Using `Cipher` and piped streams: ```None const crypto = require('crypto'); const fs = require('fs'); const cipher = crypto.createCipher('aes192', 'a password'); const input = fs.createReadStream('test.js'); const output = fs.createWriteStream('test.enc'); input.pipe(cipher).pipe(output); ``` Example:...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
8d8c5d7d-faae-53ec-9d5c-a2e286ca0079
docs
nodejs
nodejs_crypto
9x
10
Returns any remaining enciphered contents. If `outputEncoding` parameter is one of `'latin1'`, `'base64'` or `'hex'`, a string is returned. If an `outputEncoding` is not provided, a [`Buffer`](buffer.html) is returned. Once the `cipher.final()` method has been called, the `Cipher` object can no longer be used to encry...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
2f167471-7894-56b2-b512-67793a58eba1
docs
nodejs
nodejs_crypto
9x
11
### cipher.getAuthTag()[#](#crypto_cipher_getauthtag) Added in: v1.0.0 When using an authenticated encryption mode (only `GCM` is currently supported), the `cipher.getAuthTag()` method returns a [`Buffer`](buffer.html) containing the *authentication tag* that has been computed from the given data. The `cipher.getAut...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
6a2ad555-ab02-51f4-b695-76e43b325d08
docs
nodejs
nodejs_crypto
9x
12
When `autoPadding` is `false`, the length of the entire input data must be a multiple of the cipher's block size or [`cipher.final()`](#crypto_cipher_final_outputencoding) will throw an Error. Disabling automatic padding is useful for non-standard padding, for instance using `0x0` instead of PKCS padding. The `cipher....
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
e952428c-2916-533d-aa3b-be55c51dedbc
docs
nodejs
nodejs_crypto
9x
13
* `data` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [<DataView>](https://developer.mozilla.org/en-US/docs/Web...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
1f91421f-bec0-59d0-804b-4aa4cb6d0aa6
docs
nodejs
nodejs_crypto
9x
14
The `outputEncoding` specifies the output format of the enciphered data, and can be `'latin1'`, `'base64'` or `'hex'`. If the `outputEncoding` is specified, a string using the specified encoding is returned. If no `outputEncoding` is provided, a [`Buffer`](buffer.html) is returned. The `cipher.update()` method can be ...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
dd741800-5577-53ca-8cb7-4489d1d2d0d6
docs
nodejs
nodejs_crypto
9x
15
* Using the [`decipher.update()`](#crypto_decipher_update_data_inputencoding_outputencoding) and [`decipher.final()`](#crypto_decipher_final_outputencoding) methods to produce the unencrypted data. The [`crypto.createDecipher()`](#crypto_crypto_createdecipher_algorithm_password_options) or [`crypto.createDecipheriv(...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
9b93c4d9-7533-529c-91ea-f32295f4dd42
docs
nodejs
nodejs_crypto
9x
16
decipher.end(); ``` Example: Using `Decipher` and piped streams: ```None const crypto = require('crypto'); const fs = require('fs'); const decipher = crypto.createDecipher('aes192', 'a password'); const input = fs.createReadStream('test.enc'); const output = fs.createWriteStream('test.js'); input.pipe(decipher).pip...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
5730e73e-41d4-5b43-9f4e-c83a6cb72e03
docs
nodejs
nodejs_crypto
9x
17
### decipher.final([outputEncoding])[#](#crypto_decipher_final_outputencoding) Added in: v0.1.94 * `outputEncoding` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Returns any remaining deciphered contents. If `outputEncoding` parameter is one of `'latin1'`, `'ascii'` ...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
b4d91a67-4ac9-5b32-8289-0978ab3932ef
docs
nodejs
nodejs_crypto
9x
18
* `buffer` [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [<DataView>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) * Returns the <Cipher> for method chaining. When...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
b6d09ade-ebe9-50b3-bd56-871011150518
docs
nodejs
nodejs_crypto
9x
19
* `buffer` [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [<DataView>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) * Returns the <Cipher> for method chaining. When...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
26323c37-9e30-5cfc-a9c5-a31d03e5dbce
docs
nodejs
nodejs_crypto
9x
20
passing authentication (up to 0.39%). It is highly recommended to associate one of the values 16, 15, 14, 13, 12, 8 or 4 bytes with each key, and to only permit authentication tags of that length, see [NIST SP 800-38D](http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf). The `decipher.setAuth...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
b354bca9-8cad-586b-9c0d-9b2f8a535df4
docs
nodejs
nodejs_crypto
9x
21
multiple of the ciphers block size. The `decipher.setAutoPadding()` method must be called before [`decipher.final()`](#crypto_decipher_final_outputencoding). ### decipher.update(data[, inputEncoding][, outputEncoding])[#](#crypto_decipher_update_data_inputencoding_outputencoding) History | Version | Changes | | ---...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
92b495f2-2b7f-5a01-a43c-0bd83260091b
docs
nodejs
nodejs_crypto
9x
22
* `outputEncoding` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Updates the decipher with `data`. If the `inputEncoding` argument is given, its value must be one of `'latin1'`, `'base64'`, or `'hex'` and the `data` argument is a string using the specified encoding. If...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
2d649fe5-1d89-53d0-a7ab-dcc9fd89e13a
docs
nodejs
nodejs_crypto
9x
23
[`decipher.final()`](#crypto_decipher_final_outputencoding) will result in an error being thrown. ## Class: DiffieHellman[#](#crypto_class_diffiehellman) Added in: v0.5.0 The `DiffieHellman` class is a utility for creating Diffie-Hellman key exchanges. Instances of the `DiffieHellman` class can be created using the...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
26af39d5-aafa-5bc1-83a8-0054b9302e3a
docs
nodejs
nodejs_crypto
9x
24
### diffieHellman.computeSecret(otherPublicKey[, inputEncoding][, outputEncoding])[#](#crypto_diffiehellman_computesecret_otherpublickey_inputencoding_outputencoding) Added in: v0.5.0 * `otherPublicKey` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Buffer>](buffer...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
42b465d6-0f0b-5588-9728-983bcecce3ea
docs
nodejs
nodejs_crypto
9x
25
encoded using specified `outputEncoding`. Encodings can be `'latin1'`, `'hex'`, or `'base64'`. If the `inputEncoding` is not provided, `otherPublicKey` is expected to be a [`Buffer`](buffer.html), `TypedArray`, or `DataView`. If `outputEncoding` is given a string is returned; otherwise, a [`Buffer`](buffer.html) is re...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
25a6dff0-2058-58e0-aee9-499e0ef93937
docs
nodejs
nodejs_crypto
9x
26
### diffieHellman.getGenerator([encoding])[#](#crypto_diffiehellman_getgenerator_encoding) Added in: v0.5.0 * `encoding` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Returns the Diffie-Hellman generator in the specified `encoding`, which can be `'latin1'`, `'hex'`, ...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
d7778618-ae0f-5f5d-8822-2c54103fdb06
docs
nodejs
nodejs_crypto
9x
27
### diffieHellman.getPrivateKey([encoding])[#](#crypto_diffiehellman_getprivatekey_encoding) Added in: v0.5.0 * `encoding` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Returns the Diffie-Hellman private key in the specified `encoding`, which can be `'latin1'`, `'hex...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
dca9cff7-ffe6-5670-a8dd-cb31868fe15d
docs
nodejs
nodejs_crypto
9x
28
### diffieHellman.setPrivateKey(privateKey[, encoding])[#](#crypto_diffiehellman_setprivatekey_privatekey_encoding) Added in: v0.5.0 * `privateKey` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://dev...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
d9235368-bec5-5e00-a96a-2a36333096d4
docs
nodejs
nodejs_crypto
9x
29
### diffieHellman.setPublicKey(publicKey[, encoding])[#](#crypto_diffiehellman_setpublickey_publickey_encoding) Added in: v0.5.0 * `publicKey` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://develope...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
4749ed89-2db3-53f8-b402-ba07fd3fff67
docs
nodejs
nodejs_crypto
9x
30
### diffieHellman.verifyError[#](#crypto_diffiehellman_verifyerror) Added in: v0.11.12 A bit field containing any warnings and/or errors resulting from a check performed during initialization of the `DiffieHellman` object. The following values are valid for this property (as defined in `constants` module): * `DH_CH...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
5a6fc498-fd10-5bdc-9eef-82cee38ebbc5
docs
nodejs
nodejs_crypto
9x
31
// Exchange and generate the secret... const aliceSecret = alice.computeSecret(bobKey); const bobSecret = bob.computeSecret(aliceKey); assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); // OK ``` ### ecdh.computeSecret(otherPublicKey[, inputEncoding][, outputEncoding])[#](#crypto_ecdh_compute...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
9dc5c654-182c-560c-a3db-562d90dea40d
docs
nodejs
nodejs_crypto
9x
32
* `outputEncoding` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Computes the shared secret using `otherPublicKey` as the other party's public key and returns the computed shared secret. The supplied key is interpreted using specified `inputEncoding`, and the returned ...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
15feb3f3-7ad2-5f1b-8c3e-db1654584595
docs
nodejs
nodejs_crypto
9x
33
Generates private and public EC Diffie-Hellman key values, and returns the public key in the specified `format` and `encoding`. This key should be transferred to the other party. The `format` argument specifies point encoding and can be `'compressed'` or `'uncompressed'`. If `format` is not specified, the point will b...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
578040f9-0052-58c9-821c-bcd191208892
docs
nodejs
nodejs_crypto
9x
34
### ecdh.getPublicKey([encoding][, format])[#](#crypto_ecdh_getpublickey_encoding_format) Added in: v0.11.14 * `encoding` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) * `format` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
e5d62a19-56a7-5292-9d0d-33931803b77c
docs
nodejs
nodejs_crypto
9x
35
* `privateKey` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [<DataView>](https://developer.mozilla.org/en-US/do...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
3fc02b27-bcab-5127-af78-25b2170523d8
docs
nodejs
nodejs_crypto
9x
36
### ecdh.setPublicKey(publicKey[, encoding])[#](#crypto_ecdh_setpublickey_publickey_encoding) Added in: v0.11.14Deprecated since: v5.2.0 [Stability: 0](documentation.html#documentation_stability_index) - Deprecated * `publicKey` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Strin...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
5c3c2c9c-9526-5486-bd9f-af10fbe1e75d
docs
nodejs
nodejs_crypto
9x
37
only requires a private key and the other party's public key to compute the shared secret. Typically either [`ecdh.generateKeys()`](#crypto_ecdh_generatekeys_encoding_format) or [`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_privatekey_encoding) will be called. The [`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatek...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
3663d551-4b01-53ce-a516-84b928a803bc
docs
nodejs
nodejs_crypto
9x
38
const aliceSecret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); const bobSecret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); // aliceSecret and bobSecret should be the same shared secret value console.log(aliceSecret === bobSecret); ``` ## Class: Hash[#](#crypto_class_hash) Added in: v0.1.92 Th...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
34201f13-ef39-5f42-9b03-13fadf1cba19
docs
nodejs
nodejs_crypto
9x
39
const hash = crypto.createHash('sha256'); hash.on('readable', () => { const data = hash.read(); if (data) { console.log(data.toString('hex')); // Prints: // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 } }); hash.write('some data to hash'); hash.end(); ``` Example: Using `Hash...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
9a27c8fa-3bd6-5a5e-92b8-638a82cc6bb5
docs
nodejs
nodejs_crypto
9x
40
### hash.digest([encoding])[#](#crypto_hash_digest_encoding) Added in: v0.1.92 * `encoding` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Calculates the digest of all of the data passed to be hashed (using the [`hash.update()`](#crypto_hash_update_data_inputencoding)...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
8ff71333-9c04-500e-a1cb-21d6d66be439
docs
nodejs
nodejs_crypto
9x
41
* `data` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [<DataView>](https://developer.mozilla.org/en-US/docs/Web...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
2d782dcc-0a7b-5f3e-b7f5-8f0fa941ba70
docs
nodejs
nodejs_crypto
9x
42
## Class: Hmac[#](#crypto_class_hmac) Added in: v0.1.94 The `Hmac` Class is a utility for creating cryptographic HMAC digests. It can be used in one of two ways: * As a [stream](stream.html) that is both readable and writable, where data is written to produce a computed HMAC digest on the readable side, or * Using...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
9f38bb55-8bb5-5fca-8e36-82ec9200f034
docs
nodejs
nodejs_crypto
9x
43
hmac.write('some data to hash'); hmac.end(); ``` Example: Using `Hmac` and piped streams: ```None const crypto = require('crypto'); const fs = require('fs'); const hmac = crypto.createHmac('sha256', 'a secret'); const input = fs.createReadStream('test.js'); input.pipe(hmac).pipe(process.stdout); ``` Example: Using ...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
d1cbf7a7-24dc-5a25-8656-d41ceac2c3fe
docs
nodejs
nodejs_crypto
9x
44
The `encoding` can be `'hex'`, `'latin1'` or `'base64'`. If `encoding` is provided a string is returned; otherwise a [`Buffer`](buffer.html) is returned; The `Hmac` object can not be used again after `hmac.digest()` has been called. Multiple calls to `hmac.digest()` will result in an error being thrown. ### hmac.upda...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md
1ea0ba71-3606-5c7d-b613-f51acdc0b67e
docs
nodejs
nodejs_crypto
9x
45
Updates the `Hmac` content with the given `data`, the encoding of which is given in `inputEncoding` and can be `'utf8'`, `'ascii'` or `'latin1'`. If `encoding` is not provided, and the `data` is a string, an encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html), `TypedArray`, or `DataView`, then `inp...
large_dataset/raw/docs/nodejs/crypto/crypto_9x.md