VOOZH about

URL: https://www.geeksforgeeks.org/node-js/node-js-cipher-update-method/

⇱ Node.js cipher.update() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Node.js cipher.update() Method

Last Updated : 16 Sep, 2021

The cipher.update() method is an inbuilt application programming interface of class Cipher within crypto module which is used to update the cipher with data according to the given encoding format.

Syntax:

const cipher.update(data[, inputEncoding][, outputEncoding])

Parameters: This method takes the following parameter:

  • data: It is used to update the cipher by new content.
  • inputEncoding: Input encoding format.
  • outputEncoding: Output encoding format.

Return Value: This method returns the object of buffer containing the cipher value.

Example 1: Filename: index.js

Output:

e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa

Example 2: Filename: index.js

Output:

5850288b1848440f0c410400403f7b456293229b5231c17d2b83b602f252714b

Run the index.js file using the following command:

node index.js

Reference: https://nodejs.org/dist/latest-v12.x/docs/api/crypto.html#crypto_cipher_update_data_inputencoding_outputencoding

Comment

Explore