Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cyclical-object-hash

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cyclical-object-hash

Deterministically hash a cyclical object with blake2b

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

cylical-object-hash stability

npm version downloads js-standard-style

Blake object hash.

Usage

const objectHash = require('cylical-object-hash')

let exampleObject = {
  "@context": "http://schema.org",
  "@type": "Book",
  "copyrightHolder": {
    "@type": "Organization",
    "name": "Holt, Rinehart and Winston"
  },
  "copyrightYear": "2007",
  "description": "NIMAC-sourced textbook",
  "genre": "Educational Materials",
  "inLanguage": "en-US",
  "isFamilyFriendly": "true",
  "isbn": "9780030426599",
  "name": "Holt Physical Science",
  "numberOfPages": "598",
  "publisher": {
    "@type": "Organization",
    "name": "Holt, Rinehart and Winston"
  }
}

objectHash.hex(exampleObject)
// '79fc74f0dd70d955a7d61271d09f0806aadff55ea770621cbb9a9194e9b9053cc59c3ca669b273dd0fb1a0efc4617d2c9824a339ad0200fdbd231b549f946027'

objectHash(exampleObject)
// Uint8Array 
// Blake2b { digestLength: 64, finalized: false, pointer: 64 }

API

objectHash(obj)

This takes an ordinary object and will deterministically hash it via blake2b. It returns a Uint8Array by default.

.hex(obj)

This takes an ordinary object and will deterministically hash it via blake2b. Unlike the function above, it returns it as a hex string.

Installation

$ npm install cyclical-object-hash

License

MIT

Keywords

FAQs

Package last updated on 16 Jun 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc