
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
Install locally:
npm install ./bhash
Or from npm:
npm install bhash
const bhash = require('./bhash'); // Local
// OR
// const bhash = require('bhash'); // From npm
Sync:
const salt = bhash.genSaltSync(12); // 12 rounds
console.log('Salt:', salt);
Async:
bhash.genSalt(12, (err, salt) => {
if (err) throw err;
console.log('Salt:', salt);
});
Sync:
const password = 'MySuperSecret!123';
const salt = bhash.genSaltSync();
const hash = bhash.hashSync(password, salt);
console.log('Hash:', hash);
Async:
bhash.genSalt(10, (err, salt) => {
bhash.hash('MySuperSecret!123', salt, (err, hash) => {
if (err) throw err;
console.log('Hash:', hash);
});
});
Sync:
const isMatch = bhash.compareSync('MySuperSecret!123', hash);
console.log('Password match:', isMatch); // true
Async:
bhash.compare('MySuperSecret!123', hash, (err, matched) => {
if (err) throw err;
console.log('Password match:', matched); // true or false
});
const strong = bhash.checkPasswordStrength('MySuperSecret!123');
console.log('Is strong password?', strong); // true or false
const safe = bhash.timingSafeEqual(hash, hash2);
console.log('Timing safe equal:', safe);
const rounds = bhash.getRounds(hash);
console.log('Rounds used:', rounds);
const version = bhash.getHashVersion(hash);
console.log('Hash version:', version); // e.g. '2b'
Generates a salt synchronously. rounds is the work factor (default: 10).
Generates a salt asynchronously. Callback receives (err, salt).
Hashes a password synchronously with the given salt.
Hashes a password asynchronously. Callback receives (err, hash).
Compares a password to a hash synchronously. Returns true or false.
Compares a password to a hash asynchronously. Callback receives (err, matched).
Extracts the number of rounds used from a hash.
Performs a timing-safe comparison between two strings or buffers.
Checks if a password is strong (min 8 chars, upper, lower, number, special).
Returns the hash version (e.g. '2b') from a hash string.
bhash.js: Main entry point (exports everything from src/index.js)src/index.js: All core logic and featuresREADME.md: Full documentationpackage.json: Project metadata and scriptsMIT — Free for personal and commercial use.
Developed by Muhammad Wajid Ashraf — Software Engineer
Made with ❤️ by Muhammad Wajid Ashraf
FAQs
A lightweight bcrypt alternative for password hashing and verification
We found that bhash demonstrated a healthy version release cadence and project activity because the last version was released less than 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.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.