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
json-fingerprint-0.0.4.tar.gz
(4.4 kB
view hashes)
Built Distribution
Close
Hashes for json_fingerprint-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78c37098ae2431c88036a4799325c7e6c7c041dbdec4ebdfe814260acb4dcfdd |
|
MD5 | 60bf2d690ce50c88f0887b7a3902652e |
|
BLAKE2b-256 | ab02e4b4c643fce6e0b435fa052da2f29981f973e5e836bc2b4b436fd6fa0f37 |