Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Apr 25, 2024 via pnpm

object-hash 3.0.0

Generate hashes from javascript objects in node and the browser.
Package summary
Share
0
issues
1
license
1
MIT
Package created
7 Mar 2014
Version published
18 Feb 2022
Maintainers
2
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
object-hash@3.0.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of object-hash 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does object-hash do?

Object-hash is a popular npm package designed to generate hashes from Javascript objects and values in both node and the browser. Under the hood, it uses the node.js crypto module for hashing functionality. It supports various hash algorithms, including SHA1, MD5 and others depending on the platform, as well as custom streams like CRC32. It's designed to accommodate hashing values of any type and allows for the exclusion of values, giving you the flexibility to generate hashes of keys only, thereby grouping similar objects with varying values.

How do you use object-hash?

Using object-hash is relatively straightforward. First, you need to install the package by running npm install object-hash in your terminal. Once installed, you can generate a hash from an object or any other type by importing the module and calling the hash function. Here are some usage examples:

// Include the package in your file
var hash = require('object-hash');

// Generate a hash
hash({foo: 'bar'}) // Returns: '67b69634f9880a282c14a0f0cb7ba20cf5d677e9'
hash([1, 2, 2.718, 3.14159]) // Returns: '136b9b88375971dff9f1af09d7356e3e04281951'

You can leverage different algorithms and encodings and exclude values or keys:

hash({foo: 'bar', a: 42}, { respectType: false }) // e.g. 'object:anumber:42foo:string:bar'

The object-hash package comes with built-in sugar methods including hash.sha1(value), hash.keys(value), hash.MD5(value), and hash.keysMD5(value). For instance, hash.sha1(value) is equivalent to hash(value, {algorithm: 'sha1'}).

Where are the object-hash docs?

The detailed documentation for object-hash can be found on the project's GitHub page at https://github.com/puleos/object-hash. Here, you'll find executive summaries of what the package does, how it works, and more detailed examples of how to use it based on a variety of scenarios and requirements. The readme file for the library is quite comprehensive, providing a reliable point of reference for understanding and utilizing the package effectively.