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

@sentinel-password/entropy

v0.1.1

Published

Shannon entropy estimator with dictionary, l33t, and pattern detection for sentinel-password. Zero runtime dependencies; ≤ 30 KB gzipped (CI enforced).

Downloads

13,072

Readme

@sentinel-password/entropy

Shannon entropy estimator for sentinel-password with dictionary, l33t, and pattern detection. Zero runtime dependencies. ≤ 30 KB gzipped (CI enforced).

This package complements @sentinel-password/core, which performs rule-based validation (length, character types, common passwords). The entropy package answers a different question: how long would this password survive a brute-force attack?

Installation

pnpm add @sentinel-password/entropy

The package has no peer dependencies. It can be used standalone or alongside @sentinel-password/core.

Quick start

import { estimateEntropy } from '@sentinel-password/entropy'

const result = estimateEntropy('Tr0ub4dor&3')
// {
//   bits: 28.4,
//   score: 1,
//   crackTime: {
//     onlineThrottled:   { seconds: 6.5e6, display: '2 months' },
//     onlineUnthrottled: { seconds: 1.8e4, display: '5 hours' },
//     offlineSlowHash:   { seconds: 18,    display: 'less than a minute' },
//     offlineFastHash:   { seconds: 0.018, display: 'instant' },
//   },
//   patterns: ['dictionary', 'l33t', 'capitalization'],
// }

Composition with @sentinel-password/core

The two packages do not share types or runtime; consumers compose them explicitly:

import { validatePassword } from '@sentinel-password/core'
import { estimateEntropy } from '@sentinel-password/entropy'

function check(pwd: string, email: string) {
  const rule = validatePassword(pwd, { personalInfo: [email] })
  const ent = estimateEntropy(pwd, { personalInfo: [email] })
  return {
    valid: rule.valid && ent.bits >= 40,
    score: Math.min(rule.score, ent.score),
    suggestions: rule.feedback.suggestions,
    crackTime: ent.crackTime.offlineSlowHash.display,
  }
}

API

estimateEntropy(password, options?)

Returns an EntropyResult describing the password's effective entropy in bits, a 0-4 score, four crack-time estimates under standard attack models, and the list of entropy-reducing patterns detected.

Options

| Option | Type | Default | Description | |---|---|---|---| | personalInfo | readonly string[] | [] | Strings whose presence in the password reduces effective entropy to 0. | | customDictionary | readonly string[] | [] | Extra dictionary words to match alongside the built-in 15K-word dictionary. | | scoreThresholds | readonly [number, number, number, number] | [28, 36, 60, 128] | Bit cutoffs for scores 1/2/3/4. Defaults align with NIST 800-63B guidance. |

Result

| Field | Type | Description | |---|---|---| | bits | number | Effective entropy after pattern/dictionary/l33t reduction. | | score | 0 \| 1 \| 2 \| 3 \| 4 | Banded score derived from bits via scoreThresholds. Aligns with core's StrengthScore. | | crackTime | CrackTimePresets | Four attack-model estimates (see below). | | patterns | readonly EntropyPattern[] | Reducing patterns detected, in order. |

Crack-time attack models

| Preset | Guesses/sec | Scenario | |---|---|---| | onlineThrottled | 100/hour | Rate-limited login form. | | onlineUnthrottled | 10/sec | No rate limit. | | offlineSlowHash | 10⁴/sec | Bcrypt cost 10, scrypt, argon2. | | offlineFastHash | 10¹⁰/sec | Raw MD5/SHA1 on a single modern GPU. |

Detected patterns

  • 'sequence'abc, 123, qwerty, …
  • 'repetition'aaaa, abab, …
  • 'dictionary' — match against the built-in 15 K dictionary or customDictionary.
  • 'l33t' — match after un-substituting @a, 0o, etc.
  • 'capitalization' — initial capital on a dictionary word.
  • 'personalInfo' — substring match against personalInfo (case-insensitive); forces bits: 0.

Bundle size

The built bundle is checked in CI and must stay under 30 720 bytes (30 KB) gzipped. If you add code, run:

pnpm --filter @sentinel-password/entropy build
gzip -c packages/entropy/dist/index.js | wc -c

Regenerating the dictionary

The bloom filter at src/data/dict-bloom.ts is generated from the seed files in data/. Regenerate after changing those files:

pnpm --filter @sentinel-password/entropy generate:dict

License

MIT. See LICENSE.