Cryptography

A collection of 19 posts
Shortest and simplest string encryption / decryption with AES-256 in Node.JS
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(
1 min read