Skip to content

Instantly share code, notes, and snippets.

View LukasPol's full-sized avatar

Lukas Pol Dos Santos Paes LukasPol

View GitHub Profile
@LukasPol
LukasPol / javascript.js
Created May 15, 2023 12:56 — forked from chaintng/javascript.js
Encryption Decryption Javascript and Ruby
// 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")