npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

sync-sha256

v1.0.4

Published

Zero-dependency synchronous SHA-256 for TypeScript

Readme

sync-sha256

Zero-dependency, synchronous SHA-256 for TypeScript. Drop-in replacement for js-sha256 with first-class type safety.

Demo

  • No dependencies — pure TypeScript, no crypto polyfills
  • Synchronous — no await, works in sync contexts
  • UTF-8 — correct handling of Unicode, including surrogate pairs (emoji, CJK)
  • Zero allocations on repeated calls (reuses internal Uint32Array)
  • Tree-shakeable — only import what you use

Install

npm install sync-sha256
# or
bun add sync-sha256

Usage

import { sha256 } from 'sync-sha256'

sha256('') // e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
sha256('The quick brown fox jumps over the lazy dog') // d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592

// UTF-8
sha256('中文') // 72726d8818f693066ceb69afa364218b692e62ea92b385782363780f47529c21
sha256('🎉')   // 6146299cd54818a0e659eb6ac88e80f6f8f70536bbbd962d36973f2d2323f26c

API

sha256(message: string): string

Returns a 64-character hex string.

import { sha256 } from 'sync-sha256'

const hash = sha256('Message to hash')
// => 'f7bc83f430538424b13298e6aa6fb1438f4d89a51f0ed5d0a63f5b3e1230c20e'

Differences from js-sha256

| Package | Size | SHA-224 | HMAC | Streaming | | ----------- | ------ | ------- | ---- | --------- | | js-sha256 | ~3.5KB | ✅ | ✅ | ✅ | | sync-sha256 | ~2KB | ❌ | ❌ | ❌ |

Use js-sha256 if you need SHA-224, HMAC, streaming, or byte array input.

Use sync-sha256 if you need a smaller, typed, synchronous string-to-hex hasher.

Benchmarks

Bun 1.3.2, AMD Ryzen 5 7500F:

| Test | Throughput | Time | | ---------------------------------- | ----------------- | ----- | | 100K × 5-byte strings | 929K ops/sec | 108ms | | 10K × 100-byte strings | 610K ops/sec | 16ms | | 1K × 10KB strings | 11.1K ops/sec | 91ms | | 100 × 1MB strings | 117 ops/sec | 862ms | | Sustained throughput (50MB chunks) | 108 MB/s | 443ms | | Single 500MB string | — | 5.0s | | 2K × 1MB strings (2GB total alloc) | — | 17.7s | | Single 1GB string (doubling) | — | 9.7s |

License

MIT