@component-tree/crypto-utils

1.0.0 • Public • Published

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

Package Sidebar

Install

npm i @component-tree/crypto-utils

Weekly Downloads

119

Version

1.0.0

License

MIT

Last publish

Collaborators

  • reelykevin