Miss any of our Open RFC calls?Watch the recordings here! »

simple-aes-256

3.0.1 • Public • Published

Simple aes-256-ctr

NPM Package

Use

npm install simple-aes-256

const SimpleAes = require('simple-aes-256')

const message = 'This is some message'
const secret = 'a very secret password'

// encrypt and decrypt functions sha256 hash the secret which can be any string or buffer
let encrypted = SimpleAes.encrypt(secret, message)
let decrypted = SimpleAes.decrypt(secret, encrypted)
// decrypted.toString() === message


const hashedSecret = require('crypto').randomBytes(32)

// encryptRaw and decryptRaw functions only accept a 32 byte buffer secret
encrypted = SimpleAes.encryptRaw(hashedSecret, message)
decrypted = SimpleAes.decryptRaw(hashedSecret, encrypted)
// decrypted.toString() === message

Install

npm i simple-aes-256

DownloadsWeekly Downloads

17

Version

3.0.1

License

MIT

Unpacked Size

4.73 kB

Total Files

5

Last publish

Collaborators

  • avatar