
Security News
Vite+ Joins the Push to Consolidate JavaScript Tooling
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
A Node.js module to simplify using the built-in "crypto" module for AES256 encryption with random initialization vectors
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.
$ npm install aes256
var aes256 = require('aes256');
var key = 'my passphrase';
var plaintext = 'my plaintext message';
var buffer = Buffer.from(plaintext);
var encryptedPlainText = aes256.encrypt(key, plaintext);
var decryptedPlainText = aes256.decrypt(key, encryptedPlainText);
// plaintext === decryptedPlainText
var encryptedBuffer = aes256.encrypt(key, buffer);
var decryptedBuffer = aes256.decrypt(key, encryptedBuffer);
// plaintext === decryptedBuffer.toString('utf8)
AesCipher
instancevar aes256 = require('aes256');
var key = 'my passphrase';
var plaintext = 'my plaintext message';
var buffer = Buffer.from(plaintext);
var cipher = aes256.createCipher(key);
var encryptedPlainText = cipher.encrypt(plaintext);
var decryptedPlainText = cipher.decrypt(encryptedPlainText);
// plaintext === decryptedPlainText
var encryptedBuffer = cipher.encrypt(buffer);
var decryptedBuffer = cipher.decrypt(encryptedBuffer);
// plaintext === decryptedBuffer.toString('utf8)
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.
Copyright (c) 2015-2021, James M. Greene (MIT License)
FAQs
A Node.js module to simplify using the built-in "crypto" module for AES256 encryption with random initialization vectors
The npm package aes256 receives a total of 9,394 weekly downloads. As such, aes256 popularity was classified as popular.
We found that aes256 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
Security News
Ruby Central’s incident report on the RubyGems.org access dispute sparks backlash from former maintainers and renewed debate over project governance.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.