Skip to content

sebas5384/crypty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crypty

A super simple (but secure) encryption and decryption of text using aes-256-cbc algorithm with a 32 bytes secret.

Important

By design the hash doesn't change at every encryptation, so don't use this lib to encrypt passwords.

Build Status sponsored by Taller


Install

npm i crypty

or

yarn add crypty

Usage

import { encrypt, decrypt } from 'crypty'

// Your secret must have 32 bytes.
const secret = 'P10PJY1ckcMEeZxWHfVzsiOktuXf8O8O'

const hash = encrypt('my text', secret)
// => 46e2a7e3214f127c198247332cdc89ce

const text = decrypt(hash, secret)
// => 'my text'

Disclaimer

Based on node-crypto-examples from @chris-rock.