Cryp.js
Usage
var Cryp = require('cryp');
var crypto = require('crypto');
var cryp = new Cryp([crypto.pbkdf2Sync('pASsWoRD', 'SaLt', 4096, 32)]);
var data = cryp.encrypt('hello', 'base64');
cryp.decrypt(data, 'base64', 'utf8') == 'hello';
var data = cryp.encrypt('hello');
cryp.decrypt(data, 'utf8') == 'hello';
cryp.decrypt(data).toString() == 'hello';
var data = cryp.encrypt('hello', 'base64');
data = 'a' + data;
cryp.decrypt(data, 'base64', 'utf8') == null;
var data = cryp.encrypt('hello', 'base64');
var cryp2 = new Cryp([
crypto.pbkdf2Sync('NEWpASsWoRD', 'SaLt', 4096, 32),
crypto.pbkdf2Sync('pASsWoRD', 'SaLt', 4096, 32)
]);
cryp2.decrypt(data, 'base64', 'utf8') == 'hello';
var data = cryp.sign('hello');
cryp.unsign(data) == 'hello';
var data = cryp.sign('hello');
data = 'a' + data;
cryp.unsign(data) == null;
var data = cryp.sign('hello');
var cryp2 = new Cryp([
crypto.pbkdf2Sync('NEWpASsWoRD', 'SaLt', 4096, 32),
crypto.pbkdf2Sync('pASsWoRD', 'SaLt', 4096, 32)
]);
cryp2.unsign(data) == 'hello';
License
MIT