Cryptography

Shortest and simplest string encryption / decryption with AES-256 in Node.JS

Shortest and simplest string encryption / decryption with AES-256 in Node.JS

Copy and paste the following code in a .js file, then run it. // Libraries const crypto = require('crypto'); // Constants const OUTPUT_FORMAT = "hex"; const ALGORITHM = "aes256"; const KEY = "012345ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const IV = "ABCDEF0123456789"; // Implementations function encrypt(message) { let cipher = crypto.createCipheriv( ALGORITHM, Buffer.from(KEY), Buffer.from(IV) ); return (Buffer.concat(
Hector Perez