
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
json-fingerprint
Advanced tools
Fingerprint a JSON by calculating the hash (default: sha256) based on the shape of the JSON and its value types.
npm install json-fingerprint
import {fingerprintJSON} from 'json-fingerprint';
const {hash, jsonPaths} = fingerprintJSON(`{"foo":"bar"}`)
// hash = 3e61d854042bcd6273a8e18589eb53a37e4cdc111bd2dc717413951637c11e2d
// jsonPaths = ['$:object', '$.foo:string']
const {hash, jsonPaths} = fingerprintJSON(`{"foo":"some string"}`)
// hash = 3e61d854042bcd6273a8e18589eb53a37e4cdc111bd2dc717413951637c11e2d
// jsonPaths = ['$:object', '$.foo:string']
// JSON input
fingerprintJSON(`{"foo":"bar"}`)
// object input
fingerprintJSON({"foo":"bar"})
// custom hash function
fingerprintJSON(`{"foo":"bar"}`, myCustomHashFn)
const {hash, jsonPaths, source} = fingerprintJSON(`{"foo":"bar"}`)
hash
: fingerprint hash of the JSONjsonPaths
: internal JSON meta data (hash is calculated based on stringified jsonPaths)source
: original JSON provided as inputimport { createHash } from 'node:crypto';
function sha512(data) {
/**
* https://nodejs.org/api/crypto.html#cryptocreatehashalgorithm-options
* `openssl list -digest-algorithms` to display the available digest algorithms
*/
return createHash('sha512').update(data).digest('hex');
}
fingerprintJSON(`{"foo":"bar"}`, sha512);
FAQs
JSON fingerprint - create an unique hash for JSON data based on structure and value types
The npm package json-fingerprint receives a total of 0 weekly downloads. As such, json-fingerprint popularity was classified as not popular.
We found that json-fingerprint demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.