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

@cbortech/hash-extension

v0.2.2

Published

Cryptographic hash application-string extension for @cbortech/cbor

Readme

@cbortech/hash-extension

Cryptographic hash application-string extension for @cbortech/cbor.

@cbortech/cbor is a TypeScript library for converting between CBOR, CDN, and JavaScript values.

A playground for @cbortech/cbor is published at https://cbor.tech/cbor/.

This extension implements the hash application-extension identifier from CDN. It computes a cryptographic hash and returns the output as a CBOR byte string.

Installation

npm install @cbortech/cbor @cbortech/hash-extension

Usage

import { CBOR } from '@cbortech/cbor';
import { hash } from '@cbortech/hash-extension';

const cbor = new CBOR({ extensions: [hash] });

// Parse CDN containing hash values.
const document = cbor.parse(`{
  "hash": hash'foo'
}`);
// document.hash is a bare Uint8Array.

// Convert CDN containing a hash value into CBOR.
const encoded = cbor.fromCDN("hash'foo'").toCBOR();
// encoded is CBOR binary data stored as a Uint8Array.
// Inspect the encoded CBOR value with toHexDump():
console.log(CBOR.fromCBOR(encoded).toHexDump());
// 58 20 2C 26 B4 6B 68 FF C6 8F F9 9B 45 3C 1D 30 41 34 13 42 2D 70 64 83 BF A0 F9 8A 5E 88 62 66 E7 AE  -- h'2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae'

// Format CDN with hash values as h'...'.
console.log(cbor.format(`{ "hash" : hash'foo' }`, { appStrings: false }));
// {"hash":h'2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae'}

CDN Forms

  • hash'foo' computes SHA-256 over the UTF-8 text foo.
  • hash<<'foo'>> computes SHA-256 over the byte string foo.
  • hash<<"foo">> computes SHA-256 over the UTF-8 text foo.
  • hash<<h'0102', -16>> computes SHA-256 over raw bytes.
  • hash<<'foo', -44>> selects an algorithm by COSE integer ID.
  • hash<<'foo', "SHA-512">> selects an algorithm by COSE algorithm name.

No uppercase HASH variant is defined.

Supported Algorithms

  • -14 / SHA-1
  • -15 / SHA-256/64
  • -16 / SHA-256
  • -17 / SHA-512/256
  • -18 / SHAKE128
  • -43 / SHA-384
  • -44 / SHA-512
  • -45 / SHAKE256

License

Apache-2.0