Encrypt and Decrypt
NODEJS const express = require('express') const app = express() // Middleware to parse JSON request body app.use(express.json()); app.post('/', (req, res) => { // Includes crypto module const crypto = require('crypto'); // Defining algorithm const algorithm = 'aes-192-cbc'; // Defining password const password = 'bncaskdbvasbvlaslslasfhj'; // Defining key const key = crypto.scryptSync(password, 'GfG', 24); console.log(key); // Defininf iv const iv = Buffer.alloc(16, 0); console.log(iv); // Creating decipher const decipher = crypto.createDecipheriv(algorithm, key, iv); // Declaring decrypted let decrypted = ''; // Reading data decipher.on('readable', () => { let chunk; while (null !== (chunk = decipher.read())) { decrypted += chunk.toString('utf8'); } }); ...