UNPKG

e-lado

Version:

[![CircleCI](https://circleci.com/gh/sharetribe/sharetribe/tree/master.svg?style=svg)](https://circleci.com/gh/sharetribe/sharetribe/tree/master) [![Dependency Status](https://gemnasium.com/sharetribe/sharetribe.png)](https://gemnasium.com/sharetribe/shar

18 lines 652 B
var test = require('tape'); var crypto = require('../'); test('ciphers', function (t) { crypto.listCiphers().forEach(function (cipher) { t.test(cipher, function (t) { t.plan(1); var data = crypto.randomBytes(562); var password = crypto.randomBytes(20); var crypter = crypto.createCipher(cipher, password); var decrypter = crypto.createDecipher(cipher, password); var out = []; out.push(decrypter.update(crypter.update(data))); out.push(decrypter.update(crypter.final())); out.push(decrypter.final()); t.equals(data.toString('hex'), Buffer.concat(out).toString('hex')); }); }); });