Web Development Articles

Page 274 of 801

crypto.createVerify() Method in Node.js

Mayank Agarwal
Mayank Agarwal
Updated on 15-Mar-2026 971 Views

The crypto.createVerify() method creates and returns a Verify object that uses the specified algorithm for digital signature verification. This method is essential for validating data integrity and authenticity in cryptographic operations. Syntax crypto.createVerify(algorithm, [options]) Parameters The parameters are described as below: algorithm – String that specifies the algorithm name to be used while creating the verify object/instance. You can use crypto.getHashes() to get available signing algorithms. ...

Read More

crypto.generateKeyPair() Method in Node.js

Mayank Agarwal
Mayank Agarwal
Updated on 15-Mar-2026 2K+ Views

The crypto.generateKeyPair() method generates a new asymmetric key pair of the specified type. Supported types include RSA, DSA, EC, Ed25519, Ed448, X25519, X448 and DH. The function behaves as if keyObject.export has been called on its result when a publicKeyEncoding or privateKeyEncoding is specified, otherwise the respective part of keyObject is returned. Syntax crypto.generateKeyPair(type, options, callback) Parameters The above parameters are described as below: type – It holds the string type for which keys need to be generated. Supported types are - RSA, DSA, EC, ...

Read More

crypto.getCiphers() Method in Node.js

Mayank Agarwal
Mayank Agarwal
Updated on 15-Mar-2026 337 Views

The crypto.getCiphers() method returns an array containing names of all the supported cipher algorithms in Node.js. This method is useful for discovering what encryption algorithms are available on your system. Syntax crypto.getCiphers() Parameters This method takes no parameters as it simply returns a list of all available cipher algorithms. Return Value Returns an array of strings, where each string is the name of a supported cipher algorithm. Basic Example Here's how to get all available cipher algorithms: // Importing the crypto module const crypto = require('crypto'); // ...

Read More

crypto.getHashes() Method in Node.js

Mayank Agarwal
Mayank Agarwal
Updated on 15-Mar-2026 300 Views

The crypto.getHashes() method returns an array containing the names of all supported hash algorithms available in Node.js. This is useful for discovering what hashing options are available in your current Node.js environment. Syntax crypto.getHashes() Parameters This method takes no parameters and returns an array of supported hash algorithm names. Return Value Returns an array of strings, where each string is the name of a supported hash algorithm. Example // Importing the crypto module const crypto = require('crypto'); // Get all supported hash algorithms const hashAlgorithms = crypto.getHashes(); ...

Read More

crypto.privateDecrypt() Method in Node.js

Mayank Agarwal
Mayank Agarwal
Updated on 15-Mar-2026 2K+ Views

The crypto.privateDecrypt() method is used for decrypting data that was previously encrypted using the corresponding public key with crypto.publicEncrypt(). This method is essential for implementing asymmetric encryption in Node.js applications. Syntax crypto.privateDecrypt(privateKey, buffer) Parameters The method accepts the following parameters: privateKey – Can be an Object, String, Buffer, or KeyObject containing: oaepHash – Hash function for OAEP padding and MGF1. Default: 'sha1' oaepLabel – Label for OAEP padding. ...

Read More

crypto.randomFill() Method in Node.js

Mayank Agarwal
Mayank Agarwal
Updated on 15-Mar-2026 311 Views

The crypto.randomFill() method in Node.js fills an existing buffer with cryptographically strong random data. Unlike crypto.randomBytes() which creates a new buffer, randomFill() fills a provided buffer with random data. Syntax crypto.randomFill(buffer, [offset], [size], [callback]) Parameters buffer – The buffer to be filled. Supported types: Buffer, TypedArray, ArrayBuffer, DataView. Maximum size is 2**31-1. offset – Starting position for filling (optional). Default is 0. size – Number of bytes to fill from the offset (optional). Default is buffer.length - offset. callback – Function called when operation completes or errors occur (optional). Example: Basic ...

Read More

crypto.randomFillSync() Method in Node.js

Mayank Agarwal
Mayank Agarwal
Updated on 15-Mar-2026 520 Views

The crypto.randomFillSync() method takes a buffer argument and returns the buffer by filling it with its encrypted value. As the name suggests, this will be a sync process. Syntax crypto.randomFillSync(buffer, [offset], [size]) Parameters The above parameters are described as below − buffer – This field contains the data content. Possible buffer types are: string, TypedArray, Buffer, ArrayBuffer, DataView. The size of the buffer cannot be greater than 2**31-1. ...

Read More

crypto.scrypt() Method in Node.js

Mayank Agarwal
Mayank Agarwal
Updated on 15-Mar-2026 884 Views

The crypto.scrypt() method provides an asynchronous implementation of the scrypt password-based key derivation function. Scrypt is designed to be computationally expensive and memory-intensive, making it resistant to brute-force attacks by requiring significant resources to compute. Syntax crypto.scrypt(password, salt, keylen, [options], callback) Parameters The parameters are described below: password – The password to derive a key from. Can be a string, Buffer, TypedArray, or DataView. ...

Read More

Decipher.final() Method in Node.js

Mayank Agarwal
Mayank Agarwal
Updated on 15-Mar-2026 435 Views

The decipher.final() method in Node.js is used to return the remaining decrypted data from a decipher object. It is part of the crypto module's Decipher class and must be called to complete the decryption process. Once called, the decipher object cannot be used to decrypt additional data. Syntax decipher.final([outputEncoding]) Parameters outputEncoding – Optional. The encoding format for the output. Possible values include 'utf8', 'hex', 'base64', etc. If not specified, a Buffer is returned. Return Value Returns a Buffer or string containing the final decrypted data, depending on whether outputEncoding is ...

Read More

decipher.update() Method in Node.js

Mayank Agarwal
Mayank Agarwal
Updated on 15-Mar-2026 460 Views

The decipher.update() method is used to decrypt encrypted data incrementally in Node.js. It processes encrypted data according to specified encoding formats and is part of the Decipher class within the crypto module. Syntax decipher.update(data, [inputEncoding], [outputEncoding]) Parameters data – The encrypted data to be decrypted. Can be a string or Buffer depending on inputEncoding. inputEncoding – (Optional) The encoding of the input data. Common values: 'hex', 'base64'. If omitted, data is treated as a Buffer. outputEncoding – (Optional) The encoding for ...

Read More
Showing 2731–2740 of 8,010 articles
« Prev 1 272 273 274 275 276 801 Next »
Advertisements