Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@types/object-hash
Advanced tools
TypeScript definitions for object-hash
@types/object-hash provides TypeScript type definitions for the object-hash library, which is used to create unique hashes for JavaScript objects. This is useful for tasks such as caching, object comparison, and ensuring data integrity.
Basic Hashing
This feature allows you to generate a hash for a simple JavaScript object. The hash can be used to uniquely identify the object.
const objectHash = require('object-hash');
const hash = objectHash({ foo: 'bar' });
console.log(hash);
Hashing with Options
This feature allows you to customize the hashing algorithm and encoding. In this example, the SHA-1 algorithm and hex encoding are used.
const objectHash = require('object-hash');
const hash = objectHash({ foo: 'bar' }, { algorithm: 'sha1', encoding: 'hex' });
console.log(hash);
Hashing Arrays
This feature allows you to generate a hash for an array. The hash will uniquely represent the array's contents.
const objectHash = require('object-hash');
const hash = objectHash([1, 2, 3, 4]);
console.log(hash);
Hashing Nested Objects
This feature allows you to generate a hash for nested objects. The hash will uniquely represent the entire structure of the nested object.
const objectHash = require('object-hash');
const hash = objectHash({ foo: { bar: 'baz' } });
console.log(hash);
hash-it is a lightweight library for creating unique hashes for JavaScript objects. It is similar to object-hash but focuses on performance and simplicity.
The crypto module in Node.js provides cryptographic functionality that includes a set of wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify functions. While it is more general-purpose, it can be used to hash objects with some additional work.
fast-json-stable-stringify is a library that provides deterministic JSON.stringify() results. It can be used in conjunction with a hashing function to create consistent hashes for objects.
npm install --save @types/object-hash
This package contains type definitions for object-hash (https://github.com/puleos/object-hash).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/object-hash.
These definitions were written by Michael Zabka, Artur Diniz, and Martin Badin.
FAQs
TypeScript definitions for object-hash
The npm package @types/object-hash receives a total of 600,960 weekly downloads. As such, @types/object-hash popularity was classified as popular.
We found that @types/object-hash demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.