Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including aes256 with all npm packages installed. Try it out:

var aes256 = require("aes256")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

aes256 v1.0.4

A Node.js module to simplify using the built-in "crypto" module for AES256 encryption with random initialization vectors

aes256

GitHub Latest Release Build Status Coverage Status Dependency Status Dev Dependency Status

A Node.js module to simplify using the built-in crypto module for AES-256 encryption with random initialization vectors.

This module generates a random initialization vector each time one of the encrypt methods is called.

Furthermore, your symmetric session key (a.k.a. secret, a.k.a. passphrase) can be of any size because it is hashed using SHA-256.

Install

$ npm install aes256

Usage

Example using static methods

var aes256 = require('aes256');

var key = 'my passphrase';
var plaintext = 'my plaintext message';

var encrypted = aes256.encrypt(key, plaintext);
var decrypted = aes256.decrypt(key, encrypted);

// plaintext === decrypted

Example using an AesCipher instance

var aes256 = require('aes256');

var key = 'my passphrase';
var plaintext = 'my plaintext message';

var cipher = aes256.createCipher(key);

var encrypted = cipher.encrypt(plaintext);
var decrypted = cipher.decrypt(encrypted);

// plaintext === decrypted

API

Documentation maaaaaybe forthcoming....

For now, looking at the above usage examples, the code, or the unit tests should all give you a pretty good idea without much effort as the API surface area is very small.

License

Copyright (c) 2015, James M. Greene (MIT License)

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free