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

arc-hash

v3.1.0

Published

ES6 convenience library for hashing arrays, objects, strings as md5 or sha256

Downloads

6,428

Readme

arc-hash Build Status

Convenience ES6 hashing library. Supports object, array and string hashing for md5 and sha256

NOTE: 2.0 can be considered a breaking change. The hashes being returned were non standard (ie. did not match externally generated md5s or shas). This is fixed, but the hashes returned will be different that v1, so will be incompatible with stored hashes.

Install

$ npm install arc-hash --save

Features

  • supports md5 and sha256
  • supports arrays and objects that reduce to scalar values

Basic Usage

const ArcHash = require('arc-hash');

// This is an example complex object that reduces to scalar value
const exampleObject = {
    'B': 5,
    'D': {
        'Zebra': 'Camel',
        'Antelope': [0,2,
            {
                'Deep':'Mind'
            },
            ['omega','alpha']
        ]
    },
    'A': 'Is a String',
};

console.log(ArcHash.md5(exampleObject));
/*
 Output: 7d388f6ec86c79805a534c910471c7c7
 Any change to the object including changing the order of an array, or changing the case in a key or a value will result in a new hash
*/

API

ArcHash.md5(value:Unknown)

Take an unknown value and return an md5 hash representing it

ArcHash.sha256(value:Unknown)

Take an unknown value and return a sha256 hash representing it

NOTES & WARNINGS

  1. Array order matters for a hash, object order assignment does not.

  2. Keys and values are case sensitive

  3. Circular object references are not handled

  4. String() is eventually applied to all values, so 5 and '5' will not be seen as different values

  5. This is not incredibly performant, and should not be used for dynamic comparison over potentially large data sets

Testing

npm test