
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
tiny-hashes
Advanced tools
Some super-tiny implementations of common hash functions (MD5, SHA-1 and SHA-256).
From npm:
npm i tiny-hashes
Preferably using ES modules:
import md5 from 'tiny-hashes/md5';
import sha1 from 'tiny-hashes/sha1';
import sha256 from 'tiny-hashes/sha256';
md5('hello, world'); // "e4d7f1b4ed2e42d15898f4b27b019da4", hopefully
sha1('hello, world'); // "b7e23ec29af22b0b4e41da31e868d57226121c84", hopefully
sha256('hello, world'); // "09ca7e4eaa6e8ae9c7d261167129184883644d07dfba7cbfbc4c8a2e08360d5b", hopefully
The following styles should also all work, but may be less-friendly to tree-shaking:
const md5 = require('tiny-hashes/md5');
const sha1 = require('tiny-hashes/sha1');
const sha256 = require('tiny-hashes/sha256');
import { md5, sha1, sha256 } from 'tiny-hashes';
const { md5, sha1, sha256 } = require('tiny-hashes');
Please don't use this if you absolutely rely on it being correct. There are more solid solutions out there.
Please also don't use this server-side in Node.js - the crypto
build-in module exists for a reason.
Basically only use this if you want a super-duper-tiny hash function in the browser that you can be about 99% sure is correct and should always be self-consistent.
FAQs
Super-tiny implementations of some basic hash functions
The npm package tiny-hashes receives a total of 268,497 weekly downloads. As such, tiny-hashes popularity was classified as popular.
We found that tiny-hashes 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
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.