
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
blowfish-js
Advanced tools
This is a pure Javascript implementation of Blowfish symmetric block cipher algorithm.
const blf = require('./blowfish.js');
const crypto = require('crypto');
{
let key = crypto.randomBytes(32);
let context = blf.key(key);
let plaintext = 'Length is divisible by 8 to match the block size';
let ciphertext = blf.ecb(context, Buffer.from(plaintext, 'utf8'));
let decrypted = blf.ecb(context, ciphertext, true);
}
{
let key = crypto.randomBytes(16);
let iv = crypto.randomBytes(8);
let context = blf.key(key);
let plaintext = 'CBC mode also requires full blocks. Pad input data if necessary.';
let ciphertext = blf.cbc(context, iv, Buffer.from(plaintext, 'utf8'));
let decrypted = blf.cbc(context, iv, ciphertext, true);
}
{
let key = crypto.randomBytes(16);
let iv = crypto.randomBytes(8);
let context = blf.key(key);
let plaintext = 'Same with CFB. Full blocks only!';
let ciphertext = blf.cfb(context, iv, Buffer.from(plaintext, 'utf8'));
let decrypted = blf.cfb(context, iv, ciphertext, true);
}
{
let key = crypto.randomBytes(16);
let iv = crypto.randomBytes(8);
let context = blf.key(key);
let plaintext = 'With OFB, input length can be anything, but remember to use a unique IV every time! Encryption and decryption are identical in this mode.';
let ciphertext = blf.ofb(context, iv, Buffer.from(plaintext, 'utf8'));
let decrypted = blf.ofb(context, iv, ciphertext, true);
}
Test vectors are included into the package. Results of ecb, cbc, cfb, and ofb functions are identical to nodejs crypto subsystem cipher algorithms bf-ecb, bf-cbc, bf-cfb, and bf-ofb respectively.
Timo J. Rinne tri@iki.fi
GPL-2.0
FAQs
Pure Javascript implementation of Blowfish block cipher.
The npm package blowfish-js receives a total of 799 weekly downloads. As such, blowfish-js popularity was classified as not popular.
We found that blowfish-js 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
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.