Skip to content

Instantly share code, notes, and snippets.

Avatar
👋
hi!

Alex Papworth alexpapworth

👋
hi!
  • London
View GitHub Profile
@chaintng
chaintng / javascript.js
Created Jun 9, 2018
Encryption Decryption Javascript and Ruby
View javascript.js
// IDEA FROM: https://stackoverflow.com/questions/33929712/crypto-in-nodejs-and-ruby
var crypto = require('crypto'),
algorithm = 'aes-256-cbc',
key = 'SOME_RANDOM_KEY_32_CHR_123456789', // 32 Characters
iv = "0000000000000000"; // 16 Characters
function encrypt(text){
var cipher = crypto.createCipheriv(algorithm,key,iv)
var crypted = cipher.update(text,'utf-8',"base64")
You can’t perform that action at this time.