Socket
Book a DemoInstallSign in
Socket

stable-sha1

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stable-sha1

Get a consistent sha1 hash for a JSON object in both browser and node

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

stable-sha1

Get a consistent sha1 hash for a JSON object in both browser and node

Inspired by shasum, but unlike shasum it is only 3.6KB once minified and gzipped. It does this by only supporting shasums for objects, not for buffers. It also achieves further savings by assuming a browser with support for JSON and using the relatively lightweight rusha instead of the very large crypto-browserify.

Build Status Dependency Status NPM version

Installation

npm install stable-sha1

Usage

'use strict';

var assert = require('assert');
var sha = require('stable-sha1');

assert(sha({a: 1, b: 2, z: 3}) === sha({z: 3, b: 2, a: 1}));
assert(sha({a: 1, b: 2, z: 3}) !== sha({z: 3, b: 2, a: 2}));

Contributing

Be sure to run tests before submitting a pull request.

$ npm install
$ npm test
tests passed
$ npm run browser

Load http://localhost:3000 in your web browser and you should see "tests passed".

License

MIT

Keywords

json

FAQs

Package last updated on 05 Feb 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts