Skip to content

Instantly share code, notes, and snippets.

View OliverDimitrov's full-sized avatar

Oliver Dimitrov OliverDimitrov

View GitHub Profile
@kexoth
kexoth / AESCrypt.js
Created March 20, 2014 00:04
AES 128 Encryption/Decription with CBC, PKCS7 Padding & Base64 Encoding/Decoding.
var http = require('http');
var url = require('url');
var crypto = require('crypto');
var AESCrypt = {};
AESCrypt.decrypt = function(cryptkey, iv, encryptdata) {
encryptdata = new Buffer(encryptdata, 'base64').toString('binary');
var decipher = crypto.createDecipheriv('aes-128-cbc', cryptkey, iv),
decoded = decipher.update(encryptdata, 'binary', 'utf8');