Skip to content

A simple utility to encrypt data using passwords (PBKDF2+aes-256-cbc+HMAC) to and from strings

License

Notifications You must be signed in to change notification settings

djMax/pbkdf2-simple-crypt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pbkdf2-simple-crypt

Build Status Dependency Status Coverage Status npm version

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);
            });
        });

About

A simple utility to encrypt data using passwords (PBKDF2+aes-256-cbc+HMAC) to and from strings

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published