Skip to content

Instantly share code, notes, and snippets.

View aksel's full-sized avatar
🤠
Howdy

aksel

🤠
Howdy
View GitHub Profile
@aksel
aksel / encryption.js
Last active March 19, 2018 19:50 — forked from vlucas/encryption.js
Stronger Encryption and Decryption in Node.js
'use strict';
const crypto = require('crypto');
const KEY_LENGTH = 32; // Must be 32 bytes
const IV_LENGTH = 16; // For AES, this is always 16
// Creates 32 byte key (for AES-256), buffer
const createKey = () => crypto.randomBytes(KEY_LENGTH);