@component-tree/crypto-utils
v1.0.0
Published
A simple, tiny wrapper around some useful NodeJS crypto functions.
Downloads
323
Maintainers
Readme
crypto-utils
@component-tree/crypto-utils
Overview
A simple wrapper for common NodeJS crypto functions
Install
npm i -S @component-tree/crypto-utils
Usage
const cryptoUtils = require('@component-tree/crypto-utils');
const key = 'This has to bE thirty-tw0 chars!';
/* ENCRYPT (Uses aes-256-cbc)*/
const encrypted = cryptoUtils.encrypt(key, 'This is some text to encrypt');
/* DECRYPT */
const decrypted = cryptoUtils.decrypt(key, encrypted);
console.log(decrypted);
/* HASH FUNCTIONS */
const str = 'This will be hashed';
const md5Hash = cryptoUtils.md5(str);
const sha1 = cryptoUtils.sha1(str);
const sha256 = cryptoUtils.sha256(str);
License
MIT