json fingerprinting tool for creating consistent and comparable checksums of unordered json data
Project description
The json-fingerprint package provides easy checksum creation ("fingerprinting") from unordered JSON data.
Installation and use
To install the package, run pip install json-fingerprint
.
Below is a sample for creating simple fingerprints:
import json
import json_fingerprint as jfp
obj_1_str = json.dumps([3, 2, 1, {"foo": "bar"}])
obj_2_str = json.dumps([2, {"foo": "bar"}, 1, 3])
fp_1 = jfp.json_fingerprint(obj_1_str, hash_function='sha256', version=1)
fp_2 = jfp.json_fingerprint(obj_2_str, hash_function='sha256', version=1)
print(f'fp_1: {fp_1}')
print(f'fp_2: {fp_2}')
This will output two identical fingerprints regardless of the different ordering of the json elements:
fp_1: jfpv1$sha256$5815eb0ce6f4e5ab0a771cce2a8c5432f64222f8fd84b4cc2d38e4621fae86af
fp_2: jfpv1$sha256$5815eb0ce6f4e5ab0a771cce2a8c5432f64222f8fd84b4cc2d38e4621fae86af
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for json_fingerprint-0.1.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d669d029dc9b18f4d1b603d4c58ee8117b63160aae7b8d405d25e069ef8666e |
|
MD5 | 764571fdd1f22d389b52a915050d6a92 |
|
BLAKE2b-256 | 20200b361374b206f5c4673557faa28baf9fd2ed810ef6f6648fefa792b103d2 |