pbkdf2-simple-crypt
v1.0.1
Published
A simple utility to encrypt data using passwords (PBKDF2+aes-256-cbc+HMAC) to and from strings
Downloads
8
Maintainers
Readme
pbkdf2-simple-crypt
A simple encrypt/decrypt library that uses PBKDF2 to derive a key from a password (while generating a securely-random salt), encrypt using aes-256-cbc and return a string. That string includes the salt, the iv, an HMAC (hmac-sha1, which is fine as a mac), and the cipher text. The upshot of all this is you can simply encrypt and decrypt simple strings and we'll work out validity checking, etc. I really tried to find another module that did this simple thing properly but could not. If there is one, file an issue; if there's an issue with mine I promise to fix it.
A simple example of encrypting and decrypting some text:
crypt.encrypt('this is a test', 'youcantseeme', function (err, cipherText) {
crypt.decrypt(cipherText, 'youcantseeme', function (decErr, plain) {
assert.equal(plain, plainText);
});
});