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

@ggozad/mnemonic

v2.0.0

Published

Memorable random phrases of known strength

Readme

@ggozad/mnemonic

Random phrases of a chosen strength, as English words. Every 32 bits become 3 words from a list of 1,626, so a 96-bit phrase has 9 words:

mean yesterday gone size waist lace endless apple war

ESM with TypeScript types, for browsers and Node 23.6+. Randomness comes from crypto.getRandomValues.

Install

pnpm add @ggozad/mnemonic

Usage

import { canonicalise, generate, parse, toWords, words } from '@ggozad/mnemonic';

generate();      // 9 words, 96 bits
generate(128);   // 12 words; bits must be a positive multiple of 32

toWords(bytes);  // Uint8Array whose length is a multiple of 4 → phrase
parse(phrase);   // phrase → Uint8Array

canonicalise('  Mean YESTERDAY gone ...'); // 'mean yesterday gone ...'

words;           // the 1,626 words, for autocomplete

parse and canonicalise ignore case and extra whitespace. They throw on a word that is not in words (the message names it), on a word count that is not a positive multiple of 3, and on a 3-word group that does not encode a 32-bit value.

Encoding

Bytes are read as big-endian 32-bit unsigned integers. With n = 1626, each integer x becomes the word indices

w1 = x mod n
w2 = (floor(x / n) + w1) mod n
w3 = (floor(x / n²) + w2) mod n

and a triplet of indices decodes to

x = w1 + n·((w2 − w1) mod n) + n²·((w3 − w2) mod n)

n³ = 4,298,942,376 is just above 2³² = 4,294,967,296, so every 32-bit value has a triplet. The 3,974,080 triplets that decode to 2³² or more are rejected.

Word list

The words come from a frequency list of contemporary English poetry. Version 2 replaces 58 words about violence, drugs, sex and insults with neutral nouns, in place. A phrase without those words decodes as it did in 1.x.

The idea comes from the Electrum bitcoin client.

License

MIT. Copyright (C) Yiorgis Gozadinos.