CubeCipher is a novel implementation of multiple ciphers to harden security. It encrypts data with Salsa 20, AES, and Twofish, ensuring that even if one of the ciphers is compromised the encrypted data is not exposed. The implementation also derives keys with scrypt to protect against rainbow tables and then authenticates with HMAC to protect against adaptive chosen-ciphertext attacks.
Encryption
cubecipher.encrypt ({
data: new cubecipher.Buffer('Some Important Data'),
key: new cubecipher.Buffer('password'),
progress_hook: function (obj) { /* ... */ }
}, function(err, buff) {
if (! err) {
var ciphertext = buff.toString('hex');
}
});
Decryption
cubecipher.decrypt ({
data: new cubecipher.Buffer(ciphertext, "hex"),
key: new cubecipher.Buffer('password'),
progress_hook: function (obj) { /* ... */ }
}, function (err, buff) {
if (! err) {
console.log(buff.toString());
}
});
var plaintext = buff.toString();