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

ts-blake2s

v1.0.0

Published

Pure-TypeScript port of BLAKE2s (RFC 7693).

Readme

ts-blake2s

A pure-TypeScript port of BLAKE2s — a cryptographic hash function optimised for 32-bit platforms, defined in RFC 7693.

  • 1–32 byte digest, optional 0–32 byte secret key (MAC mode).
  • Faster than SHA-2 on most platforms; collision-resistant.
  • No native dependencies. Browser- and Node-compatible.
  • Tested against RFC 7693 §B, the canonical BLAKE2 KAT vectors, and node's crypto.createHash('blake2s256').

For 64-bit platforms or longer outputs, use BLAKE2b.

Install

npm install @scott/blake2s

Usage

import { blake2s, blake2sHex, Blake2s } from '@scott/blake2s';

// One-shot
const digest = blake2sHex('abc');
// => '508c5e8c327c14e2e1a72ba34eeb452f37458b209ed63a294d999b4c86675982'

// Truncated digest
const short = blake2sHex('abc', 16);   // 128-bit output

// Keyed (MAC mode)
const key = new Uint8Array(32);
const mac = blake2s(input, 32, key);

// Streaming
const h = new Blake2s();
h.update(chunkA);
h.update(chunkB);
const out = h.hexDigest();

API

  • blake2s(input, outlen?, key?) — one-shot, returns Uint8Array.
  • blake2sHex(input, outlen?, key?) — one-shot, returns lowercase hex.
  • new Blake2s(outlen?, key?) — streaming.
    • .update(data) — feed bytes (or a UTF-8 string).
    • .digest() — finalise, returns Uint8Array.
    • .hexDigest() — finalise, returns hex string.

Constraints: 1 <= outlen <= 32, 0 <= keylen <= 32.

Test vectors

This port matches:

  • RFC 7693 §B test vector — BLAKE2s-256 of "abc".
  • The canonical empty-input digest (verified against node:crypto.createHash('blake2s256')).
  • The official BLAKE2-KAT keyed-mode vector (key = 00..1f, input = 0040d15fee…).
  • Streaming-equivalence and validation cases.

Run them with:

npm test

Upstream

Originally from mjosaarinen/blake2_mjosref (CC0 1.0 Universal — public domain).

License

CC0-1.0 — see LICENSE.