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 🙏

© 2024 – Pkg Stats / Ryan Hefner

srisum

v2.0.0

Published

CLI tool to compute and check Subresource Integrity digests.

Downloads

27

Readme

npm license Travis AppVeyor Coverage Status

srisum(1) -- compute and check subresource integrity digests

SYNOPSIS

$ npx srisum [OPTION]... [FILE]...

EXAMPLES

Computing SRI Digests

For a single file:

$ npx srisum styles.css > styles.css.sri

For multiple different files:

$ npx srisum styles.css index.js package.json bundle.js > app.sri

From stdin:

$ cat styles.css | npx srisum -a sha1
sha1-hmkHOZdrfLUVOqpAgryfC8XNGtE -

Specify algorithms to generate:

$ npx srisum styles.css index.js --algorithms sha512 sha256 sha1 > styles.css.sri

Add options:

$ npx srisum styles.css -a sha1 --options releaser=Kat date=2017-01-01
sha1-hmkHOZdrfLUVOqpAgryfC8XNGtE=?releaser=kat?date=2017-01-01 styles.css

Checking Integrity

Passing checksum file as an argument:

$ npx srisum -c styles.css.sri
styles.css: OK (sha512)

Passing multiple checksum files:

$ npx srisum -c styles.css.sri js-files.sri
styles.css: OK (sha512)
index.js: OK (sha512)
lib/util.js: OK (sha512)

Checksum file from stdin:

$ cat styles.css.sri | npx srisum -c
styles.css: OK (sha512)

Checksum stdin itself:

$ echo "hello" | npx srisum > stdin.sri
$ echo "hello" | npx srisum -c stdin.sri
-: OK (sha512)

DESCRIPTION

Print or check Subresource Integrity digests.

Spec: https://w3c.github.io/webappsec/specs/subresourceintegrity/

srisum's API is based on the SHA[N]SUM(1) family of unix utilities.

With no FILE or when FILE is -, read standard input.

-a, --algorithms [ALGO]... - hash algorithms to generate for the FILEs

-s, --strict - follow a strict interpretation of the SRI spec

-o, --options [OPT]... - append given OPT strings to generated digests

-c, --check - read SRI sums from the FILEs and check them

-d, --digest-only - only output the digest for each FILE, without filenames

--help - display help and exit

--version - output version information and exit

The following options are useful only when verifying integrity:

--ignore-missing - don't fail or report status for missing files

--quiet - don't print OK for each successfully verified file

--status - don't output anything, status code shows success

--strict - exit non-zero for lines that fail strict SRI format

-w, --warn - warn about improperly formatted SRI lines

When checking, the input should be a former output of this program. The default mode is to print line with space-separated SRI digests, one more space, and a name for each FILE.

Strict mode, enabled with --strict, will entirely ignore digests (in input and output) that fail all of the following conditions:

  • algorithms must be one or more of: sha256, sha384, sha512
  • options must be visual characters except for ?.
  • digest strings must be valid RFC4648 Base64 strings.

AUTHOR

Written by Kat Marchan

REPORTING BUGS

Please file any relevant issues on Github.

LICENSE

This work is released under the terms of the MIT license. For more details, see the LICENSE file included with this distribution.

SEE ALSO

  • shasum(1)
  • sha1sum(1)