node-encrypter
v0.0.1
Published
Encrypt and decrypt strings.
Downloads
13
Maintainers
Readme
node-encrypter
npm simple module to easily encrypt and decrypt strings & passwords.
GitHub Repo: https://github.com/sannjayy/node-encrypter
This module does not have any third-party dependencies.
Install using npm / yarn
npm install node-encrypter
yarn add node-encrypter
Example usage encrypt and decrypt
var Encrypter = require('node-encrypter');
const secretKey = "<YOUR-SECRET-KEY>";
const encrypter = new Encrypter(secretKey);
const clearText = 'sanjaysikdar.dev';
const encryptedText = encrypter.encrypt(clearText);
const decryptedText = encrypter.decrypt(encryptedText);
Advanced options
const secretKey = "<YOUR-SECRET-KEY>";
const algorithm = 'aes256';
const saltKeyLength = 32;
const digest = 'hex';
const encrypter = new Encrypter(secretKey, algorithm, saltKeyLength, digest);
secretKey
- secret string key used for encryption.algorithm
- cipher Algorithm (default: aes256).saltKeyLength
- length of salt key (default: 32).digest
- message digest algorithm (default: hex).
License
The Node Encrypter is open-sourced software licensed under the MIT license.