Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var crypto = require('crypto')
- var rep = function(times, elem) {
- var res = new Array(times);
- for (var i = 0; i < times; ++i) {
- res[i] = elem;
- }
- return res;
- };
- var bs = 192;
- if (process.argv.length == 4) {
- var key = new Buffer(process.argv[2].split(' ').map(function(hex) {
- return parseInt(hex, 16);
- }));
- var iv = new Buffer(process.argv[3].split(' ').map(function(hex) {
- return parseInt(hex, 16);
- }));
- } else {
- var keyLen = bs / 8;
- var key = new Buffer(rep(keyLen, 200));
- var ivLen = 16;
- var iv = new Buffer(rep(ivLen, 200));
- }
- var cipher = crypto.createCipheriv('AES-' + bs + '-CBC', key, iv);
- var plain = "ilovethisgameZz";
- var encrypted = cipher.update(plain, 'ascii', 'base64') + cipher.final('base64');
- console.log(key);
- console.log(iv);
- console.log(encrypted);
Add Comment
Please, Sign In to add comment